mirror of
https://github.com/johndoe6345789/SparkOS.git
synced 2026-04-24 13:34:56 +00:00
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:
@@ -1,11 +1,34 @@
|
|||||||
# Embedded bootstrap configuration for GRUB
|
# Embedded bootstrap configuration for GRUB
|
||||||
# This config tells GRUB where to find the real configuration file
|
# 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@
|
search --no-floppy --set=root --label @ESP_LABEL@
|
||||||
|
|
||||||
|
# Try to load the main config file
|
||||||
if [ -e /boot/grub/grub.cfg ]; then
|
if [ -e /boot/grub/grub.cfg ]; then
|
||||||
configfile /boot/grub/grub.cfg
|
configfile /boot/grub/grub.cfg
|
||||||
else
|
else
|
||||||
echo "Error: Could not find /boot/grub/grub.cfg"
|
echo "Error: Could not find /boot/grub/grub.cfg"
|
||||||
|
echo "Root device: $root"
|
||||||
echo "Press any key to enter GRUB command line..."
|
echo "Press any key to enter GRUB command line..."
|
||||||
# Sleep for a very long time (interruptible by any key press)
|
# Sleep for a very long time (interruptible by any key press)
|
||||||
# This provides an effective "wait for keypress" in GRUB
|
# This provides an effective "wait for keypress" in GRUB
|
||||||
|
|||||||
@@ -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
|
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
|
# Create GRUB EFI binary using grub-mkstandalone with embedded bootstrap config
|
||||||
|
# Include essential modules for better hardware compatibility
|
||||||
grub-mkstandalone \
|
grub-mkstandalone \
|
||||||
--format=x86_64-efi \
|
--format=x86_64-efi \
|
||||||
--output=/staging/esp/EFI/BOOT/BOOTX64.EFI \
|
--output=/staging/esp/EFI/BOOT/BOOTX64.EFI \
|
||||||
--locales="" \
|
--locales="" \
|
||||||
--fonts="" \
|
--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"
|
"boot/grub/grub.cfg=/tmp/embedded_grub.cfg"
|
||||||
|
|
||||||
# Find the kernel
|
# 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
|
if [ -f "$INITRD_PATH" ]; then cp $INITRD_PATH /staging/esp/boot/initrd.img; fi
|
||||||
|
|
||||||
# Create GRUB configuration for immutable root with overlay
|
# Create GRUB configuration for immutable root with overlay
|
||||||
printf '%s\n' \
|
cat > /staging/esp/boot/grub/grub.cfg << EOF
|
||||||
'set timeout=3' \
|
# GRUB Configuration for SparkOS
|
||||||
'set default=0' \
|
|
||||||
'' \
|
# Load essential modules
|
||||||
"menuentry \"SparkOS (Immutable Base + Overlay)\" {" \
|
insmod part_gpt
|
||||||
" linux /boot/vmlinuz root=LABEL=$ROOT_LABEL ro init=/sbin/init console=tty1 quiet" \
|
insmod fat
|
||||||
'}' \
|
insmod ext2
|
||||||
> /staging/esp/boot/grub/grub.cfg
|
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
|
# Prepare root filesystem contents
|
||||||
echo "Preparing root filesystem..."
|
echo "Preparing root filesystem..."
|
||||||
|
|||||||
Reference in New Issue
Block a user