diff options
author | Jordan Chang <jordan.chang@ufispace.com> | 2023-03-03 10:53:28 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-04-11 21:49:12 +0300 |
commit | 7cbff67c14e1d33d2d77dd4b7adcf42426d64a1e (patch) | |
tree | 716ca2ea9226f9b9d13dfca97769740213767686 /meta-ufispace/meta-common/recipes-phosphor/network | |
parent | 8fe218a0ec92f3a788ecd5e68eb84e02a2ec7d75 (diff) | |
download | openbmc-7cbff67c14e1d33d2d77dd4b7adcf42426d64a1e.tar.xz |
meta-ufispace: Add meta-ufispace layer and meta-ncplite machine
Iniitial submission of meta-layer and meta-machine layer.
Tested: Build and run on our machine successfully.
Change-Id: I4920d8ce6aff119ba5cbc4772d84a6377784f85d
Signed-off-by: Jordan Chang <jordan.chang@ufispace.com>
Diffstat (limited to 'meta-ufispace/meta-common/recipes-phosphor/network')
4 files changed, 73 insertions, 0 deletions
diff --git a/meta-ufispace/meta-common/recipes-phosphor/network/usb-network.bb b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network.bb new file mode 100644 index 0000000000..14d84864cb --- /dev/null +++ b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network.bb @@ -0,0 +1,27 @@ +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +FILESEXTRAPATHS:append := "${THISDIR}/${PN}" +SRC_URI += "file://usb-network.sh \ + file://usb-network.service \ + file://00-bmc-usb0.network" + +inherit allarch systemd + +DEPENDS += "systemd" +RDEPENDS:${PN} += "libsystemd bash" + +FILES:${PN} += "${sysconfdir_native}/systemd/network/00-bmc-usb0.network" + +do_install() { + install -d ${D}/${sbindir} + install -m 0755 ${WORKDIR}/usb-network.sh ${D}/${sbindir} + + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/usb-network.service ${D}${systemd_unitdir}/system + + install -d ${D}${sysconfdir_native}/systemd/network/ + install -m 0644 ${WORKDIR}/00-bmc-usb0.network ${D}${sysconfdir_native}/systemd/network +} + +SYSTEMD_SERVICE:${PN} = "usb-network.service" diff --git a/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/00-bmc-usb0.network b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/00-bmc-usb0.network new file mode 100644 index 0000000000..28d1e9ad34 --- /dev/null +++ b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/00-bmc-usb0.network @@ -0,0 +1,8 @@ +[Match] +Name=usb0 +[Address] +Address=169.254.1.2/24 +[Network] +DHCP=false +LinkLocalAddressing=no +IPv6AcceptRA=no diff --git a/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/usb-network.service b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/usb-network.service new file mode 100644 index 0000000000..62641531aa --- /dev/null +++ b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/usb-network.service @@ -0,0 +1,10 @@ +[Unit] +Description=Enable USB Network +After=phosphor-ipmi-host.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/usb-network.sh + +[Install] +WantedBy=multi-user.target diff --git a/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/usb-network.sh b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/usb-network.sh new file mode 100644 index 0000000000..0ea9bd2a58 --- /dev/null +++ b/meta-ufispace/meta-common/recipes-phosphor/network/usb-network/usb-network.sh @@ -0,0 +1,28 @@ +#!/bin/bash -e + +cd /sys/kernel/config/usb_gadget + +if [ ! -f "g1" ]; then + mkdir g1 + cd g1 + + echo 0x1d6b > idVendor # Linux foundation + echo 0x0104 > idProduct # Multifunction composite gadget + mkdir -p strings/0x409 + echo "Linux" > strings/0x409/manufacturer + echo "Ethernet/ECM gadget" > strings/0x409/product + + mkdir -p configs/c.1 + echo 100 > configs/c.1/MaxPower + mkdir -p configs/c.1/strings/0x409 + echo "ECM" > configs/c.1/strings/0x409/configuration + + mkdir -p functions/ecm.usb0 + + ln -s functions/ecm.usb0 configs/c.1 + + # Write the device info in /sys/class/udc to UDC + echo 1e6a2000.usb > UDC + +fi +exit 0 |