From 471eda5ae183b7c2add94529e9b8fc627a155392 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Fri, 20 May 2022 17:36:46 +0800 Subject: Makefile.inc: Add bootblock to CBFS before others With CBFS verification, cbfstool (CB:41121) needs bootblock to be present in coreboot.pre in order to locate the metadata hash stored in it. Therefore we have to ensure that bootblock is added to CBFS before other CBFS files are added. To solve the problem, create the 'add_bootblock' function, and call it in the coreboot.pre recipe. Because bootblock.bin is now a prerequisite of coreboot.pre, it will get built even if CONFIG_BOOTBLOCK_IN_CBFS=n. BUG=b:233263447 TEST=emerge-guybrush coreboot TEST=emerge-corsola coreboot chromeos-bootimage TEST=cbfstool image-kingler.bin print -v TEST=Kingler booted successfully BRANCH=none Change-Id: I385deb8231e44310ee139c3f69f449e75b92b2be Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/64547 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- Makefile.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Makefile.inc') diff --git a/Makefile.inc b/Makefile.inc index 8da6cba00408..da1458a1e532 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -1100,13 +1100,19 @@ ifeq ($(CONFIG_INTEL_ADD_TOP_SWAP_BOOTBLOCK),y) TS_OPTIONS := -j $(CONFIG_INTEL_TOP_SWAP_BOOTBLOCK_SIZE) endif +ifneq ($(CONFIG_ARCH_X86),y) +add_bootblock = $(CBFSTOOL) $(1) write -u -r BOOTBLOCK -f $(2) +endif + # coreboot.pre doesn't follow the standard Make conventions. It gets modified # by multiple rules, and thus we can't compute the dependencies correctly. $(shell rm -f $(obj)/coreboot.pre) ifneq ($(CONFIG_UPDATE_IMAGE),y) -$(obj)/coreboot.pre: $$(prebuilt-files) $(CBFSTOOL) $(obj)/fmap.fmap $(obj)/fmap.desc +$(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) + printf " BOOTBLOCK\n" + $(call add_bootblock,$@.tmp,$(objcbfs)/bootblock.bin) $(prebuild-files) true mv $@.tmp $@ else # ifneq ($(CONFIG_UPDATE_IMAGE),y) @@ -1136,12 +1142,6 @@ add_intermediate = \ $(1): $(obj)/coreboot.pre $(2) | $(INTERMEDIATE) \ $(eval INTERMEDIATE+=$(1)) $(eval PHONY+=$(1)) -ifneq ($(CONFIG_ARCH_X86),y) -$(call add_intermediate, add_bootblock, $(objcbfs)/bootblock.bin) - printf " FMAP writing BOOTBLOCK region\n" - $(CBFSTOOL) $< write -u -r BOOTBLOCK -f $(objcbfs)/bootblock.bin -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 -- cgit v1.2.3