mirror of
https://github.com/johndoe6345789/SparkOS.git
synced 2026-04-24 13:34:56 +00:00
Extract GRUB embedded config to separate file and address code review feedback
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
11
config/grub-embedded.cfg.in
Normal file
11
config/grub-embedded.cfg.in
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Embedded bootstrap configuration for GRUB
|
||||||
|
# This config tells GRUB where to find the real configuration file
|
||||||
|
|
||||||
|
search --no-floppy --set=root --label @ESP_LABEL@
|
||||||
|
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..."
|
||||||
|
sleep --verbose --interruptible 99999
|
||||||
|
fi
|
||||||
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
ESP_LABEL="SPARKOSEFI"
|
||||||
|
ROOT_LABEL="SparkOS"
|
||||||
|
|
||||||
mkdir -p /output /staging/esp /staging/root
|
mkdir -p /output /staging/esp /staging/root
|
||||||
|
|
||||||
echo "=== Creating UEFI-bootable SparkOS image with GRUB ==="
|
echo "=== Creating UEFI-bootable SparkOS image with GRUB ==="
|
||||||
@@ -13,20 +17,8 @@ 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 minimal embedded GRUB configuration that searches for external config
|
# Create minimal embedded GRUB configuration from template
|
||||||
cat > /tmp/embedded_grub.cfg << 'EOF'
|
sed "s/@ESP_LABEL@/$ESP_LABEL/g" /build/config/grub-embedded.cfg.in > /tmp/embedded_grub.cfg
|
||||||
# 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
|
# Create GRUB EFI binary using grub-mkstandalone with embedded bootstrap config
|
||||||
grub-mkstandalone \
|
grub-mkstandalone \
|
||||||
@@ -110,7 +102,7 @@ dd if=/output/sparkos.img of=/tmp/root.img bs=512 skip=$ROOT_START count=$ROOT_S
|
|||||||
|
|
||||||
# Format ESP partition (FAT32)
|
# Format ESP partition (FAT32)
|
||||||
echo "Formatting EFI System Partition (FAT32)..."
|
echo "Formatting EFI System Partition (FAT32)..."
|
||||||
mkfs.vfat -F 32 -n "SPARKOSEFI" /tmp/esp.img >/dev/null
|
mkfs.vfat -F 32 -n "$ESP_LABEL" /tmp/esp.img >/dev/null
|
||||||
|
|
||||||
# Populate ESP using mtools (no mount needed!)
|
# Populate ESP using mtools (no mount needed!)
|
||||||
echo "Populating ESP with bootloader and kernel..."
|
echo "Populating ESP with bootloader and kernel..."
|
||||||
|
|||||||
Reference in New Issue
Block a user