From 0e0ab73687944056ee4a18afbaf92f0cd66aa6b2 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 30 Jul 2023 17:54:36 -0700 Subject: [PATCH] src/image: fix ability to boot from NORMAL region commit fa3da49c84a26255510c18f293f25257bd0692d2 "coreboot: update patch to add master header in both images" still isn't causing coreboot to put a master header into the NORMAL region. As a result, images built after that commit but before this one will always use the FALLBACK region. This commit adds the master header explicitly, since I still can't seem to get coreboot to do that on its own. --- src/image/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/image/default.nix b/src/image/default.nix index 189e62d..5c97754 100644 --- a/src/image/default.nix +++ b/src/image/default.nix @@ -43,8 +43,17 @@ nixpkgsOnBuildForHost.stdenv.mkDerivation { runHook preBuild cp ${coreboot}/coreboot.rom . chmod +w coreboot.rom + + ${update-cbfs "FALLBACK"} + cbfstool coreboot.rom print -rFALLBACK + + # unfortunately this is the only way to trick cbfstool into + # putting a "header pointer" in both regions: + cbfstool coreboot.rom read -r FALLBACK -f half.img + cbfstool coreboot.rom write -F -r NORMAL -f half.img + rm half.img cbfstool coreboot.rom print -rNORMAL - ${lib.concatMapStrings (region: update-cbfs region) [ "NORMAL" "FALLBACK" ]} + runHook postBuild '';