From 372c3802e5f1d67813e651522a785a6b6a04f6d6 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 5 Oct 2026 11:56:16 -0400 Subject: [PATCH] pxe: Blancco initrd pulls in module deps and NIC firmware The kexec-initrd build copied a fixed set of module directories plus drivers/net/mii.ko. Ubuntu ships that as mii.ko.zst, so the -e test skipped it, and usbnet, r8152 and cdc_ether then failed to load with "Unknown symbol mii_*": USB-C to RJ45 adapters never appeared (seen 2026-10-05, Dell USB-C adapter). igb lacked dca and i2c-algo-bit the same way. Walk the host modules.dep from the copied modules and copy every dependency (73 on 6.8.0-71). Also copy rtl_nic, tigon, bnx2, bnx2x and e100 firmware, which those drivers request at probe. --- playbook/pxe_server_setup.yml | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/playbook/pxe_server_setup.yml b/playbook/pxe_server_setup.yml index 61936e2..3447c05 100644 --- a/playbook/pxe_server_setup.yml +++ b/playbook/pxe_server_setup.yml @@ -862,13 +862,47 @@ cp -r "$NETDIR/$sub/"* "$WORK/lib/modules/$KVER/kernel/drivers/net/$sub/" 2>/dev/null || true fi done - # Overlay + squashfs + loop + usb + hid + ptp + mii + net/core deps - for modpath in fs/overlayfs fs/squashfs drivers/block drivers/usb/core drivers/usb/host drivers/hid drivers/ptp drivers/net/mii.ko net/core; do + # Overlay + squashfs + loop + usb + hid + ptp + net/core + for modpath in fs/overlayfs fs/squashfs drivers/block drivers/usb/core drivers/usb/host drivers/hid drivers/ptp net/core; do if [ -e "/lib/modules/$KVER/kernel/$modpath" ]; then mkdir -p "$WORK/lib/modules/$KVER/kernel/$(dirname $modpath)" cp -r "/lib/modules/$KVER/kernel/$modpath" "$WORK/lib/modules/$KVER/kernel/$modpath" 2>/dev/null || true fi done + # Pull in every module the copied ones depend on, from the host's + # modules.dep. A fixed list misses them: drivers/net/mii.ko was named + # here but ships as mii.ko.zst, so the test skipped it and usbnet, + # r8152 (USB-C to RJ45 adapters) and cdc_ether failed with "Unknown + # symbol mii_*"; igb likewise lacked dca and i2c-algo-bit. + python3 - "$KVER" "$WORK" <<'PYDEP' + import os, shutil, sys + kver, work = sys.argv[1], sys.argv[2] + src = f"/lib/modules/{kver}" + dst = f"{work}/lib/modules/{kver}" + dep = {} + for line in open(f"{src}/modules.dep"): + k, v = line.split(":", 1) + dep[k] = v.split() + have = {os.path.relpath(os.path.join(r, f), dst) + for r, _, fs in os.walk(dst) for f in fs if ".ko" in f} + todo, added = list(have), 0 + while todo: + for d in dep.get(todo.pop(), []): + if d not in have: + have.add(d); todo.append(d); added += 1 + os.makedirs(os.path.dirname(f"{dst}/{d}"), exist_ok=True) + shutil.copy2(f"{src}/{d}", f"{dst}/{d}") + print(f"added {added} dependency modules") + PYDEP + + # NIC firmware the drivers request at probe (r8152/r8169 rtl_nic + # patches, tg3, bnx2/bnx2x, e100). The kernel loads .zst firmware. + for fw in rtl_nic tigon bnx2 bnx2x e100; do + if [ -d "/lib/firmware/$fw" ]; then + mkdir -p "$WORK/lib/firmware" + cp -r "/lib/firmware/$fw" "$WORK/lib/firmware/" + fi + done # Decompress zstd modules in-place (busybox insmod can't handle .zst) find "$WORK/lib/modules" -name '*.ko.zst' -print0 | \