Makefile.mk: separate bootblocks into BOOTBLOCK and TOPSWAP

Add Kconfig INTEL_TOP_SWAP_SEPARATE_REGIONS. When enabled, place the
regular bootblock in BOOTBLOCK and the Top Swap bootblock in TOPSWAP
to simplify A B updates. This lays groundwork for redundancy where one
bootblock remains a read only golden copy and the other is replaceable.

No swap control logic is added in this change. The option depends on
INTEL_ADD_TOP_SWAP_BOOTBLOCK and defaults to n so existing builds are
unchanged. A custom .fmd is required with BOOTBLOCK and TOPSWAP added
at the end of the image.

Background and update flow are described here:
Link: https://mail.coreboot.org/archives/list/coreboot@coreboot.org/thread/C6JN2PB7K7D67EG7OIKB6BBERZU5Y
V35/

TEST=Build and run Protectli VP6650 (ADL-P), boots successfully with
correct microcode

Change-Id: I489406dd8d08ad85bb46324d3d009acb49b6c52a
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89570
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This commit is contained in:
Filip Lewiński 2025-10-17 16:00:46 +02:00 committed by Matt DeVillier
commit 04ea4724e2
3 changed files with 47 additions and 7 deletions

View file

@ -13,9 +13,14 @@ intel_fit-file := fit_table.c:struct
intel_fit-type := intel_fit
intel_fit-align := 16
ifeq ($(CONFIG_INTEL_TOP_SWAP_SEPARATE_REGIONS),y)
regions-for-file-intel_fit = BOOTBLOCK
regions-for-file-intel_fit_ts = TOPSWAP
endif
$(call add_intermediate, set_fit_ptr, $(IFITTOOL))
@printf " UPDATE-FIT set FIT pointer to table\n"
$(IFITTOOL) -f $< -F -n intel_fit -r COREBOOT -c
$(IFITTOOL) -f $< -F -n intel_fit -r $(BB_FIT_REGION) -c
FIT_ENTRY=$(call strip_quotes, $(CONFIG_INTEL_TOP_SWAP_FIT_ENTRY_FMAP_REG))
@ -24,22 +29,23 @@ ifneq ($(CONFIG_UPDATE_IMAGE),y) # never update the bootblock
ifneq ($(CONFIG_CPU_MICROCODE_CBFS_NONE)$(CONFIG_CPU_INTEL_MICROCODE_CBFS_SPLIT_BINS),y)
$(call add_intermediate, add_mcu_fit, set_fit_ptr $(IFITTOOL))
@printf "$(call regions-for-file,$(cpu_microcode_blob.bin))"
@printf " UPDATE-FIT Microcode\n"
$(IFITTOOL) -f $< -a -n cpu_microcode_blob.bin -t 1 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) -r COREBOOT
$(IFITTOOL) -f $< -a -n cpu_microcode_blob.bin -t 1 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) -r $(BB_FIT_REGION) -R COREBOOT
# Second FIT in TOP_SWAP bootblock
ifeq ($(CONFIG_INTEL_ADD_TOP_SWAP_BOOTBLOCK),y)
$(call add_intermediate, set_ts_fit_ptr, $(IFITTOOL))
@printf " UPDATE-FIT Top Swap: set FIT pointer to table\n"
$(IFITTOOL) -f $< -F -n intel_fit_ts -r COREBOOT $(TS_OPTIONS)
$(IFITTOOL) -f $< -F -n intel_fit_ts -r $(TS_FIT_REGION) $(TS_OPTIONS)
$(call add_intermediate, add_ts_mcu_fit, set_ts_fit_ptr $(IFITTOOL))
@printf " UPDATE-FIT Top Swap: Microcode\n"
ifneq ($(FIT_ENTRY),)
$(IFITTOOL) -f $< -A -n $(FIT_ENTRY) -t 1 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) $(TS_OPTIONS) -r COREBOOT
$(IFITTOOL) -f $< -A -n $(FIT_ENTRY) -t 1 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) $(TS_OPTIONS) -r $(TS_FIT_REGION)
endif # FIT_ENTRY
$(IFITTOOL) -f $< -a -n cpu_microcode_blob.bin -t 1 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) $(TS_OPTIONS) -r COREBOOT
$(IFITTOOL) -f $< -a -n cpu_microcode_blob.bin -t 1 -s $(CONFIG_CPU_INTEL_NUM_FIT_ENTRIES) $(TS_OPTIONS) -r $(TS_FIT_REGION) -R COREBOOT
cbfs-files-y += intel_fit_ts
intel_fit_ts-file := fit_table.c:struct