Fix GRUB boot configuration to resolve flashing cursor issue

- Add terminal and video output configuration in embedded GRUB config
- Load essential GRUB modules (part_gpt, fat, ext2, linux, video drivers)
- Enhance main GRUB config with proper terminal setup and multiple boot options
- Add verbose and recovery mode boot menu entries
- Remove 'quiet' parameter to show boot messages for debugging
- Add console output to both tty0 and serial console
- Include modules in grub-mkstandalone for better hardware compatibility

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-31 21:40:23 +00:00
parent 53bd5d46f2
commit bc27b4a094
2 changed files with 72 additions and 8 deletions

View File

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