From 792efc659fcb23a047fb01aacede3f7d669dc16d Mon Sep 17 00:00:00 2001
From: Leah Rowe <leah@libreboot.org>
Date: Mon, 22 Jul 2024 18:47:38 +0100
Subject: [PATCH] rom.sh: also add grub to seabios images

we want multiple seagrub images made, with different
keymaps, but we only want one non-seagrub image.

however, we also want grub in the non-seagrub image.
it just means that seabios is primarily what the user
wants, and they might occasionally use grub, whereas
the seagrub images are for people who primarily want
grub but may occasionally access the seabios menu.

right now, the seabios images really only contain seabios,
but there's no harm in adding grub to them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
---
 include/rom.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/rom.sh b/include/rom.sh
index 8982138..29741df 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -126,7 +126,9 @@ add_seabios()
 	[ "$payload_memtest" = "y" ] && cbfs "$tmprom" \
 	    "elf/memtest86plus/memtest.bin" img/memtest
 
-	cprom && [ "$payload_grub" = "y" ] && pname="seagrub" && add_grub; :
+	[ "$payload_grub" = "y" ] && add_grub
+
+	cprom && [ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; :
 }
 
 add_grub()
@@ -135,6 +137,10 @@ add_grub()
 	printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \
 	    > "$TMPDIR/tmpcfg" || $err "$target: !insert scandisk"
 	cbfs "$tmprom" "$TMPDIR/tmpcfg" scan.cfg raw
+}
+
+mkseagrub()
+{
 	cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
 	for keymap in config/data/grub/keymap/*.gkb; do
 		[ -f "$keymap" ] || continue
-- 
GitLab