diff --git a/config/grub-embedded.cfg.in b/config/grub-embedded.cfg.in index 902e6d9..eae7f8d 100644 --- a/config/grub-embedded.cfg.in +++ b/config/grub-embedded.cfg.in @@ -1,11 +1,34 @@ # Embedded bootstrap configuration for GRUB # This config tells GRUB where to find the real configuration file +# Set proper terminal and video output +terminal_input console +terminal_output console + +# Load essential modules +insmod part_gpt +insmod fat +insmod ext2 +insmod normal +insmod linux +insmod all_video +insmod video_bochs +insmod video_cirrus +insmod gfxterm + +# Set graphics mode for better compatibility +set gfxmode=auto +set gfxpayload=keep + +# Search for ESP by label search --no-floppy --set=root --label @ESP_LABEL@ + +# Try to load the main config file if [ -e /boot/grub/grub.cfg ]; then configfile /boot/grub/grub.cfg else echo "Error: Could not find /boot/grub/grub.cfg" + echo "Root device: $root" echo "Press any key to enter GRUB command line..." # Sleep for a very long time (interruptible by any key press) # This provides an effective "wait for keypress" in GRUB diff --git a/scripts/docker-image-create-uefi.sh b/scripts/docker-image-create-uefi.sh index a75e0a3..3a91ca5 100755 --- a/scripts/docker-image-create-uefi.sh +++ b/scripts/docker-image-create-uefi.sh @@ -21,11 +21,13 @@ mkdir -p /staging/esp/boot/grub sed "s/@ESP_LABEL@/$ESP_LABEL/g" /build/config/grub-embedded.cfg.in > /tmp/embedded_grub.cfg # Create GRUB EFI binary using grub-mkstandalone with embedded bootstrap config +# Include essential modules for better hardware compatibility grub-mkstandalone \ --format=x86_64-efi \ --output=/staging/esp/EFI/BOOT/BOOTX64.EFI \ --locales="" \ --fonts="" \ + --modules="part_gpt part_msdos fat ext2 normal linux all_video video_bochs video_cirrus gfxterm search search_label search_fs_uuid" \ "boot/grub/grub.cfg=/tmp/embedded_grub.cfg" # Find the kernel @@ -39,14 +41,53 @@ cp $KERNEL_PATH /staging/esp/boot/vmlinuz if [ -f "$INITRD_PATH" ]; then cp $INITRD_PATH /staging/esp/boot/initrd.img; fi # Create GRUB configuration for immutable root with overlay -printf '%s\n' \ - 'set timeout=3' \ - 'set default=0' \ - '' \ - "menuentry \"SparkOS (Immutable Base + Overlay)\" {" \ - " linux /boot/vmlinuz root=LABEL=$ROOT_LABEL ro init=/sbin/init console=tty1 quiet" \ - '}' \ - > /staging/esp/boot/grub/grub.cfg +cat > /staging/esp/boot/grub/grub.cfg << EOF +# GRUB Configuration for SparkOS + +# Load essential modules +insmod part_gpt +insmod fat +insmod ext2 +insmod linux +insmod all_video +insmod video_bochs +insmod video_cirrus +insmod gfxterm + +# Set terminal and video modes +terminal_input console +terminal_output console +set gfxmode=auto +set gfxpayload=keep + +# Boot menu settings +set timeout=5 +set default=0 + +# Show countdown message +echo "SparkOS Boot Menu - Starting in \$timeout seconds..." + +menuentry "SparkOS" { + echo "Loading SparkOS kernel..." + linux /boot/vmlinuz root=LABEL=$ROOT_LABEL ro init=/sbin/init console=tty0 console=ttyS0,115200n8 + echo "Booting..." + boot +} + +menuentry "SparkOS (Verbose Mode)" { + echo "Loading SparkOS kernel in verbose mode..." + linux /boot/vmlinuz root=LABEL=$ROOT_LABEL ro init=/sbin/init console=tty0 console=ttyS0,115200n8 debug loglevel=7 + echo "Booting in verbose mode..." + boot +} + +menuentry "SparkOS (Recovery Mode)" { + echo "Loading SparkOS kernel in recovery mode..." + linux /boot/vmlinuz root=LABEL=$ROOT_LABEL rw init=/bin/sh console=tty0 console=ttyS0,115200n8 + echo "Booting into recovery shell..." + boot +} +EOF # Prepare root filesystem contents echo "Preparing root filesystem..."