Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 65 additions & 1 deletion Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ subdirs-y += util/checklist util/testing
#######################################################################
# Add source classes and their build options
classes-y := ramstage romstage bootblock decompressor postcar smm smmstub cpu_microcode verstage
# when building redundant bootblock, we create a second class alias for Slot B
ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
classes-y += bootblock_b
endif

# Add a special 'all' class to add sources to all stages
$(call add-special-class,all)
Expand Down Expand Up @@ -218,6 +222,11 @@ ramstage-postprocess=$$(eval DEPENDENCIES+=$$(addsuffix .d,$$(basename $(1)))) \

decompressor-generic-ccopts += -D__DECOMPRESSOR__
bootblock-generic-ccopts += -D__BOOTBLOCK__
bootblock_b-generic-ccopts += -D__BOOTBLOCK__
ifeq ($(CONFIG_BOOTBLOCK_SLOT_VARIANTS),y)
bootblock-generic-ccopts += -DSLOT_A
bootblock_b-generic-ccopts += -DSLOT_B
endif
romstage-generic-ccopts += -D__ROMSTAGE__
ramstage-generic-ccopts += -D__RAMSTAGE__
ifeq ($(CONFIG_COVERAGE),y)
Expand Down Expand Up @@ -834,6 +843,13 @@ verstage-y += $(CONFIG_MEMLAYOUT_LD_FILE)
postcar-y += $(CONFIG_MEMLAYOUT_LD_FILE)
decompressor-y += $(CONFIG_MEMLAYOUT_LD_FILE)

# Make bootblock_b sources mirror bootblock (alias)
ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
bootblock_b-y += $(bootblock-y)
bootblock_b-c-deps += $(bootblock-c-deps)
bootblock_b-c-gen-deps += $(bootblock-c-gen-deps)
endif

#######################################################################
# Clean up rules
clean-abuild:
Expand Down Expand Up @@ -922,26 +938,56 @@ $(objcbfs)/bootblock.raw.elf: $(objcbfs)/decompressor.elf
@printf " OBJCOPY $(notdir $(@))\n"
$(OBJCOPY_bootblock) $(preserve-bss-flags) $< $@

ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
$(objcbfs)/bootblock_b.raw.elf: $(objcbfs)/decompressor.elf
@printf " OBJCOPY $(notdir $(@))\n"
$(OBJCOPY_bootblock_b) $(preserve-bss-flags) $< $@
endif

else # CONFIG_COMPRESS_BOOTBLOCK

$(objcbfs)/bootblock.raw.elf: $(objcbfs)/bootblock.elf
@printf " OBJCOPY $(notdir $(@))\n"
$(OBJCOPY_bootblock) $(preserve-bss-flags) $< $@

ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
$(objcbfs)/bootblock_b.raw.elf: $(objcbfs)/bootblock_b.elf
@printf " OBJCOPY $(notdir $(@))\n"
$(OBJCOPY_bootblock_b) $(preserve-bss-flags) $< $@
endif

endif # CONFIG_COMPRESS_BOOTBLOCK

$(objcbfs)/bootblock.raw.bin: $(objcbfs)/bootblock.raw.elf
@printf " OBJCOPY $(notdir $(@))\n"
$(OBJCOPY_bootblock) -O binary $< $@

ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
$(objcbfs)/bootblock_b.raw.bin: $(objcbfs)/bootblock_b.raw.elf
@printf " OBJCOPY $(notdir $(@))\n"
$(OBJCOPY_bootblock_b) -O binary $< $@
endif

ifneq ($(CONFIG_HAVE_BOOTBLOCK),y)
$(objcbfs)/bootblock.bin:
dd if=/dev/zero of=$@ bs=64 count=1
ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
$(objcbfs)/bootblock_b.bin:
dd if=/dev/zero of=$@ bs=64 count=1
endif
endif

$(objcbfs)/%.bin: $(objcbfs)/%.raw.bin
cp $< $@

ifeq ($(CONFIG_REDUNDANT_BOOTBLOCK),y)
# If not building slot-specific variants, Slot B is a copy of Slot A
ifeq ($(CONFIG_BOOTBLOCK_SLOT_VARIANTS),)
$(objcbfs)/bootblock_b.bin: $(objcbfs)/bootblock.bin
cp $< $@
endif
endif

$(objcbfs)/%.map: $(objcbfs)/%.debug
$(eval class := $(call find-class,$(@F)))
$(NM_$(class)) -n $< | sort > $(basename $@).map
Expand Down Expand Up @@ -1301,10 +1347,28 @@ endif
$(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
$(obj)/coreboot.pre: $$(prebuilt-files) $(CBFSTOOL) $(obj)/fmap.fmap $(obj)/fmap.desc $(objcbfs)/bootblock.bin \
$(if $(CONFIG_REDUNDANT_BOOTBLOCK),$(objcbfs)/bootblock_b.bin)
$(CBFSTOOL) [email protected] create -M $(obj)/fmap.fmap -r $(shell cat $(obj)/fmap.desc)
ifneq ($(CONFIG_REDUNDANT_BOOTBLOCK),)
printf " BOOTBLOCK (Slot A)\n"
$(CBFSTOOL) [email protected] add -r BOOTBLOCK \
-f $(objcbfs)/bootblock.bin \
-n bootblock -t bootblock \
-b -$(call file-size,$(objcbfs)/bootblock.bin) \
$(TXTIBB) $(cbfs-autogen-attributes) $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS)
else
printf " BOOTBLOCK\n"
$(call add_bootblock,[email protected],$(objcbfs)/bootblock.bin)
endif
ifneq ($(CONFIG_REDUNDANT_BOOTBLOCK),)
printf " TOPSWAP BB\n"
$(CBFSTOOL) [email protected] add -r TOPSWAP \
-f $(objcbfs)/bootblock_b.bin \
-n bootblock -t bootblock \
-b -$(call file-size,$(objcbfs)/bootblock_b.bin) \
$(TXTIBB) $(cbfs-autogen-attributes) $(TS_OPTIONS) $(CBFSTOOL_ADD_CMD_OPTIONS)
endif
$(prebuild-files) true
mv [email protected] $@
else # ifneq ($(CONFIG_UPDATE_IMAGE),y)
Expand Down
5 changes: 1 addition & 4 deletions configs/config.protectli_vp66xx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
CONFIG_LOCALVERSION="v0.9.3-rc1"
CONFIG_OPTION_BACKEND_NONE=y
CONFIG_VENDOR_PROTECTLI=y
CONFIG_VBOOT=y
CONFIG_PCIEXP_L1_SUB_STATE=y
CONFIG_PCIEXP_CLK_PM=y
CONFIG_IFD_BIN_PATH="3rdparty/dasharo-blobs/$(MAINBOARDDIR)/descriptor.bin"
CONFIG_ME_BIN_PATH="3rdparty/dasharo-blobs/$(MAINBOARDDIR)/me.bin"
CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x100000
CONFIG_EDK2_BOOT_TIMEOUT=6
CONFIG_HAVE_IFD_BIN=y
CONFIG_TPM_MEASURED_BOOT=y
CONFIG_BOARD_PROTECTLI_VP66XX=y
CONFIG_EDK2_BOOTSPLASH_FILE="$(top)/3rdparty/dasharo-blobs/protectli/black_background.bmp"
CONFIG_POWER_STATE_OFF_AFTER_FAILURE=y
Expand All @@ -33,8 +31,6 @@ CONFIG_BOOTMEDIA_LOCK_CONTROLLER=y
CONFIG_BOOTMEDIA_LOCK_WPRO_VBOOT_RO=y
CONFIG_BOOTMEDIA_LOCK_IN_VERSTAGE=y
CONFIG_BOOTMEDIA_SMM_BWP=y
CONFIG_DEFAULT_CONSOLE_LOGLEVEL_0=y
# CONFIG_CONSOLE_USE_LOGLEVEL_PREFIX is not set
# CONFIG_CONSOLE_USE_ANSI_ESCAPES is not set
CONFIG_POST_DEVICE_LPC=y
CONFIG_PAYLOAD_EDK2=y
Expand Down Expand Up @@ -75,3 +71,4 @@ CONFIG_EDK2_DISABLE_OPTION_ROMS=y
CONFIG_EDK2_CREATE_PREINSTALLED_BOOT_OPTIONS=y
# CONFIG_EDK2_GRAPHICAL_CAPSULE_PROGRESS is not set
# CONFIG_EDK2_FUM_AUTO_IPXE_BOOT is not set
CONFIG_REDUNDANT_BOOTBLOCK=y
17 changes: 17 additions & 0 deletions src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ config CCACHE

For details see https://ccache.samba.org.

config REDUNDANT_BOOTBLOCK
bool "Build redundant bootblock (Slot A + Slot B)"
default y
help
Build two bootblock binaries and place them into FMAP regions
BOOTBLOCK (Slot A) and TOPSWAP (Slot B). Required for Intel Top Swap
based redundancy. Logic to choose a slot is out of scope here.

config BOOTBLOCK_SLOT_VARIANTS
bool "Compile bootblock per-slot with distinct defines"
depends on REDUNDANT_BOOTBLOCK
default n
help
If enabled, bootblock for Slot A and Slot B is compiled separately with
-DSLOT_A or -DSLOT_B so later slot-specific logic can be added.
If disabled, Slot B is a byte-for-byte copy of Slot A.

config LTO
bool "Use link time optimization (LTO) (experimental)"
default n
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/protectli/vault_adl_p/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ config SOC_INTEL_CSE_SEND_EOP_EARLY
default n

config FMDFILE
default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/vboot-rwa.fmd" if VBOOT && VBOOT_SLOTS_RW_A
default "src/mainboard/\$(CONFIG_MAINBOARD_DIR)/vboot-rwa.fmd"

config BEEP_ON_BOOT
bool "Beep on successful boot"
Expand Down
16 changes: 15 additions & 1 deletion src/mainboard/protectli/vault_adl_p/vboot-rwa.fmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
FLASH@0xff000000 16M {

# ---- Static (vendor / Intel) areas ----
SI_ALL@0x0 {
SI_DESC 4K
SI_ME 0x4c0000
SI_DEVICEEXT2 0xbf000
}

# ---- BIOS region ----
SI_BIOS@0x580000 0xa80000 {

# --- Preserved runtime data ---
SMMSTORE(PRESERVE) 256K

RW_MISC 320K {
Expand All @@ -18,21 +24,29 @@ FLASH@0xff000000 16M {

BOOTSPLASH(CBFS) 512K

# --- Main firmware Slot A ---
RW_SECTION_A {
VBLOCK_A 64K
FW_MAIN_A(CBFS)
RW_FWID_A 0x100
}

# --- Read-only / protected section ---
WP_RO 5M {
RO_VPD(PRESERVE) 16K
RO_SECTION {
FMAP 2K
RO_FRID 0x100
RO_FRID_PAD 0x700
GBB 12K
COREBOOT(CBFS)
COREBOOT(CBFS) # Slot A bootblock + main CBFS
}
}

# --- Redundant Slot B / top-swap area ---
TOPSWAP(CBFS) 512K # Slot B CBFS region for redundant bootblock
BOOTBLOCK(CBFS) 512K # Optionally separate block, mirrors Slot A

}
}

Loading