Skip to content

Commit

Permalink
new code booting from local disk
Browse files Browse the repository at this point in the history
before this fix, the FAI ISO could only boot from the first or second disk
  • Loading branch information
Mrfai committed Nov 12, 2022
1 parent 8abd9b4 commit a45ebd1
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions conf/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ insmod part_msdos
insmod part_gpt
insmod all_video
insmod gfxterm
insmod regexp

set gfxmode=auto
set color_normal=white/black
Expand Down Expand Up @@ -44,27 +45,44 @@ menuentry "Client standalone installation - select installation type from menu "
}

menuentry "Boot OS from first partition on first disk" {
if [ "$grub_platform" = "efi" ]; then
if [ -f (hd0,gpt1)/efi/debian/grub.cfg ]; then
configfile (hd0,gpt1)/efi/debian/grub.cfg
elif [ -f (hd1,gpt1)/efi/debian/grub.cfg ]; then
configfile (hd1,gpt1)/efi/debian/grub.cfg
elif [ -f (hd0,gpt2)/boot/grub/grub.cfg ]; then
configfile (hd0,gpt2)/boot/grub/grub.cfg
elif [ -f (hd1,gpt2)/boot/grub/grub.cfg ]; then
configfile (hd1,gpt2)/boot/grub/grub.cfg
else
echo "cannot find grub.cfg"
sleep 7

if [ "$grub_platform" = "efi" ]; then

for d in (hd*); do
for cfg in efi/debian/grub.cfg boot/grub/grub.cfg ; do
if [ -e "$d/$cfg" ]; then
found=true
echo "FOUND $d/$cfg"
sleep 1
configfile "$d/$cfg"
fi
# legacy BIOS booting
elif [ -d (cd) ]; then
set root=(hd0)
chainloader +1
else
set root=(hd1)
chainloader +1
fi
done
done

if [ "$found" != true ]; then
echo "Cannot find grub.cfg"
sleep 7
fi

else

# legacy BIOS booting
# detect which disk has a DOS partitions, and boot the MBR via chainloader
found=false
for d in (hd*,msdos*); do
if [ "$found" = "false" ]; then
regexp -s device '^\((.+),' $d
if [ "$device" != "" ]; then
found=true
set root=($device)
chainloader +1
fi
fi
done
echo "Booting from $device"
sleep 1

fi
}

menuentry "Rescue system, no installation" {
Expand Down

0 comments on commit a45ebd1

Please sign in to comment.