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 | \