diff options
author | Francis Rowe <info@gluglug.org.uk> | 2016-01-02 11:59:41 (EST) |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2016-01-02 11:59:41 (EST) |
commit | 417361f8b794ffe433f1400e043c6bd6e9778ffc (patch) | |
tree | 7d3f73973f6f02be170aa89006f995a24c1d29f6 /resources/grub/config/menuentries | |
parent | b17525f25651cfd2e98f25fabdb6e0786fbeb2d9 (diff) | |
download | libreboot-417361f8b794ffe433f1400e043c6bd6e9778ffc.zip libreboot-417361f8b794ffe433f1400e043c6bd6e9778ffc.tar.gz libreboot-417361f8b794ffe433f1400e043c6bd6e9778ffc.tar.bz2 |
grub.cfg: eliminate use of * wildcard
This causes huge boot delays, because GRUB is extremely slow at
enumerating the list of available devices/partitions.
Diffstat (limited to 'resources/grub/config/menuentries')
-rw-r--r-- | resources/grub/config/menuentries/common.cfg | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/resources/grub/config/menuentries/common.cfg b/resources/grub/config/menuentries/common.cfg index feaefe6..b64b4de 100644 --- a/resources/grub/config/menuentries/common.cfg +++ b/resources/grub/config/menuentries/common.cfg @@ -11,10 +11,15 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o # a) Try RAID first, they might be used (accross multiple (raw) devices) # b) Try MBR/GPT partitions at last, one might still conviniently uses a single partition - for d in md/0 ahci0 ahci1 (ahci0,*) (ahci1,*); do + for d in md/0 ahci0 ahci1; do # prompt user for passphrase if LUKS header is found cryptomount ${d} done + for j in 1 2 3 4 5 6 7 8 9; do + for d in ahci0 ahci1; do + cryptomount "${d},${j}" + done + done # (This way, we only need to scan for encrypted data once while covering every possible disk setup, # be it BTRFS/ZFS/ext4/etc. (on LUKS) (on RAID) on/across raw devices/MBR/GPT @@ -22,8 +27,8 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o # 2. Look for user config. If the above routine successfully decrypted a LUKS container, its content # will be searched before everything else for obvious reasons. Regardless of this, the devices' # hirachy stays the same. - for d in crypto0 (crypt0,*) md/0 ahci0 ahci1 (ahci0,*) (ahci1,*); do - set root=${d} + for d in crypto0 md/0 ahci0 ahci1; do + set root="${d}" # a) Check possible file locations... for p in boot/grub/libreboot_ grub/libreboot_ boot/grub/ grub/ boot/grub2 grub2/; do if [ -f "/${p}grub.cfg" ]; then @@ -33,6 +38,20 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o fi done done + for j in 1 2 3 4 5 6 7 8 9; do + for d in crypto0 ahci0 ahci1; do + set root="${d},${j}" + # a) Check possible file locations... + for p in boot/grub/libreboot_ grub/libreboot_ boot/grub/ grub/ boot/grub2 grub2/; do + if [ -f "/${p}grub.cfg" ]; then + # b) And eventually try to load the config. Using ESC one can still exit and revert back to + # libreboot's menu. + configfile /${p}grub.cfg + fi + done + done + done + # prompt user for passphrase if LUKS header is found but try using external keyfiles first search -n -f /keyfile --set=kf --hint usb0, --hint usb1, if [ $? = 0 ]; then @@ -44,8 +63,14 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o cryptomount ${kf} ${d} done # 3. Do the same routine again, but for possibly decrypted data this time. - for d in crypto0 (crypt0,*); do - set root=${d} + set root=crypto0 + for p in boot/grub/libreboot_ grub/libreboot_ boot/grub/ grub/ boot/grub2 grub2/; do + if [ -f "/${p}grub.cfg" ]; then + configfile /${p}grub.cfg + fi + done + for j in 1 2 3 4 5 6 7 8 9; do + set root=crypto0 for p in boot/grub/libreboot_ grub/libreboot_ boot/grub/ grub/ boot/grub2 grub2/; do if [ -f "/${p}grub.cfg" ]; then configfile /${p}grub.cfg |