diff options
author | Leah Rowe <leah@libreboot.org> | 2021-12-29 06:55:07 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2021-12-29 06:55:07 +0000 |
commit | 835ff5ec83ff8385d81eef285d38068636fe4ed0 (patch) | |
tree | 94dcc3497ed871c10fe6d78a34cb211a220c5389 /resources/grub/config/grub.cfg | |
parent | 9b1499fd1e289c0f655f87442d4915e212c6a152 (diff) |
grub.cfg: skip ata/ahci according to grub_scan_disk
logic for setting it in grub.cfg will be done in the next commit
Diffstat (limited to 'resources/grub/config/grub.cfg')
-rw-r--r-- | resources/grub/config/grub.cfg | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/resources/grub/config/grub.cfg b/resources/grub/config/grub.cfg index d9bf6df2..95389054 100644 --- a/resources/grub/config/grub.cfg +++ b/resources/grub/config/grub.cfg @@ -28,6 +28,7 @@ fi set default="0" set timeout=10 set pager=1 +set grub_scan_disk="both" keymap usqwerty function try_user_config { @@ -75,8 +76,13 @@ function search_isolinux { echo # Insert newline } 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 @@ -97,8 +103,12 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o unset atadev 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 - ahcidev="(ahci${i},${part}) ${ahcidev}" - atadev="(ata${i},${part}) ${atadev}" + if [ "${grub_scan_disk}" != "ata" ]; then + ahcidev="(ahci${i},${part}) ${ahcidev}" + fi + if [ "${grub_scan_disk}" != "ahci" ]; then + atadev="(ata${i},${part}) ${atadev}" + fi done done @@ -117,27 +127,31 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o search_grub crypto - # Last resort, if all else fails - set root=ahci0,1 - for p in / /boot/; do - if [ -f "${p}vmlinuz" ]; then - linux ${p}vmlinuz root=/dev/sda1 rw - if [ -f "${p}initrd.img" ]; then - initrd ${p}initrd.img + if [ "${grub_scan_disk}" != "ata" ]; then + # Last resort, if all else fails + set root=ahci0,1 + for p in / /boot/; do + if [ -f "${p}vmlinuz" ]; then + linux ${p}vmlinuz root=/dev/sda1 rw + if [ -f "${p}initrd.img" ]; then + initrd ${p}initrd.img + fi fi - fi - done + done + fi - # Last resort (for setups that use IDE instead of SATA) - set root=ata0,1 - for p in / /boot/; do - if [ -f "${p}vmlinuz" ]; then - linux ${p}vmlinuz root=/dev/sda1 rw - if [ -f "${p}initrd.img" ]; then - initrd ${p}initrd.img + if [ "${grub_scan_disk}" != "ahci" ]; then + # Last resort (for setups that use IDE instead of SATA) + set root=ata0,1 + for p in / /boot/; do + if [ -f "${p}vmlinuz" ]; then + linux ${p}vmlinuz root=/dev/sda1 rw + if [ -f "${p}initrd.img" ]; then + initrd ${p}initrd.img + fi fi - fi - done + done + fi true # Prevent pager requiring to accept each line instead of whole screen } |