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:
80
config/init
80
config/init
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
#!/bin/sh
|
||||
# Alpine-based Zero-OS Init Script
|
||||
# Maintains identical flow to original busybox version
|
||||
|
||||
@@ -24,11 +24,8 @@ mount -t devtmpfs devtmpfs /dev
|
||||
mkdir -p /dev/pts
|
||||
mount -t devpts devpts /dev/pts
|
||||
|
||||
# Early debug shell if kernel parameter initdebug=true is present
|
||||
if grep -qw "initdebug=true" /proc/cmdline; then
|
||||
echo "[+] initdebug=true detected; starting emergency shell. Type 'exit' to continue boot."
|
||||
/bin/sh -l
|
||||
fi
|
||||
# Re-initialize modules dependencies for basic init
|
||||
depmod -a
|
||||
|
||||
echo "[+] building ram filesystem"
|
||||
|
||||
@@ -52,6 +49,8 @@ echo " copying /var..."
|
||||
cp -ar /var $target
|
||||
echo " copying /run..."
|
||||
cp -ar /run $target
|
||||
echo " creating /home"
|
||||
mkdir $target/home
|
||||
|
||||
# Create essential directories
|
||||
mkdir -p $target/dev
|
||||
@@ -77,45 +76,41 @@ if [ -x /sbin/udevd ]; then
|
||||
echo " starting udevd..."
|
||||
udevd --daemon
|
||||
|
||||
# Preload keyboard input modules early so console works before zinit and rfs mounts
|
||||
echo "[+] preloading keyboard input modules"
|
||||
for m in i8042 atkbd usbhid hid hid_generic evdev xhci_pci xhci_hcd ehci_pci ehci_hcd ohci_pci ohci_hcd uhci_hcd; do
|
||||
modprobe "$m"
|
||||
done
|
||||
echo "[+] loading essential drivers"
|
||||
# Load core drivers for storage and network
|
||||
/bin/busybox sh -l
|
||||
modprobe btrfs 2>/dev/null || true
|
||||
modprobe fuse 2>/dev/null || true
|
||||
modprobe overlay 2>/dev/null || true
|
||||
|
||||
# Load storage drivers
|
||||
modprobe ahci 2>/dev/null || true
|
||||
modprobe nvme 2>/dev/null || true
|
||||
modprobe virtio_blk 2>/dev/null || true
|
||||
modprobe virtio_scsi 2>/dev/null || true
|
||||
modprobe virtio_pci 2>/dev/null || true
|
||||
|
||||
# Load network drivers
|
||||
modprobe virtio_net 2>/dev/null || true
|
||||
|
||||
echo " triggering device discovery..."
|
||||
udevadm trigger --action=add --type=subsystems
|
||||
udevadm trigger --action=add --type=devices
|
||||
udevadm trigger --action=add
|
||||
udevadm settle
|
||||
|
||||
echo " stopping udevd..."
|
||||
|
||||
kill $(pidof udevd) || true
|
||||
else
|
||||
echo " warning: udevd not found, skipping hardware detection"
|
||||
fi
|
||||
|
||||
echo "[+] loading essential drivers"
|
||||
# Load core drivers for storage and network
|
||||
modprobe btrfs 2>/dev/null || true
|
||||
modprobe fuse 2>/dev/null || true
|
||||
modprobe overlay 2>/dev/null || true
|
||||
|
||||
# Load storage drivers
|
||||
modprobe ahci 2>/dev/null || true
|
||||
modprobe nvme 2>/dev/null || true
|
||||
modprobe virtio_blk 2>/dev/null || true
|
||||
modprobe virtio_scsi 2>/dev/null || true
|
||||
modprobe virtio_pci 2>/dev/null || true
|
||||
|
||||
# Load network drivers
|
||||
modprobe virtio_net 2>/dev/null || true
|
||||
modprobe e1000 2>/dev/null || true
|
||||
modprobe e1000e 2>/dev/null || true
|
||||
|
||||
echo "[+] loading USB keyboard support"
|
||||
modprobe usbcore
|
||||
modprobe ehci-hcd
|
||||
modprobe xhci-hcd
|
||||
modprobe usbhid
|
||||
modprobe evdev
|
||||
|
||||
# Unmount init filesystems
|
||||
umount /proc 2>/dev/null || true
|
||||
umount /sys 2>/dev/null || true
|
||||
|
||||
echo "[+] debug hook: initdebug=true or /init-debug"
|
||||
if grep -qw "initdebug=true" /proc/cmdline; then
|
||||
@@ -124,16 +119,23 @@ if grep -qw "initdebug=true" /proc/cmdline; then
|
||||
sh /init-debug
|
||||
else
|
||||
echo " initdebug=true: starting interactive shell (no /init-debug). Type 'exit' to continue."
|
||||
/bin/sh -l
|
||||
debug="-d"
|
||||
/bin/busybox sh
|
||||
fi
|
||||
elif [ -x /init-debug ]; then
|
||||
echo " executing /init-debug ..."
|
||||
sh /init-debug
|
||||
fi
|
||||
|
||||
echo "[+] switching root"
|
||||
mkdir /root/home
|
||||
echo " exec switch_root /mnt/root /sbin/zinit init"
|
||||
exec switch_root /mnt/root /sbin/zinit -d init
|
||||
# Unmount init filesystems
|
||||
umount /proc 2>/dev/null || true
|
||||
umount /sys 2>/dev/null || true
|
||||
|
||||
|
||||
echo "[+] switching root"
|
||||
echo " exec switch_root /mnt/root /sbin/zinit init"
|
||||
exec switch_root /mnt/root /sbin/zinit ${debug} init
|
||||
|
||||
# switch_root failed, drop into shell
|
||||
/bin/busybox sh
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user