From 739808011af70f0ad283ddc76b6ca88610521b4d Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Tue, 9 Dec 2025 16:45:53 +0200 Subject: [PATCH] Makefile.mk: don't add bootblock after other files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a correction of CB:89570 (commit 04ea4724e2d0 ("Makefile.mk: separate bootblocks into BOOTBLOCK and TOPSWAP")). It wasn't obvious that CBFS verification depends on bootblock being added first (otherwise cbfstool considers CBFS verification to be disabled because anchor is part of a bootblock). Correct this and add a comment for anyone else who might edit this code in the future. The issue manifested itself in build failing to perform CBFS verification via cbfstool when the firmware was built with CBFS_VERIFICATION enabled. Change-Id: If775480394270fc05206cde0707c511b126265d3 Signed-off-by: Filip Gołaś Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/90436 Reviewed-by: Filip Lewiński Tested-by: build bot (Jenkins) Reviewed-by: Michał Kopeć --- Makefile.mk | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Makefile.mk b/Makefile.mk index 347ffc626f..3a20cffd62 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -1296,9 +1296,16 @@ $(shell rm -f $(obj)/coreboot.pre) ifneq ($(CONFIG_UPDATE_IMAGE),y) $(obj)/coreboot.pre: $$(prebuilt-files) $(CBFSTOOL) $(obj)/fmap.fmap $(obj)/fmap.desc $(objcbfs)/bootblock.bin $(CBFSTOOL) $@.tmp create -M $(obj)/fmap.fmap -r $(shell cat $(obj)/fmap.desc) +# The bootblock must exist in the image before we call `prebuild-files`, +# otherwise their hashes won't be added into the CBFS header and CBFS +# verification will fail. printf " BOOTBLOCK\n" ifneq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y) $(call add_bootblock,$@.tmp,$(objcbfs)/bootblock.bin) +else + @printf " PREP place bootblocks in $(BB_FIT_REGION) and $(TS_FIT_REGION)\n" + @printf " $(BB_FIT_REGION),$(TS_FIT_REGION)\n" + $(CBFSTOOL) $@.tmp add -r $(BB_FIT_REGION),$(TS_FIT_REGION) $(bootblock_add_params) endif # ifneq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y) $(prebuild-files) true mv $@.tmp $@ @@ -1329,15 +1336,6 @@ add_intermediate = \ $(1): $(obj)/coreboot.pre $(2) | $(INTERMEDIATE) \ $(eval INTERMEDIATE+=$(1)) $(eval PHONY+=$(1)) -ifeq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y) -$(call add_intermediate, prep_bb_regions, $(CBFSTOOL)) - @printf " PREP place bootblocks in BOOTBLOCK and TOPSWAP\n" - @printf " BOOTBLOCK\n" - $(CBFSTOOL) $< add -r $(BB_FIT_REGION) $(bootblock_add_params) - @printf " TOPSWAP\n" - $(CBFSTOOL) $< add -r $(TS_FIT_REGION) $(bootblock_add_params) -endif - $(obj)/coreboot.rom: $(obj)/coreboot.pre $(CBFSTOOL) $(IFITTOOL) $$(INTERMEDIATE) @printf " CBFS $(subst $(obj)/,,$(@))\n" # The full ROM may be larger than the CBFS part, so create an empty