initramfs+kernel: path anchors, helper, and init debug hook
Some checks failed
Build Zero OS Initramfs / build (push) Has been cancelled
Build Zero OS Initramfs / test-matrix (qemu, basic) (push) Has been cancelled
Build Zero OS Initramfs / test-matrix (qemu, serial) (push) Has been cancelled

initramfs: anchor relative paths to PROJECT_ROOT in [bash.initramfs_validate()](scripts/lib/initramfs.sh:799) and [bash.initramfs_create_cpio()](scripts/lib/initramfs.sh:688) to avoid CWD drift. Add diagnostics logs.

kernel: anchor kernel output path to PROJECT_ROOT in [bash.kernel_build_with_initramfs()](scripts/lib/kernel.sh:174) to ensure dist/vmlinuz.efi is under PROJECT_ROOT/dist.

helper: add [scripts/rebuild-after-zinit.sh](scripts/rebuild-after-zinit.sh) to incrementally rebuild after zinit/modules.conf/init changes. Default: initramfs-only (recreates cpio). Flags: --with-kernel, --refresh-container-mods, --run-tests. Uses --rebuild-from=initramfs_create when rebuilding kernel.

init: add early debug shell on kernel param initdebug=true; prefer /init-debug when present else spawn /bin/sh -l. See [config/init](config/init:1).

modules(stage1): add USB keyboard support (HID + host controllers) in [config/modules.conf](config/modules.conf:1): usbhid, hid_generic, hid, xhci/ehci/ohci/uhci.
This commit is contained in:
2025-09-20 16:11:44 +02:00
parent 310e11d2bf
commit 2fba2bd4cd
5 changed files with 194 additions and 8 deletions

View File

@@ -24,6 +24,12 @@ 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
echo "[+] building ram filesystem"
@@ -100,19 +106,34 @@ 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 "[+] checking for debug files"
if [ -e /init-debug ]; then
echo " executing debug script..."
echo "[+] debug hook: initdebug=true or /init-debug"
if grep -qw "initdebug=true" /proc/cmdline; then
if [ -x /init-debug ]; then
echo " initdebug=true: executing /init-debug ..."
sh /init-debug
else
echo " initdebug=true: starting interactive shell (no /init-debug). Type 'exit' to continue."
/bin/sh -l
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 init
exec switch_root /mnt/root /sbin/zinit -d init
##

View File

@@ -38,3 +38,20 @@ stage1:tun:none # TUN/TAP for networking
stage1:overlay:none # OverlayFS for containers
stage1:fuse:none # OverlayFS for containers
# Stage 1: USB keyboard support (host controllers + HID)
stage1:xhci_pci:none
stage1:xhci_hcd:none
stage1:ehci_pci:none
stage1:ehci_hcd:none
stage1:ohci_pci:none
stage1:ohci_hcd:none
stage1:uhci_hcd:none
stage1:usbhid:none
stage1:hid_generic:none
stage1:hid:none
stage1:atkbd:none
stage1:libps2:none
stage1:i2c_smbus:none
stage1:serio:none
stage1:i8042i:none