summaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2016-01-02 12:29:53 (EST)
committer Francis Rowe <info@gluglug.org.uk>2016-01-02 12:29:53 (EST)
commit8e6582b18989d7749158b6bad4b79e4245af09de (patch)
tree4677e4f0a67fbac3fcb874288abd21e831c25f31 /resources
parent818db48b4fa355255a87f76ae27f65b8fe1a7160 (diff)
downloadlibreboot-8e6582b18989d7749158b6bad4b79e4245af09de.zip
libreboot-8e6582b18989d7749158b6bad4b79e4245af09de.tar.gz
libreboot-8e6582b18989d7749158b6bad4b79e4245af09de.tar.bz2
grub.cfg: simplify isolinux parsing to a single function
Diffstat (limited to 'resources')
-rw-r--r--resources/grub/config/menuentries/common.cfg61
1 files changed, 15 insertions, 46 deletions
diff --git a/resources/grub/config/menuentries/common.cfg b/resources/grub/config/menuentries/common.cfg
index ef0bbef..3739b45 100644
--- a/resources/grub/config/menuentries/common.cfg
+++ b/resources/grub/config/menuentries/common.cfg
@@ -9,6 +9,16 @@ function switch_to_grub_config {
fi
done
}
+function parse_isolinux_config {
+ set root=${1}
+ for p in /isolinux /syslinux; do
+ if [ -f "${p}${p}.cfg" ]; then
+ syslinux_configfile -i ${p}${p}.cfg
+ elif [ -f "/boot${p}${p}.cfg" ]; then
+ syslinux_configfile -i /boot${p}${p}.cfg
+ fi
+ done
+}
menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o' {
# GRUB handles (almost) every possible disk setup, but only the location of /boot is actually important,
@@ -67,65 +77,24 @@ menuentry 'Load Operating System (incl. fully encrypted disks) [o]' --hotkey='o
menuentry 'Parse ISOLINUX menu (AHCI) [a]' --hotkey='a' {
for i in 0 1; do
# Check for filesystem on raw device without partition table (MBR/GPT), e.g. BTRFS or ZFS
- set root=ahci${i}
- for p in /isolinux /syslinux; do
- if [ -f "${p}${p}.cfg" ]; then
- syslinux_configfile -i ${p}${p}.cfg
- elif [ -f "/boot${p}${p}.cfg" ]; then
- syslinux_configfile -i /boot${p}${p}.cfg
- fi
- done
+ parse_isolinux_config ahci${i}
# Look for partitions
# GPT allows more than 4 partitions, /boot on /dev/sda7 is quite unlikely but still possible
- for j in 0 1 2 3 4 5 6 7 8 9; do
- set root="ahci${i},${j}"
- for p in /isolinux /syslinux; do
- if [ -f "${p}${p}.cfg" ]; then
- syslinux_configfile -i ${p}${p}.cfg
- elif [ -f "/boot${p}${p}.cfg" ]; then
- syslinux_configfile -i /boot${p}${p}.cfg
- fi
- done
- done
+ for j in 0 1 2 3 4 5 6 7 8 9; do parse_isolinux_config "ahci${i},${j}"; done
done
}
menuentry 'Parse ISOLINUX menu (USB) [u]' --hotkey='u' {
for i in 0 1; do
# Check for filesystem on raw device without partition table (MBR/GPT), e.g. BTRFS or ZFS
- set root=usb${i}
- for p in /isolinux /syslinux; do
- if [ -f "${p}${p}.cfg" ]; then
- syslinux_configfile -i ${p}${p}.cfg
- elif [ -f "/boot${p}${p}.cfg" ]; then
- syslinux_configfile -i /boot${p}${p}.cfg
- fi
- done
+ parse_isolinux_config usb${i}
# Look for partitions
# GPT allows more than 4 partitions, /boot on /dev/sda7 is quite unlikely but still possible
- for j in 0 1 2 3 4 5 6 7 8 9; do
- set root=usb${i},${j}
- for p in "/isolinux" "/syslinux"; do
- if [ -f "${p}${p}.cfg" ]; then
- syslinux_configfile -i ${p}${p}.cfg
- elif [ -f "/boot${p}${p}.cfg" ]; then
- syslinux_configfile -i /boot${p}${p}.cfg
- fi
- done
- done
+ for j in 0 1 2 3 4 5 6 7 8 9; do parse_isolinux_config "usb${i},${j}"; done
done
}
menuentry 'Parse ISOLINUX menu (CD/DVD) [d]' --hotkey='d' {
insmod ata
- for x in ata0 ahci1; do
- set root=${x}
- for p in "/isolinux" "/syslinux"; do
- if [ -f "${p}${p}.cfg" ]; then
- syslinux_configfile -i ${p}${p}.cfg
- elif [ -f "/boot${p}${p}.cfg" ]; then
- syslinux_configfile -i /boot${p}${p}.cfg
- fi
- done
- done
+ for x in ata0 ahci1; do parse_isolinux_config ${x}; done
}
menuentry 'Switch to grubtest.cfg [t]' --hotkey='t' {
set root=cbfsdisk