From f195282d905a378149036a01d5eeff108be5a381 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 30 Oct 2021 16:03:10 +0100 Subject: grub.cfg patch from shmalebx9: reverse search order for encrypted partitions Also, when a cryptomount is successful, break from the loop and boot from that. In most cases, this will work just fine, and this change improves the boot speed in the vast majority of cases. From This is based on commit 5767489cadc4a9a1f2e7bffe03457e29e1c9a101 from https://github.com/shmalebx9/Bleeding-Libreboot/ --- resources/grub/config/grub.cfg | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'resources') diff --git a/resources/grub/config/grub.cfg b/resources/grub/config/grub.cfg index 7a86ded8..d56732ed 100644 --- a/resources/grub/config/grub.cfg +++ b/resources/grub/config/grub.cfg @@ -113,17 +113,22 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o # Encrypted disks and partitions #TODO: This needs to be adjusted on each device to exclude ODD #TODO: Usually ATA is for odd if both exist! -#TODO: Shouldn't it stop at first successful cryptomount? #TODO: Unset variables before use! #TODO: Pick better variable name scheme than ${ddev}, or find way to make it local unset ahcidev unset atadev unset usbdev if [ (ahci?) != "(ahci?)" ]; then - ahcidev=(ahci*) + ahcilist=(ahci*) + for part in ${ahcilist}; do + ahcidev="$part $ahcidev" + done fi if [ (ata?) != "(ata?)" ]; then - atadev=(ata*) + atalist=(ata*) + for part in ${atalist}; do + atadev="$part $atadev" + done fi if [ (usb?) != "(usb?)" ]; then usbdev=(usb*) @@ -132,7 +137,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o echo -n "Attempting to cryptomount: " for dev in ${usbdev} ${ahcidev} ${atadev} ${lvmvol}; do # what about raid? echo -n "${dev} " - cryptomount "${dev}" + if cryptomount "${dev}" ; then break ; fi done set pager=1 echo # Insert newline @@ -179,6 +184,7 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o true # Prevent pager requiring to accept each line instead of whole screen } + menuentry 'Search ISOLINUX menu (AHCI) [a]' --hotkey='a' { search_isolinux ahci } -- cgit v1.2.1