diff options
Diffstat (limited to 'meta-quanta/meta-common/recipes-quanta/network')
4 files changed, 89 insertions, 0 deletions
diff --git a/meta-quanta/meta-common/recipes-quanta/network/mac-address_git.bb b/meta-quanta/meta-common/recipes-quanta/network/mac-address_git.bb new file mode 100644 index 000000000..5b63e49cb --- /dev/null +++ b/meta-quanta/meta-common/recipes-quanta/network/mac-address_git.bb @@ -0,0 +1,21 @@ +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +inherit autotools pkgconfig +inherit systemd + +S = "${WORKDIR}/git" +SRC_URI = "git://github.com/quanta-bmc/mac-address.git;protocol=git" +SRCREV = "08b87370c56ff69df852eca87391ae46c05d437a" + +DEPENDS += "autoconf-archive-native" +DEPENDS += "systemd" + +FILES_${PN} += "${bindir}/mac-address" + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "mac-address.service" + +EXTRA_OECONF = " \ + SYSTEMD_TARGET="multi-user.target" \ +" diff --git a/meta-quanta/meta-common/recipes-quanta/network/usb-network.bb b/meta-quanta/meta-common/recipes-quanta/network/usb-network.bb new file mode 100644 index 000000000..85146aa1f --- /dev/null +++ b/meta-quanta/meta-common/recipes-quanta/network/usb-network.bb @@ -0,0 +1,25 @@ +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +FILESEXTRAPATHS_append := "${THISDIR}/${PN}:" +SRC_URI_append = " file://usb-network.sh" +SRC_URI_append = " file://usb-network.service" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "libsystemd" +RDEPENDS_${PN} += "bash" + +FILES_${PN}_append = " ${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 +} + +SYSTEMD_SERVICE_${PN}_append = "usb-network.service" diff --git a/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.service b/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.service new file mode 100644 index 000000000..917b552c1 --- /dev/null +++ b/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.service @@ -0,0 +1,10 @@ +[Unit] +Description=Enable USB Network + +[Service] +Type=oneshot +ExecStart=/usr/sbin/usb-network.sh +EnvironmentFile=/usr/share/usb-network/usb-network.conf + +[Install] +WantedBy=multi-user.target diff --git a/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh b/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh new file mode 100644 index 000000000..444d4aee7 --- /dev/null +++ b/meta-quanta/meta-common/recipes-quanta/network/usb-network/usb-network.sh @@ -0,0 +1,33 @@ +#!/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 "Etherned/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 + cat /tmp/usb0_dev > functions/ecm.usb0/dev_addr # write device mac address + cat /tmp/usb0_host > functions/ecm.usb0/host_addr # write usb mac address + + ln -s functions/ecm.usb0 configs/c.1 + + echo "$UDC" > UDC + + rm /tmp/usb0_dev + rm /tmp/usb0_host + +fi + +exit 0 |