From 3db98e9a33acfd478efb9eb00fb75563cb4e19ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 00:45:35 +0000 Subject: [PATCH] Ensure initrd is required and always copied during image build Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- scripts/docker-image-create-uefi-old.sh | 11 ++++++++++- scripts/docker-image-create-uefi.sh | 14 ++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/scripts/docker-image-create-uefi-old.sh b/scripts/docker-image-create-uefi-old.sh index 0058a4b..1933550 100755 --- a/scripts/docker-image-create-uefi-old.sh +++ b/scripts/docker-image-create-uefi-old.sh @@ -57,7 +57,15 @@ INITRD_PATH=$(find /kernel/boot -name "initrd.img-*" | head -1) # Copy kernel and initrd to staging echo "Copying kernel to staging..." cp $KERNEL_PATH /staging/esp/boot/vmlinuz -if [ -f "$INITRD_PATH" ]; then cp $INITRD_PATH /staging/esp/boot/initrd.img; fi + +# Ensure initrd exists (required for booting) +if [ ! -f "$INITRD_PATH" ]; then + echo "ERROR: initrd not found. The kernel requires an initrd to boot." + echo "Expected to find: initrd.img-* in /kernel/boot/" + exit 1 +fi +echo "Copying initrd to staging..." +cp $INITRD_PATH /staging/esp/boot/initrd.img # Create GRUB configuration printf '%s\n' \ @@ -66,6 +74,7 @@ printf '%s\n' \ '' \ 'menuentry "SparkOS" {' \ ' linux /boot/vmlinuz root=LABEL=SparkOS rw init=/sbin/init console=tty1 quiet' \ + ' initrd /boot/initrd.img' \ '}' \ > /staging/esp/boot/grub/grub.cfg diff --git a/scripts/docker-image-create-uefi.sh b/scripts/docker-image-create-uefi.sh index 15dddd5..a61dd5b 100755 --- a/scripts/docker-image-create-uefi.sh +++ b/scripts/docker-image-create-uefi.sh @@ -40,7 +40,15 @@ INITRD_PATH=$(find /kernel/boot -name "initrd.img-*" | head -1) # Copy kernel and initrd to staging echo "Copying kernel to staging..." cp $KERNEL_PATH /staging/esp/boot/vmlinuz -if [ -f "$INITRD_PATH" ]; then cp $INITRD_PATH /staging/esp/boot/initrd.img; fi + +# Ensure initrd exists (required for booting) +if [ ! -f "$INITRD_PATH" ]; then + echo "ERROR: initrd not found. The kernel requires an initrd to boot." + echo "Expected to find: initrd.img-* in /kernel/boot/" + exit 1 +fi +echo "Copying initrd to staging..." +cp $INITRD_PATH /staging/esp/boot/initrd.img # Create GRUB configuration from template sed "s/@ROOT_LABEL@/$ROOT_LABEL/g" /build/config/grub.cfg.in > /staging/esp/boot/grub/grub.cfg @@ -110,9 +118,7 @@ mmd -i /tmp/esp.img ::/boot mmd -i /tmp/esp.img ::/boot/grub mcopy -i /tmp/esp.img /staging/esp/EFI/BOOT/BOOTX64.EFI ::/EFI/BOOT/ mcopy -i /tmp/esp.img /staging/esp/boot/vmlinuz ::/boot/ -if [ -f "/staging/esp/boot/initrd.img" ]; then - mcopy -i /tmp/esp.img /staging/esp/boot/initrd.img ::/boot/ -fi +mcopy -i /tmp/esp.img /staging/esp/boot/initrd.img ::/boot/ mcopy -i /tmp/esp.img /staging/esp/boot/grub/grub.cfg ::/boot/grub/ # Format root partition (ext4) with directory contents (no mount needed!)