diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-22 08:29:15 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-22 15:44:21 +0100 |
| commit | 92d952b6056f31b3e2da4fc8b6cd0c67328bcd03 (patch) | |
| tree | 17efa62ceb01f68d965c18b8dfee41169f404beb /include/fw/rom.sh | |
| parent | 8fab3275190e9dbd8e66528ce1ec8c92becdc3c7 (diff) | |
experimental edk2 support
now we can have gop support!
add these to a board's target.cfg to enable:
payload_edk2="edk2_mrchromebox"
and add this to build_depend: coreboot/edk2_mrchromebox
as an example, this patch enables it on dell optiplex 5050 sff.
we don't handle downloads of edk2 or submodules in lbmk. we
use coreboot's logic. coreboot's logic doesn't have redundant
git repository backups, and doesn't properly support patching
submodules like lbmk would.
in a future revision, i will add edk2 git repository and submodules
in lbmk directly, and build it using lbmk's own logic.
because of this design, it's set release=n for now. if you build
for a board that enables edk2 when doing ./mk release, or if
you set XBMK_RELEASE=y, and a board is release=n in target.cfg,
that board is skipped; this extends to everything. edk2_mrchromebox
is set release=n.
when release=n and doing ./mk release, payload_edk2 is emptied at
build time. those boards that use it would still build, but only
have e.g. grub, seabios and u-boot.
the coreboot build system is given a fake coreboot target. it actually
is a QEMU setup, and does boot into QEMU, though edk2 is currently
broken on QEMU in my testing. it works on dell optiplex 5050 sff.
edk2 is multi-tree, naturally because it piggybacks off of coreboot
as in this patch. this means i can add other targets with different
edk2 setups. e.g. config/module/coreboot/edk2_foo, then a given
coreboot tree would set payload_edk2="foo"
so long as edk2 is enabled in the coreboot config, it will build
to a custom_*.rom under bin/
the config for coreboot must be named libgfxinit_corebootfb, but
the edk2 build could be used on fspgop and vgarom setups as
well. it is disabled on text-mode setups.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/fw/rom.sh')
| -rw-r--r-- | include/fw/rom.sh | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/include/fw/rom.sh b/include/fw/rom.sh index df37fdcf..5f98040a 100644 --- a/include/fw/rom.sh +++ b/include/fw/rom.sh @@ -122,6 +122,9 @@ mkcorebootbin_real() { [ "$target" = "$tree" ] && return 0 + [ "$XBMK_RELEASE" = "y" ] \ + payload_edk2="" # source-only payload, for now. + tmprom="$xbtmp/coreboot.rom" initmode="${buildcfg##*/}" @@ -142,9 +145,6 @@ mkcorebootbin_real() elfrom="${elfrom}_$displaymode" elfrom="$elfrom/coreboot.rom" - $if_not_skip_build x_ cp "$elfrom" "$tmprom" - $if_not_skip_build unpad_one_byte "$tmprom" - [ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \ [ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ] \ && err "'$target' defines bad u-boot type '$payload_uboot'" \ @@ -177,10 +177,22 @@ mkcorebootbin_real() [ "$payload_grub" != "y" ] && \ payload_grubsea="n" - [ -f "$cbfscfg" ] && \ - $if_not_skip_build dx_ add_cbfs_option "$cbfscfg" + if [ "$initmode" != "libgfxinit" ] || \ + [ "$displaymode" != "corebootfb" ]; then + [ "$initmode" != "fspgop" ] && [ "$initmode" != "normal" ] && \ + payload_edk2="" # disable on txtmode + fi + + $if_not_skip_build prep_tmprom if grep "CONFIG_PAYLOAD_NONE=y" "$buildcfg"; then + if [ -n "$payload_edk2" ]; then + pname="edk2" + $if_not_skip_build add_edk2 "fallback/payload" + $if_not_skip_build cprom # standalone edk2 + + $if_not_skip_build prep_tmprom + fi if [ "$payload_seabios" = "y" ]; then pname="seabios" $if_not_skip_build add_seabios @@ -196,6 +208,15 @@ mkcorebootbin_real() fi; : } +prep_tmprom() +{ + x_ cp "$elfrom" "$tmprom" + unpad_one_byte "$tmprom" + + [ -f "$cbfscfg" ] && \ + dx_ add_cbfs_option "$cbfscfg"; : +} + # options for cbfs backend (as opposed to nvram/smmstore): add_cbfs_option() @@ -213,6 +234,14 @@ add_cbfs_option() x_ "$cbfstool" "$tmprom" add-int -i "$op_arg" -n "option/$op_name" } +add_edk2() +{ + edk2dir="elf/coreboot/default/$payload_edk2" + edk2="$edk2dir/libgfxinit_corebootfb/UEFIPAYLOAD.fd" + + cbfs "$tmprom" "$edk2" "$1" +} + # in our design, SeaBIOS is also responsible for starting either # a GRUB or U-Boot payload. this is because SeaBIOS is generally # a more reliable codebase, so it's less likely to cause a brick @@ -256,6 +285,9 @@ add_seabios() [ "$payload_grub" = "y" ] && \ add_grub + [ -n "$payload_edk2" ] && \ + add_edk2 "img/edk2" + [ "$payload_grubsea" != "y" ] && \ cprom # seabios, but don't load grub/u-boot first |
