Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -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"
@@ -0,0 +1,8 @@
[Match]
Name=usb0
[Address]
Address=169.254.1.2/24
[Network]
DHCP=false
LinkLocalAddressing=no
IPv6AcceptRA=no
@@ -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
@@ -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