mirror of
https://git.yoctoproject.org/meta-ti
synced 2026-07-16 06:17:51 +00:00
initramfs: Add initramfs-module-netsetup recipe for NFS boot
Add a standalone initramfs-module-netsetup recipe that installs 83-netsetup, an initramfs-framework module that configures the network interface via DHCP before the NFS root mount. The recipe's RDEPENDS pulls in CPSW and its dependencies, so the kernel modules and DHCP client are only included when NFS boot support is needed. Include initramfs-module-netsetup in packagegroup-ti-core-initramfs gated on :bsp-next, where AM65_CPSW_NUSS became a loadable module. TI staging kernels (6.6/6.12/6.18) still have CPSW built-in (=y). Signed-off-by: Moteen Shah <m-shah@ti.com> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
# Configure network via DHCP before NFS root mount. Polls for an Ethernet
|
||||
# interface with sleep 1 per iteration to allow the Ethernet driver deferred
|
||||
# probe chain to settle after udev loads the modules.
|
||||
|
||||
netsetup_enabled() {
|
||||
[ "${bootparam_root}" = "/dev/nfs" ] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
netsetup_run() {
|
||||
local iface timeout devtype
|
||||
|
||||
# Extract interface from ip= kernel param (format: client:server:gw:mask:host:device:autoconf)
|
||||
iface=""
|
||||
case "${bootparam_ip}" in
|
||||
dhcp|on|any|"")
|
||||
;;
|
||||
*)
|
||||
iface=$(echo "${bootparam_ip}" | cut -d: -f6)
|
||||
;;
|
||||
esac
|
||||
|
||||
udevadm trigger --action=add --subsystem-match=net
|
||||
udevadm settle --timeout=10
|
||||
|
||||
# Poll up to 60 seconds for an Ethernet interface (ARPHRD_ETHER = type 1).
|
||||
msg "netsetup: waiting for ethernet interface..."
|
||||
timeout=60
|
||||
while [ "${timeout}" -gt 0 ]; do
|
||||
if [ -n "${iface}" ] && [ -d "/sys/class/net/${iface}" ]; then
|
||||
break
|
||||
fi
|
||||
for dev in /sys/class/net/*; do
|
||||
[ -f "${dev}/type" ] || continue
|
||||
devtype=$(cat "${dev}/type")
|
||||
[ "${devtype}" = "1" ] || continue
|
||||
iface=$(basename "${dev}")
|
||||
break
|
||||
done
|
||||
[ -n "${iface}" ] && [ -d "/sys/class/net/${iface}" ] && break
|
||||
sleep 1
|
||||
timeout=$((timeout - 1))
|
||||
done
|
||||
|
||||
if [ -z "${iface}" ] || [ ! -d "/sys/class/net/${iface}" ]; then
|
||||
msg "netsetup: no ethernet interface found after 60s, skipping DHCP"
|
||||
return
|
||||
fi
|
||||
|
||||
msg "netsetup: configuring ${iface} via DHCP"
|
||||
|
||||
udhcpc -q -i "${iface}"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
SUMMARY = "initramfs support for DHCP network configuration before NFS root mount"
|
||||
|
||||
LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
|
||||
|
||||
SRC_URI = "file://83-netsetup"
|
||||
|
||||
S = "${UNPACKDIR}"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}/init.d
|
||||
install -m 0755 ${UNPACKDIR}/83-netsetup ${D}/init.d/83-netsetup
|
||||
}
|
||||
|
||||
FILES:${PN} = "/init.d/83-netsetup"
|
||||
|
||||
RDEPENDS:${PN} = "\
|
||||
initramfs-framework-base \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN}:append:bsp-next = " \
|
||||
kernel-module-ti-am65-cpsw-nuss \
|
||||
kernel-module-k3-cppi-desc-pool \
|
||||
kernel-module-davinci-mdio \
|
||||
kernel-module-ti-cpsw-ale \
|
||||
kernel-module-ti-cpsw-sl \
|
||||
kernel-module-phylink \
|
||||
kernel-module-mdio-bitbang \
|
||||
kernel-module-phy-gmii-sel \
|
||||
"
|
||||
@@ -23,3 +23,5 @@ RDEPENDS:${PN} += "\
|
||||
initramfs-module-nfsrootfs \
|
||||
nfs-utils-mount \
|
||||
"
|
||||
|
||||
RDEPENDS:${PN}:append:bsp-next = " initramfs-module-netsetup"
|
||||
|
||||
Reference in New Issue
Block a user