diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/fw/rom.sh | 77 |
1 files changed, 72 insertions, 5 deletions
diff --git a/include/fw/rom.sh b/include/fw/rom.sh index df37fdcf..5bd1c70c 100644 --- a/include/fw/rom.sh +++ b/include/fw/rom.sh @@ -60,6 +60,9 @@ corebootpremake() [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \ return 0 + [ "$XBMK_RELEASE" = "y" ] && \ + payload_edk2="" # source-only payload, for now. + forx 'check_coreboot_util %s' cbfstool ifdtool printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \ @@ -69,6 +72,41 @@ corebootpremake() x_ "$mk" download "$target"; : } +cook_coreboot_config() +{ + [ -n "$mode" ] && return 0 + [ -f "$srcdir/$cfgname" ] || return 0 + + [ -n "$payload_edk2" ] && \ + cook_coreboot_smmstore + + x_ make -C "$srcdir" oldconfig +} + +cook_coreboot_smmstore() +{ + # Enable SMMSTORE-related options for EDK2 variable storage. + # Because edk2 is source-only (release=n) in lbmk, we don't + # enable this in the configs themselves. Instead, we add it + # when building a board with EDK2 support in lbmk.git + + # TODO: this relpaces the option backend. i need to make + # coreboot always use a cbfs backend, and set all + # boards universally that way, before starting edk2 + + ecfg="CONFIG_SMMSTORE_BLOCK_SIZE=65536 \ + CONFIG_DRIVERS_EFI_VARIABLE_STORE=y \ + CONFIG_SMMSTORE=y \ + CONFIG_SMMSTORE_SIZE=0x80000 \ + CONFIG_SPI_FLASH_SMM=y \ + CONFIG_DRIVERS_GENERIC_CFR_ASSET_TAG=y \ + CONFIG_USE_UEFI_VARIABLE_STORE=y" # replace option backend + + for ecfgval in $ecfg; do + printf "%s\n" "$ecfgval" >> "$srcdir/$cfgname" + done +} + check_coreboot_util() { e "elf/coreboot/$tree/$1" f && \ @@ -142,9 +180,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 +212,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 +243,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 +269,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 +320,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 |
