initramfs+modules: robust copy aliasing, curated stage1 + PHYs, firmware policy via firmware.conf, runtime readiness, build ID; docs sync

Summary of changes (with references):\n\nModules + PHY coverage\n- Curated and normalized stage1 list in [config.modules.conf](config/modules.conf:1):\n  - Boot-critical storage, core virtio, common NICs (Intel/Realtek/Broadcom), overlay/fuse, USB HCD/HID.\n  - Added PHY drivers required by NIC MACs:\n    * realtek (for r8169, etc.)\n    * broadcom families: broadcom, bcm7xxx, bcm87xx, bcm_phy_lib, bcm_phy_ptp\n- Robust underscore↔hyphen aliasing during copy so e.g. xhci_pci → xhci-pci.ko, hid_generic → hid-generic.ko:\n  - [bash.initramfs_copy_resolved_modules()](scripts/lib/initramfs.sh:990)\n\nFirmware policy and coverage\n- Firmware selection now authoritative via [config/firmware.conf](config/firmware.conf:1); ignore modules.conf firmware hints:\n  - [bash.initramfs_setup_modules()](scripts/lib/initramfs.sh:229)\n  - Count from firmware.conf for reporting; remove stale required-firmware.list.\n- Expanded NIC firmware set (bnx2, bnx2x, tigon, intel, realtek, rtl_nic, qlogic, e100) in [config.firmware.conf](config/firmware.conf:1).\n- Installer enforces firmware.conf source-of-truth in [bash.alpine_install_firmware()](scripts/lib/alpine.sh:392).\n\nEarly input & build freshness\n- Write a runtime build stamp to /etc/zero-os-build-id for embedded initramfs verification:\n  - [bash.initramfs_finalize_customization()](scripts/lib/initramfs.sh:568)\n- Minor init refinements in [config.init](config/init:1) (ensures /home, consistent depmod path).\n\nRebuild helper improvements\n- [scripts/rebuild-after-zinit.sh](scripts/rebuild-after-zinit.sh:1):\n  - Added --verify-only; container-aware execution; selective marker clears only.\n  - Prints stage status before/after; avoids --rebuild-from; resolves full kernel version for diagnostics.\n\nRemote flist readiness + zinit\n- Init scripts now probe BASE_URL readiness and accept FLISTS_BASE_URL/FLIST_BASE_URL; firmware target is /lib/firmware:\n  - [sh.firmware.sh](config/zinit/init/firmware.sh:1)\n  - [sh.modules.sh](config/zinit/init/modules.sh:1)\n\nContainer, docs, and utilities\n- Stream container build logs by calling runtime build directly in [bash.docker_build_container()](scripts/lib/docker.sh:56).\n- Docs updated to reflect firmware policy, runtime readiness, rebuild helper, early input, and GRUB USB:\n  - [docs.NOTES.md](docs/NOTES.md)\n  - [docs.PROMPT.md](docs/PROMPT.md)\n  - [docs.review-rfs-integration.md](docs/review-rfs-integration.md)\n- Added GRUB USB creator (referenced in docs): [scripts/make-grub-usb.sh](scripts/make-grub-usb.sh)\n\nCleanup\n- Removed legacy/duplicated config trees under configs/ and config/zinit.old/.\n- Minor newline and ignore fixes: [.gitignore](.gitignore:1)\n\nNet effect\n- Runtime now has correct USB HCDs/HID-generic and NIC+PHY coverage (Realtek/Broadcom), with matching firmware installed in initramfs.\n- Rebuild workflow is minimal and host/container-aware; docs are aligned with implemented behavior.\n
This commit is contained in:
2025-09-23 14:03:01 +02:00
parent 2fba2bd4cd
commit ad0a06e267
87 changed files with 833 additions and 17307 deletions

View File

@@ -8,7 +8,38 @@ log() { echo "[rfs-firmware] $*"; }
RFS_BIN="${RFS_BIN:-rfs}"
TARGET="/lib/firmware"
BASE_URL="${FLISTS_BASE_URL:-https://zos.grid.tf/store/flists}"
# Accept both FLISTS_BASE_URL and FLIST_BASE_URL (alias); prefer FLISTS_BASE_URL
if [ -n "${FLISTS_BASE_URL:-}" ]; then
BASE_URL="${FLISTS_BASE_URL}"
elif [ -n "${FLIST_BASE_URL:-}" ]; then
BASE_URL="${FLIST_BASE_URL}"
else
BASE_URL="https://zos.grid.tf/store/flists"
fi
# HTTP readiness helper: wait until BASE_URL responds to HTTP(S)
wait_for_http() {
url="$1"
tries="${2:-60}"
delay="${3:-2}"
i=0
while [ "$i" -lt "$tries" ]; do
if command -v wget >/dev/null 2>&1; then
if wget -q --spider "$url"; then
return 0
fi
elif command -v busybox >/dev/null 2>&1; then
if busybox wget -q --spider "$url"; then
return 0
fi
fi
i=$((i+1))
log "waiting for $url (attempt $i/$tries)"
sleep "$delay"
done
return 1
}
# Allow override via env
if [ -n "${FIRMWARE_FLIST:-}" ] && [ -f "${FIRMWARE_FLIST}" ]; then
@@ -29,11 +60,18 @@ else
fi
if [ -z "${FL:-}" ]; then
# Try remote fetch as a fallback
# Try remote fetch as a fallback (but first ensure BASE_URL is reachable)
mkdir -p /etc/rfs
FL="/etc/rfs/firmware-latest.fl"
URL="${BASE_URL}/firmware-latest.fl"
log "firmware-latest.fl not found locally; fetching ${URL}"
URL="${BASE_URL%/}/firmware-latest.fl"
log "firmware-latest.fl not found locally; will fetch ${URL}"
# Probe BASE_URL root so DNS/HTTP are ready before fetch
ROOT_URL="${BASE_URL%/}/"
if ! wait_for_http "$ROOT_URL" 60 2; then
log "BASE_URL not reachable yet: ${ROOT_URL}; continuing to attempt fetch anyway"
fi
log "fetching ${URL}"
if command -v wget >/dev/null 2>&1; then
wget -q -O "${FL}" "${URL}" || true