Yocto Meta TI
 help / color / mirror / Atom feed
From: Denys Dmytriyenko <denis@denix.org>
To: Ryan Eatmon <reatmon@ti.com>
Cc: m-shah@ti.com, meta-ti@lists.yoctoproject.org, nm@ti.com,
	u-kumar1@ti.com, s-vadapalli@ti.com, a-limaye@ti.com,
	gehariprasath@ti.com, denys@konsulko.com
Subject: Re: [meta-ti][master/wrynose][PATCH 2/2] initramfs: Add netsetup module for DHCP network configuration
Date: Tue, 2 Jun 2026 13:34:14 -0400	[thread overview]
Message-ID: <20260602173414.GD23325@denix.org> (raw)
In-Reply-To: <7302e93b-5df9-4d75-8329-30b180c51804@ti.com>

On Tue, Jun 02, 2026 at 09:59:15AM -0500, Ryan Eatmon wrote:
> 
> 
> On 6/2/2026 8:47 AM, Denys Dmytriyenko wrote:
> >On Tue, Jun 02, 2026 at 04:18:10PM +0530, Moteen Shah via lists.yoctoproject.org wrote:
> >>Add 83-netsetup, an initramfs-framework module that configures the
> >>network interface via DHCP before the NFS root mount. Needed when the
> >>Ethernet driver is a loadable module and the deferred probe chain
> >>requires time to settle after udev loads the modules. Also add dhcpcd
> >>to packagegroup-ti-core-initramfs to support DHCP configuration.
> >>
> >>Signed-off-by: Moteen Shah <m-shah@ti.com>
> >>---
> >>  .../initramfs-framework/83-netsetup           | 54 +++++++++++++++++++
> >>  .../initramfs-framework_%.bbappend            | 15 ++++++
> >>  .../packagegroup-ti-core-initramfs.bb         |  2 +
> >>  3 files changed, 71 insertions(+)
> >>  create mode 100644 meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework/83-netsetup
> >>  create mode 100644 meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework_%.bbappend
> >>
> >>diff --git a/meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework/83-netsetup b/meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework/83-netsetup
> >>new file mode 100644
> >>index 00000000..b71bc3b3
> >>--- /dev/null
> >>+++ b/meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework/83-netsetup
> >>@@ -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"
> >>+
> >>+    dhcpcd --waitip "${iface}"
> >>+}
> >>diff --git a/meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework_%.bbappend b/meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework_%.bbappend
> >>new file mode 100644
> >>index 00000000..c8955689
> >>--- /dev/null
> >>+++ b/meta-ti-bsp/recipes-core/initramfs-scripts/initramfs-framework_%.bbappend
> >>@@ -0,0 +1,15 @@
> >>+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
> >>+
> >>+SUMMARY:initramfs-module-netsetup = "initramfs support for DHCP network setup before NFS root mount"
> >
> >This should probably be a standalone initramfs-module* recipe, instead of a
> >bbappend.
> 
> Agreed.  It's a little confusing to add a subpackage like that.  We
> should create a new recipe and depend on that name to pull in this
> one file.  The name you chose was fine, just move it out of the
> bbappend.

There are numerous examples of existing initramfs-module-* recipes that 
extend initramfs-framework functionality, e.g.:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-module-install-efi_1.0.bb
https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-module-install_1.0.bb
https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/initrdscripts/initramfs-module-setup-live_1.0.bb

And don't forget about our own such recipe for LUKS with fTPM:
https://git.yoctoproject.org/meta-ti/tree/meta-ti-bsp/dynamic-layers/tpm-layer/recipes-ti/initramfs/initramfs-module-luks-ftpm_1.0.bb


> >>+SRC_URI:append = " file://83-netsetup"
> >>+
> >>+PACKAGES =+ "initramfs-module-netsetup"
> >>+
> >>+RDEPENDS:initramfs-module-netsetup = "${PN}-base"
> >>+
> >>+FILES:initramfs-module-netsetup = "/init.d/83-netsetup"
> >>+
> >>+do_install:append() {
> >>+    install -m 0755 ${UNPACKDIR}/83-netsetup ${D}/init.d/83-netsetup
> >>+}
> >>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..ede0639d 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
> >>@@ -18,6 +18,8 @@ RDEPENDS:${PN} += "\
> >>      netbase \
> >>      base-files \
> >>      base-passwd \
> >>+    dhcpcd \
> >>+    initramfs-module-netsetup \
> >>      initramfs-framework-base \
> >>      initramfs-module-udev \
> >>      initramfs-module-nfsrootfs \
> >>-- 
> >>2.34.1


  reply	other threads:[~2026-06-02 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 10:48 [meta-ti][master/wrynose][PATCH 0/2] Fix NFS boot on K3 platforms with bsp-next kernel Moteen Shah
2026-06-02 10:48 ` [meta-ti][master/wrynose][PATCH 1/2] k3.inc: Add CPSW modules to initramfs for bsp-next NFS boot Moteen Shah
2026-06-02 10:48 ` [meta-ti][master/wrynose][PATCH 2/2] initramfs: Add netsetup module for DHCP network configuration Moteen Shah
2026-06-02 13:47   ` Denys Dmytriyenko
2026-06-02 14:59     ` Ryan Eatmon
2026-06-02 17:34       ` Denys Dmytriyenko [this message]
2026-06-02 10:50 ` [meta-ti][master/wrynose][PATCH 0/2] Fix NFS boot on K3 platforms with bsp-next kernel PRC Automation

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260602173414.GD23325@denix.org \
    --to=denis@denix.org \
    --cc=a-limaye@ti.com \
    --cc=denys@konsulko.com \
    --cc=gehariprasath@ti.com \
    --cc=m-shah@ti.com \
    --cc=meta-ti@lists.yoctoproject.org \
    --cc=nm@ti.com \
    --cc=reatmon@ti.com \
    --cc=s-vadapalli@ti.com \
    --cc=u-kumar1@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox