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>
audit2-merge1
Leah Rowe 2024-05-28 23:08:20 +01:00 committed by Leah Rowe
parent 2887b77ae4
commit bcb65846d3
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}"
done
unset ahcidev
unset atadev
unset nvmedev
for i in 11 10 9 8 7 6 5 4 3 2 1 0; 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
unset bootdev
for grub_disk in ${grub_scan_disk}; do
for i in 0 1 2 3 4 5 6 7 8 9 10 11; 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
if [ "${grub_disk}" = "ahci" ]; then
ahcidev="(ahci${i},${part}) ${ahcidev}"
bootdev="${bootdev} (ahci${i},${part})"
elif [ "${grub_disk}" = "ata" ]; then
atadev="(ata${i},${part}) ${atadev}"
bootdev="${bootdev} (ata${i},${part})"
elif [ "${grub_disk}" = "nvme" ]; then
# TODO: do we care about other namesapces
nvmedev="(nvme${i}n1,${part}) ${nvmedev}"
bootdev="${bootdev} (nvme${i}n1,${part})"
fi
done
done
@ -180,7 +178,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
set pager=0
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
done
set pager=1