Fix netboot: hardcode config values, simplify boot chain
- Hardcode ROOT_URL and OVERLAYROOT in netboot script - Remove cmdline parsing that was failing silently - Simplify boot.ipxe to chain to netboot.ipxe - Add rebuild-initramfs.sh helper script Resolves kernel panic caused by cmdline parsing issues.
This commit is contained in:
51
rebuild-initramfs.sh
Executable file
51
rebuild-initramfs.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
# Rebuild initramfs with updated netboot script
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BUILD_DIR="$SCRIPT_DIR/build"
|
||||
ROOTFS="$BUILD_DIR/rootfs"
|
||||
HTTP_DIR="$SCRIPT_DIR/http"
|
||||
|
||||
if [ ! -d "$ROOTFS" ]; then
|
||||
echo "ERROR: Rootfs not found at $ROOTFS"
|
||||
echo "Run build-image.sh first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== Copying updated initramfs scripts ==="
|
||||
cp "$SCRIPT_DIR/initramfs/scripts/netboot" "$ROOTFS/usr/share/initramfs-tools/scripts/netboot"
|
||||
cp "$SCRIPT_DIR/initramfs/hooks/netboot" "$ROOTFS/usr/share/initramfs-tools/hooks/netboot"
|
||||
cp "$SCRIPT_DIR/initramfs/initramfs.conf" "$ROOTFS/etc/initramfs-tools/initramfs.conf"
|
||||
cp "$SCRIPT_DIR/initramfs/modules" "$ROOTFS/etc/initramfs-tools/modules"
|
||||
|
||||
echo "=== Getting kernel version ==="
|
||||
KVER=$(ls "$ROOTFS/lib/modules/" | head -1)
|
||||
echo "Kernel version: $KVER"
|
||||
|
||||
echo "=== Mounting filesystems for chroot ==="
|
||||
mount --bind /proc "$ROOTFS/proc"
|
||||
mount --bind /sys "$ROOTFS/sys"
|
||||
mount --bind /dev "$ROOTFS/dev"
|
||||
|
||||
cleanup() {
|
||||
echo "=== Cleaning up mounts ==="
|
||||
umount "$ROOTFS/proc" 2>/dev/null || true
|
||||
umount "$ROOTFS/sys" 2>/dev/null || true
|
||||
umount "$ROOTFS/dev" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "=== Rebuilding initramfs ==="
|
||||
chroot "$ROOTFS" mkinitramfs -v -o /boot/initrd-netboot.img "$KVER"
|
||||
|
||||
echo "=== Copying to http directory ==="
|
||||
cp "$ROOTFS/boot/initrd-netboot.img" "$HTTP_DIR/"
|
||||
chmod 644 "$HTTP_DIR/initrd-netboot.img"
|
||||
|
||||
echo ""
|
||||
echo "=== Done! ==="
|
||||
echo "New initramfs: $HTTP_DIR/initrd-netboot.img"
|
||||
ls -lh "$HTTP_DIR/initrd-netboot.img"
|
||||
echo ""
|
||||
echo "Run 'make deploy' to sync to NAS"
|
||||
Reference in New Issue
Block a user