production-deb/shared/grub-overlay.cfg.tpl

83 lines
3 KiB
Smarty
Raw Permalink Normal View History

# grub-overlay.cfg.tpl — replaces /EFI/debian/grub.cfg in the built ISO.
# Self-contained, single-icon Apple boot, kernel cmdline baked in.
# @GRUB_PARAMS@ replaced at build time. @VARIANT@ for menu label.
set timeout=8
set default=0
# Find the iso9660 partition. Apple firmware enumerates the USB at an
# unpredictable hd number (USB might be hd0, hd1, or hd2 depending on
# whether internal SSD was detected). Try in order:
# 1. ${cmdpath} = where GRUB was loaded from, e.g. (hd1,msdos2)/efi/debian.
# Extract the hdN, set root=(hdN,msdos1) — same disk, partition 1.
# 2. search --label (works if iso9660 module + partition not type 0x00)
# 3. Probe (hd0,msdos1) ... (hd3,msdos1)
# 4. Drop to GRUB shell so operator can debug with `ls`
insmod part_msdos
insmod part_gpt
insmod iso9660
insmod fat
insmod regexp
echo "GRUB loaded. cmdpath=${cmdpath}"
# Method 1: derive hd from cmdpath
regexp -s 1:disk '\((hd[0-9]+)' "$cmdpath"
if [ -n "$disk" ]; then
set root="($disk,msdos1)"
echo "trying root=$root (from cmdpath)"
fi
if [ -e /install.amd/vmlinuz ]; then echo "found kernel at $root"; else
# Method 2: filesystem label search
search --label --no-floppy --set=root @VOLID@
if [ -e /install.amd/vmlinuz ]; then echo "found kernel via label"; else
# Method 3: brute-force hd0..hd3
for d in 0 1 2 3 ; do
set root="(hd${d},msdos1)"
if [ -e /install.amd/vmlinuz ]; then echo "found kernel at hd${d}"; break; fi
done
if ! [ -e /install.amd/vmlinuz ]; then
echo "ERROR: cannot find /install.amd/vmlinuz on any disk."
echo "Drop to GRUB shell with 'c'. Run 'ls' to see devices, then"
echo "set root=(hdX,msdosY) where X,Y point at the iso9660 partition."
sleep 30
fi
fi
fi
if loadfont unicode ; then
insmod efi_gop
insmod efi_uga
insmod gfxterm
set gfxmode=auto
set gfxpayload=keep
terminal_output gfxterm
fi
set BAKED="@GRUB_PARAMS@"
menuentry --hotkey=i 'Auto-install [@VARIANT@] (preseed)' {
set background_color=black
linux /install.amd/vmlinuz auto=true priority=@PRIORITY@ file=/cdrom/preseed.cfg $BAKED vga=788 --- quiet
initrd /install.amd/initrd.gz
}
menuentry --hotkey=g 'Auto-install [@VARIANT@] (graphical)' {
set background_color=black
linux /install.amd/vmlinuz auto=true priority=@PRIORITY@ file=/cdrom/preseed.cfg $BAKED vga=788 --- quiet
initrd /install.amd/gtk/initrd.gz
}
menuentry --hotkey=m 'Manual install (no preseed) [@VARIANT@ kernel params]' {
set background_color=black
linux /install.amd/vmlinuz $BAKED vga=788 --- quiet
initrd /install.amd/initrd.gz
}
menuentry --hotkey=r 'Rescue mode [@VARIANT@ kernel params]' {
set background_color=black
linux /install.amd/vmlinuz $BAKED vga=788 rescue/enable=true --- quiet
initrd /install.amd/initrd.gz
}
menuentry --hotkey=s 'Drop to installer shell' {
set background_color=black
linux /install.amd/vmlinuz $BAKED vga=788 rescue/enable=true --- quiet
initrd /install.amd/initrd.gz
}