summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-12-18 04:17:05 +0000
committerLeah Rowe <leah@libreboot.org>2023-12-18 04:17:05 +0000
commit49eed9ac46849a2d312d3603901d28ae24deb320 (patch)
tree57998a78e272e7158be8f2a6bf22f162b5d9ff7c
parentaed4dff876d03b3b727fc687131677223eef933c (diff)
Revert "grub.cfg: try luks2/crypto-lvm before non-crypto"
This reverts commit 20389655e42e62ebf6d96dd106c91fbe74282557. If the user actually has encryption, but has /boot unencrypted, this will considerably slow down the boot, so the patch has been reverted. The patch was originally meant to favour encrypted /boot setups, but the old behaviour also still works there.
-rw-r--r--config/grub/config/grub.cfg32
1 files changed, 21 insertions, 11 deletions
diff --git a/config/grub/config/grub.cfg b/config/grub/config/grub.cfg
index e10cebd7..9439778a 100644
--- a/config/grub/config/grub.cfg
+++ b/config/grub/config/grub.cfg
@@ -92,10 +92,28 @@ function search_isolinux {
}
menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o' {
+ 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
+
+ # TODO: add more strings, based on what distros set up when
+ # the user select auto-partitioning on those installers
lvmvol="lvm/grubcrypt-bootvol lvm/grubcrypt-rootvol"
raidvol="md/0 md/1 md/2 md/3 md/4 md/5 md/6 md/7 md/8 md/9"
+ # in practise, doing multiple redundant checks is perfectly fast and
+ # TODO: optimize grub itself, and use */? here for everything
+
+ for vol in ${lvmvol} ${raidvol} ; do
+ try_user_config "${vol}"
+ done
+
unset ahcidev
unset atadev
for i in 11 10 9 8 7 6 5 4 3 2 1 0; do
@@ -117,20 +135,12 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
set pager=1
echo
- # prefer crypto first (lvm before raid, because lvm
- # volumes might exist inside luks/luks2)
- search_grub crypto
- for vol in ${lvmvol} ${raidvol}; do
+ # after cryptomount, lvm volumes might be available
+ for vol in ${lvmvol}; do
try_user_config "${vol}"
done
- # non-encrypted next, if crypto wasn't available
- if [ "${grub_scan_disk}" != "ata" ]; then
- search_grub ahci
- fi
- if [ "${grub_scan_disk}" != "ahci" ]; then
- search_grub ata
- fi
+ search_grub crypto
if [ "${grub_scan_disk}" != "ata" ]; then
# Last resort, if all else fails