summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-12-18 06:49:08 +0000
committerLeah Rowe <leah@libreboot.org>2024-12-18 07:15:18 +0000
commit1dd32ea548739c7e1daf0283697189b44e71d7c6 (patch)
treea0b11002114345e5a57007e8022a5e144c14971d
parentf7801ef4770c7ffc51cf1db40d0a2021a2a6273a (diff)
rom.sh: support grub-first setupsHEADmaster
in this setup, seabios is never the default payload, grub is, but only if grub is enabled. set this in target.cfg: payload_grubsea="y" if payload_grub isn't enabled, this is auto-set to n ditto if initmode=normal NOTE: if flashing libgfx setups, you should make sure that you're not booting with a graphics card, only intel graphics. this setting will intentionally not be documented, because it's not recommended, but is being implemented for testing purposes (and i implemented it for some guy who i think is cool). i'll probably also use this myself, since i already do grub-only setups on all my own machines. seagrub is the default on x86 because of past instabilities with grub. to mitigate in case of future issues, since seabios is always stable, we reduce the chance of bricks. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--config/data/coreboot/mkhelper.cfg2
-rw-r--r--include/rom.sh23
2 files changed, 19 insertions, 6 deletions
diff --git a/config/data/coreboot/mkhelper.cfg b/config/data/coreboot/mkhelper.cfg
index a218e0e7..a344674c 100644
--- a/config/data/coreboot/mkhelper.cfg
+++ b/config/data/coreboot/mkhelper.cfg
@@ -6,7 +6,7 @@ build_depend="seabios/default grub/default memtest86plus u-boot/amd64coreboot"
seavgabiosrom="elf/seabios/default/libgfxinit/vgabios.bin"
pv="payload_uboot payload_seabios payload_memtest payload_grub"
-pv="$pv payload_uboot_i386 payload_uboot_amd64"
+pv="$pv payload_uboot_i386 payload_uboot_amd64 payload_grubsea"
v="initmode ubootelf grub_scan_disk uboot_config grubtree grubelf pname"
v="$v displaymode tmprom newrom"
eval `setvars "n" $pv`
diff --git a/include/rom.sh b/include/rom.sh
index 8d9cdf40..f21b6302 100644
--- a/include/rom.sh
+++ b/include/rom.sh
@@ -120,6 +120,10 @@ mkcorebootbin()
[ "$payload_memtest" = "y" ] || payload_memtest="n"
[ "$(uname -m)" = "x86_64" ] || payload_memtest="n"
+ [ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ] && \
+ payload_grubsea="n"
+ [ "$payload_grub" = "y" ] || payload_grubsea="n"
+
if $dry grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
[ "$payload_seabios" = "y" ] && pname="seabios" && \
$dry add_seabios
@@ -138,7 +142,9 @@ add_seabios()
_seabioself="elf/seabios/default/$initmode/bios.bin.elf"
- cbfs "$tmprom" "$_seabioself" "fallback/payload"
+ _seaname="fallback/payload" && [ "$payload_grubsea" = "y" ] && \
+ _seaname="seabios.elf"
+ cbfs "$tmprom" "$_seabioself" "$_seaname"
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
_z="2"; [ "$initmode" = "vgarom" ] && _z="0"
@@ -152,15 +158,18 @@ add_seabios()
[ "$payload_grub" = "y" ] && add_grub
- cprom
+ [ "$payload_grubsea" != "y" ] && cprom
[ "$payload_uboot_amd64" = "y" ] && [ "$displaymode" != "txtmode" ] && \
- [ "$initmode" != "normal" ] && pname="seauboot" && cprom "seauboot"
+ [ "$initmode" != "normal" ] && [ "$payload_grubsea" != "y" ] && \
+ pname="seauboot" && cprom "seauboot"
[ "$payload_grub" = "y" ] && pname="seagrub" && mkseagrub; :
}
add_grub()
{
- cbfs "$tmprom" "$grubelf" "img/grub2"
+ _grubname="img/grub2" && [ "$payload_grubsea" = "y" ] && \
+ _grubname="fallback/payload"
+ cbfs "$tmprom" "$grubelf" "$_grubname"
printf "set grub_scan_disk=\"%s\"\n" "$grub_scan_disk" \
> "$TMPDIR/tmpcfg" || $err "$target: !insert scandisk"
cbfs "$tmprom" "$TMPDIR/tmpcfg" scan.cfg raw
@@ -171,7 +180,11 @@ add_grub()
mkseagrub()
{
- cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
+ if [ "$payload_grubsea" = "y" ]; then
+ pname="grub"
+ else
+ cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
+ fi
for keymap in config/data/grub/keymap/*.gkb; do
[ -f "$keymap" ] && cprom "${keymap##*/}"; :
done; :