Merge pull request #25 from johndoe6345789/copilot/fix-grub-boot-issue

Fix GRUB boot failure - add missing terminal config and modules
This commit is contained in:
2026-01-01 22:54:57 +00:00
committed by GitHub
3 changed files with 68 additions and 9 deletions

View File

@@ -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

39
config/grub.cfg.in Normal file
View File

@@ -0,0 +1,39 @@
# 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
}
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
}
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
}

View File

@@ -21,11 +21,15 @@ 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
@@ -38,15 +42,8 @@ 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
# 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
# Create GRUB configuration from template
sed "s/@ROOT_LABEL@/$ROOT_LABEL/g" /build/config/grub.cfg.in > /staging/esp/boot/grub/grub.cfg
# Prepare root filesystem contents
echo "Preparing root filesystem..."