grub.cfg: actually support setting boot order

replace variables ahcidev/atadev/nvmedev with a single
one named bootdev

the for loop goes through grub_scan_disk, so now it is
effectively a bootorder configuration

Signed-off-by: Leah Rowe <leah@libreboot.org>
20240612_branch
Leah Rowe 2024-05-28 23:08:20 +01:00
parent 4488745cb6
commit b00800a7cc
1 changed files with 8 additions and 10 deletions

View File

@ -160,19 +160,17 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
try_bootcfg "${vol}" try_bootcfg "${vol}"
done done
unset ahcidev unset bootdev
unset atadev for grub_disk in ${grub_scan_disk}; do
unset nvmedev for i in 0 1 2 3 4 5 6 7 8 9 10 11; do
for i in 11 10 9 8 7 6 5 4 3 2 1 0; do for part in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
for part in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do
for grub_disk in ${grub_scan_disk}; do
if [ "${grub_disk}" = "ahci" ]; then if [ "${grub_disk}" = "ahci" ]; then
ahcidev="(ahci${i},${part}) ${ahcidev}" bootdev="${bootdev} (ahci${i},${part})"
elif [ "${grub_disk}" = "ata" ]; then elif [ "${grub_disk}" = "ata" ]; then
atadev="(ata${i},${part}) ${atadev}" bootdev="${bootdev} (ata${i},${part})"
elif [ "${grub_disk}" = "nvme" ]; then elif [ "${grub_disk}" = "nvme" ]; then
# TODO: do we care about other namesapces # TODO: do we care about other namesapces
nvmedev="(nvme${i}n1,${part}) ${nvmedev}" bootdev="${bootdev} (nvme${i}n1,${part})"
fi fi
done done
done done
@ -180,7 +178,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
set pager=0 set pager=0
echo -n "Attempting to unlock encrypted volumes" echo -n "Attempting to unlock encrypted volumes"
for dev in ${nvmedev} ${ahcidev} ${atadev} ${lvmvol} ${raidvol}; do for dev in ${bootdev} ${lvmvol} ${raidvol}; do
if cryptomount "${dev}" ; then break ; fi if cryptomount "${dev}" ; then break ; fi
done done
set pager=1 set pager=1