summaryrefslogtreecommitdiffstats
path: root/meta-ti-bsp/recipes-ti
diff options
context:
space:
mode:
Diffstat (limited to 'meta-ti-bsp/recipes-ti')
-rw-r--r--meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup/83-netsetup54
-rw-r--r--meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup_1.0.bb30
-rw-r--r--meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb2
3 files changed, 86 insertions, 0 deletions
diff --git a/meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup/83-netsetup b/meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup/83-netsetup
new file mode 100644
index 00000000..8e76bac4
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup/83-netsetup
@@ -0,0 +1,54 @@
1#!/bin/sh
2# Configure network via DHCP before NFS root mount. Polls for an Ethernet
3# interface with sleep 1 per iteration to allow the Ethernet driver deferred
4# probe chain to settle after udev loads the modules.
5
6netsetup_enabled() {
7 [ "${bootparam_root}" = "/dev/nfs" ] || return 1
8 return 0
9}
10
11netsetup_run() {
12 local iface timeout devtype
13
14 # Extract interface from ip= kernel param (format: client:server:gw:mask:host:device:autoconf)
15 iface=""
16 case "${bootparam_ip}" in
17 dhcp|on|any|"")
18 ;;
19 *)
20 iface=$(echo "${bootparam_ip}" | cut -d: -f6)
21 ;;
22 esac
23
24 udevadm trigger --action=add --subsystem-match=net
25 udevadm settle --timeout=10
26
27 # Poll up to 60 seconds for an Ethernet interface (ARPHRD_ETHER = type 1).
28 msg "netsetup: waiting for ethernet interface..."
29 timeout=60
30 while [ "${timeout}" -gt 0 ]; do
31 if [ -n "${iface}" ] && [ -d "/sys/class/net/${iface}" ]; then
32 break
33 fi
34 for dev in /sys/class/net/*; do
35 [ -f "${dev}/type" ] || continue
36 devtype=$(cat "${dev}/type")
37 [ "${devtype}" = "1" ] || continue
38 iface=$(basename "${dev}")
39 break
40 done
41 [ -n "${iface}" ] && [ -d "/sys/class/net/${iface}" ] && break
42 sleep 1
43 timeout=$((timeout - 1))
44 done
45
46 if [ -z "${iface}" ] || [ ! -d "/sys/class/net/${iface}" ]; then
47 msg "netsetup: no ethernet interface found after 60s, skipping DHCP"
48 return
49 fi
50
51 msg "netsetup: configuring ${iface} via DHCP"
52
53 udhcpc -q -i "${iface}"
54}
diff --git a/meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup_1.0.bb b/meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup_1.0.bb
new file mode 100644
index 00000000..ec04ea9d
--- /dev/null
+++ b/meta-ti-bsp/recipes-ti/initramfs/initramfs-module-netsetup_1.0.bb
@@ -0,0 +1,30 @@
1SUMMARY = "initramfs support for DHCP network configuration before NFS root mount"
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5
6SRC_URI = "file://83-netsetup"
7
8S = "${UNPACKDIR}"
9
10do_install() {
11 install -d ${D}/init.d
12 install -m 0755 ${UNPACKDIR}/83-netsetup ${D}/init.d/83-netsetup
13}
14
15FILES:${PN} = "/init.d/83-netsetup"
16
17RDEPENDS:${PN} = "\
18 initramfs-framework-base \
19"
20
21RDEPENDS:${PN}:append:bsp-next = " \
22 kernel-module-ti-am65-cpsw-nuss \
23 kernel-module-k3-cppi-desc-pool \
24 kernel-module-davinci-mdio \
25 kernel-module-ti-cpsw-ale \
26 kernel-module-ti-cpsw-sl \
27 kernel-module-phylink \
28 kernel-module-mdio-bitbang \
29 kernel-module-phy-gmii-sel \
30"
diff --git a/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb b/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb
index a9eff847..b4e6adff 100644
--- a/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb
+++ b/meta-ti-bsp/recipes-ti/initramfs/packagegroup-ti-core-initramfs.bb
@@ -23,3 +23,5 @@ RDEPENDS:${PN} += "\
23 initramfs-module-nfsrootfs \ 23 initramfs-module-nfsrootfs \
24 nfs-utils-mount \ 24 nfs-utils-mount \
25" 25"
26
27RDEPENDS:${PN}:append:bsp-next = " initramfs-module-netsetup"