Makefile.mk: don't add bootblock after other files

This is a correction of CB:89570 (commit 04ea4724e2 ("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ś <filip.golas@3mdeb.com>
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90436
Reviewed-by: Filip Lewiński <filip.lewinski@3mdeb.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Kopeć <michal.kopec@3mdeb.com>
This commit is contained in:
Sergii Dmytruk 2025-12-09 16:45:53 +02:00 committed by Matt DeVillier
commit 739808011a

View file

@ -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