summaryrefslogtreecommitdiff
path: root/resources/scripts
diff options
context:
space:
mode:
authorVitali64 <vitali64pmemail@protonmail.com>2021-11-27 20:06:32 +0100
committerLeah Rowe <leah@libreboot.org>2021-11-28 17:16:18 +0000
commitb74056563fa0d23605d4c5c91e22493d424f0765 (patch)
treec695428e752854799170a41af53d2ed98af3dd1d /resources/scripts
parenteed25bd2209a4c9f7c21a15689b5c90bd3757a6c (diff)
Workaround for grub's slow boot
Diffstat (limited to 'resources/scripts')
-rwxr-xr-xresources/scripts/build/boot/roms_helper18
1 files changed, 18 insertions, 0 deletions
diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper
index 5c109c82..fdb938ad 100755
--- a/resources/scripts/build/boot/roms_helper
+++ b/resources/scripts/build/boot/roms_helper
@@ -47,6 +47,10 @@ if [ ! -f "resources/coreboot/${board}/board.cfg" ]; then
exit 1
fi
+
+# Workaround to grub's slow boot
+grub_scan_disk="both" # both: scan ata and ahci (slow), there is ata and ahci too
+ # as an option
cbtree="undefined"
romtype="normal" # optional parameter in board.cfg. "normal" is default
arch="undefined"
@@ -60,6 +64,14 @@ seabios_opromloadonly="0"
payload_memtest="n"
# Override the above defaults using board.cfg
source "resources/coreboot/${board}/board.cfg"
+
+if [ "${grub_scan_disk}" != "both" ] || \
+ [ "${grub_scan_disk}" != "ata" ] || \
+ [ "${grub_scan_disk}" != "ahci" ]; then
+ printf "build/roms: Target %s 's grub_scan_disk variable: unvalid value. Skipping build.\n" "${board}"
+ exit 1
+fi
+
if [ "${cbtree}" = "undefined" ]; then
printf "build/roms: Target %s does not define a coreboot tree. Skipping build.\n" "${board}"
exit 1
@@ -308,6 +320,12 @@ make_grubrom_from_keymap() {
cp "${target_cbrom}" "${tmprom}"
"${cbfstool_path}" "${tmprom}" add-payload -f "${grubelf}" -n ${target_grubelf_cbfs_path} -c lzma
+ if [ "${grub_scan_disk}" = "ahci" ]; then
+ sed 's/search_grub ata//' "${grubcfg}" > "${grubcfg}"
+ elif [ "${grub_scan_disk}" = "ata" ]; then
+ sed 's/search_grub ahci//' "${grubcfg}" > "${grubcfg}"
+ fi
+
"${cbfstool_path}" "${tmprom}" add -f "${grubcfg}" -n grub.cfg -t raw
"${cbfstool_path}" "${tmprom}" add -f "${grubtestcfg}" -n grubtest.cfg -t raw