Fix GRUB boot issue by embedding bootstrap configuration

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-30 18:30:55 +00:00
parent e87d10dd82
commit 24626b541a

View File

@@ -13,13 +13,28 @@ echo "Preparing ESP contents..."
mkdir -p /staging/esp/EFI/BOOT mkdir -p /staging/esp/EFI/BOOT
mkdir -p /staging/esp/boot/grub mkdir -p /staging/esp/boot/grub
# Create GRUB EFI binary using grub-mkstandalone # Create minimal embedded GRUB configuration that searches for external config
cat > /tmp/embedded_grub.cfg << 'EOF'
# Embedded bootstrap configuration for GRUB
# This config tells GRUB where to find the real configuration file
search --no-floppy --set=root --label SPARKOSEFI
if [ -e /boot/grub/grub.cfg ]; then
configfile /boot/grub/grub.cfg
else
echo "Error: Could not find /boot/grub/grub.cfg"
echo "Press any key to enter GRUB command line..."
read
fi
EOF
# Create GRUB EFI binary using grub-mkstandalone with embedded bootstrap config
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="" \
"boot/grub/grub.cfg=/dev/null" "boot/grub/grub.cfg=/tmp/embedded_grub.cfg"
# Find the kernel # Find the kernel
KERNEL_PATH=$(find /kernel/boot -name "vmlinuz-*" | head -1) KERNEL_PATH=$(find /kernel/boot -name "vmlinuz-*" | head -1)