grub.cfg: skip ata/ahci according to grub_scan_disk
logic for setting it in grub.cfg will be done in the next commitfsdg20230625
parent
9b1499fd1e
commit
835ff5ec83
|
@ -28,6 +28,7 @@ fi
|
||||||
set default="0"
|
set default="0"
|
||||||
set timeout=10
|
set timeout=10
|
||||||
set pager=1
|
set pager=1
|
||||||
|
set grub_scan_disk="both"
|
||||||
|
|
||||||
keymap usqwerty
|
keymap usqwerty
|
||||||
function try_user_config {
|
function try_user_config {
|
||||||
|
@ -75,8 +76,13 @@ function search_isolinux {
|
||||||
echo # Insert newline
|
echo # Insert newline
|
||||||
}
|
}
|
||||||
menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o' {
|
menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o' {
|
||||||
search_grub ahci
|
|
||||||
search_grub ata
|
if [ "${grub_scan_disk}" != "ata" ]; then
|
||||||
|
search_grub ahci
|
||||||
|
fi
|
||||||
|
if [ "${grub_scan_disk}" != "ahci" ]; then
|
||||||
|
search_grub ata
|
||||||
|
fi
|
||||||
|
|
||||||
# grub device enumeration is very slow, so checks are hardcoded
|
# grub device enumeration is very slow, so checks are hardcoded
|
||||||
|
|
||||||
|
@ -97,8 +103,12 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
|
||||||
unset atadev
|
unset atadev
|
||||||
for i in 11 10 9 8 7 6 5 4 3 2 1 0; do
|
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 part in 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1; do
|
||||||
ahcidev="(ahci${i},${part}) ${ahcidev}"
|
if [ "${grub_scan_disk}" != "ata" ]; then
|
||||||
atadev="(ata${i},${part}) ${atadev}"
|
ahcidev="(ahci${i},${part}) ${ahcidev}"
|
||||||
|
fi
|
||||||
|
if [ "${grub_scan_disk}" != "ahci" ]; then
|
||||||
|
atadev="(ata${i},${part}) ${atadev}"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -117,27 +127,31 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
|
||||||
|
|
||||||
search_grub crypto
|
search_grub crypto
|
||||||
|
|
||||||
# Last resort, if all else fails
|
if [ "${grub_scan_disk}" != "ata" ]; then
|
||||||
set root=ahci0,1
|
# Last resort, if all else fails
|
||||||
for p in / /boot/; do
|
set root=ahci0,1
|
||||||
if [ -f "${p}vmlinuz" ]; then
|
for p in / /boot/; do
|
||||||
linux ${p}vmlinuz root=/dev/sda1 rw
|
if [ -f "${p}vmlinuz" ]; then
|
||||||
if [ -f "${p}initrd.img" ]; then
|
linux ${p}vmlinuz root=/dev/sda1 rw
|
||||||
initrd ${p}initrd.img
|
if [ -f "${p}initrd.img" ]; then
|
||||||
|
initrd ${p}initrd.img
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
done
|
fi
|
||||||
|
|
||||||
# Last resort (for setups that use IDE instead of SATA)
|
if [ "${grub_scan_disk}" != "ahci" ]; then
|
||||||
set root=ata0,1
|
# Last resort (for setups that use IDE instead of SATA)
|
||||||
for p in / /boot/; do
|
set root=ata0,1
|
||||||
if [ -f "${p}vmlinuz" ]; then
|
for p in / /boot/; do
|
||||||
linux ${p}vmlinuz root=/dev/sda1 rw
|
if [ -f "${p}vmlinuz" ]; then
|
||||||
if [ -f "${p}initrd.img" ]; then
|
linux ${p}vmlinuz root=/dev/sda1 rw
|
||||||
initrd ${p}initrd.img
|
if [ -f "${p}initrd.img" ]; then
|
||||||
|
initrd ${p}initrd.img
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
done
|
fi
|
||||||
|
|
||||||
true # Prevent pager requiring to accept each line instead of whole screen
|
true # Prevent pager requiring to accept each line instead of whole screen
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue