diff options
author | Lancelot Kao <lancelot.kao@fii-usa.com> | 2021-02-22 04:28:54 +0300 |
---|---|---|
committer | Mohaimen Alsamarai <mohaimen.alsamarai@fii-na.com> | 2021-04-09 17:45:22 +0300 |
commit | e8979de51fc39c53eec3ff3a8cd0bde70346265f (patch) | |
tree | a290c507491a0eb9464baa7954b37847c9199cde /meta-fii/meta-kudo/recipes-kudo | |
parent | cd9f5f00d75fe3735eebe886a1e0701bb25ea967 (diff) | |
download | openbmc-e8979de51fc39c53eec3ff3a8cd0bde70346265f.tar.xz |
meta-fii/meta-kudo: Add USB-NIC configuration
1. add USB-NIC functions
Signed-off-by: Lancelot Kao <lancelot.kao@fii-usa.com>
Change-Id: I1eba438c770c8ccd5794b1184d4a25ef7fbfb0e6
Diffstat (limited to 'meta-fii/meta-kudo/recipes-kudo')
4 files changed, 73 insertions, 0 deletions
diff --git a/meta-fii/meta-kudo/recipes-kudo/network/usb-network.bb b/meta-fii/meta-kudo/recipes-kudo/network/usb-network.bb new file mode 100644 index 000000000..249e454ae --- /dev/null +++ b/meta-fii/meta-kudo/recipes-kudo/network/usb-network.bb @@ -0,0 +1,29 @@ +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit allarch systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "libsystemd" +RDEPENDS_${PN} += "bash" + +SRC_URI_append += " \ + file://usb_network.sh \ + file://usb_network.service \ + file://00-bmc-usb0.network \ + " + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN}_append = " usb_network.service" +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 +} diff --git a/meta-fii/meta-kudo/recipes-kudo/network/usb-network/00-bmc-usb0.network b/meta-fii/meta-kudo/recipes-kudo/network/usb-network/00-bmc-usb0.network new file mode 100644 index 000000000..1b8d66e4d --- /dev/null +++ b/meta-fii/meta-kudo/recipes-kudo/network/usb-network/00-bmc-usb0.network @@ -0,0 +1,7 @@ +[Match] +Name=usb0 +[Address] +Address=169.254.95.118/16 +[Network] +LinkLocalAddressing=ipv6 +IPv6AcceptRA=no diff --git a/meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.service b/meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.service new file mode 100644 index 000000000..81a4e4244 --- /dev/null +++ b/meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.service @@ -0,0 +1,10 @@ +[Unit] +Description=enable usb network +After=phosphor-ipmi-host.service + +[Service] +Type=oneshot +ExecStart=/bin/bash -c '/usr/sbin/usb_network.sh' + +[Install] +WantedBy=multi-user.target diff --git a/meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.sh b/meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.sh new file mode 100644 index 000000000..8d7804d06 --- /dev/null +++ b/meta-fii/meta-kudo/recipes-kudo/network/usb-network/usb_network.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +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 + + echo f0835000.udc > UDC + +fi +exit 0 |