From cbac0d7a257629e977a1d625c83e7a2a4b1a84bb Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Tue, 9 Dec 2025 16:39:41 +0200 Subject: [PATCH] Makefile.mk,cpu/intel/fit/Makefile.mk: introduce CBFS_REGIONS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Take advantage of cbfstool's ability to operate on multiple regions and introduce a variable with a list of main CBFS regions: it's just "COREBOOT" in most cases, but becomes "COREBOOT,COREBOOT_TS" when Top Swap update mechanism is enabled (see [0]). This is meant to simplify Makefiles by avoiding extra branches in existing and future changes. [0]: https://mail.coreboot.org/archives/list/coreboot@coreboot.org/thread/C6JN2PB7K7D67EG7OIKB6BBERZU5YV35/ Change-Id: If537d0d21a2867fafc2241ea9a0b4c0c6ca290a8 Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/90435 Reviewed-by: Filip Lewiński Reviewed-by: Filip Gołaś Tested-by: build bot (Jenkins) Reviewed-by: Michał Kopeć --- Makefile.mk | 20 +++++++++++--------- src/cpu/intel/fit/Makefile.mk | 5 +---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile.mk b/Makefile.mk index cab60b33a4..347ffc626f 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -974,21 +974,23 @@ $(objcbfs)/%.elf: $(objcbfs)/%.debug $(objcbfs)/%.map # 4) replace all '*' characters with spaces extract_nth=$(subst *,$(spc),$(patsubst -%-,%,$(word $(1), $(subst |,- -,-$(2)-)))) +CBFS_REGIONS := COREBOOT + +ifeq ($(CONFIG_INTEL_ADD_TOP_SWAP_BOOTBLOCK),y) +ifneq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y) +TS_OPTIONS := -j $(CONFIG_INTEL_TOP_SWAP_BOOTBLOCK_SIZE) +else +CBFS_REGIONS := COREBOOT,COREBOOT_TS +endif +endif + # regions-for-file - Returns a cbfstool regions parameter # $(call regions-for-file,$(filename)) # returns "REGION1,REGION2,..." # # This is the default implementation. When using a boot strategy employing # multiple CBFSes in fmap regions, override it. -regions-for-file ?= $(if $(value regions-for-file-$(1)), $(regions-for-file-$(1)), COREBOOT) - -ifeq ($(CONFIG_INTEL_ADD_TOP_SWAP_BOOTBLOCK),y) -ifneq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y) -TS_OPTIONS := -j $(CONFIG_INTEL_TOP_SWAP_BOOTBLOCK_SIZE) -else -regions-for-file = $(if $(value regions-for-file-$(1)), $(regions-for-file-$(1)), COREBOOT,COREBOOT_TS) -endif -endif +regions-for-file ?= $(if $(value regions-for-file-$(1)), $(regions-for-file-$(1)), $(CBFS_REGIONS)) ifeq ($(CONFIG_CBFS_AUTOGEN_ATTRIBUTES),y) cbfs-autogen-attributes=-g diff --git a/src/cpu/intel/fit/Makefile.mk b/src/cpu/intel/fit/Makefile.mk index 1594f45a4e..4a01449e4e 100644 --- a/src/cpu/intel/fit/Makefile.mk +++ b/src/cpu/intel/fit/Makefile.mk @@ -69,10 +69,7 @@ pbp.bin-type := raw $(call add_intermediate, add_pbp_fit, set_fit_ptr $(IFITTOOL)) @printf " UPDATE-FIT Platform Boot Policy binary\n" - $(IFITTOOL) -f $< -a -n pbp.bin -t 4 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) -r COREBOOT -ifeq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y) - $(IFITTOOL) -f $< -a -n pbp.bin -t 4 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) -r COREBOOT_TS -endif + $(IFITTOOL) -f $< -a -n pbp.bin -t 4 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) -r $(CBFS_REGIONS) endif # CONFIG_HAVE_PBP_BIN