@@ -65,6 +65,11 @@ $(info **LOADAVG** (default: 1.5 times CPUS, e.g., 'make LOADAVG=54'))
6565$(info ** AVAILABLE_MEM_GB** (default : memory available on the system in GB, e.g., 'make AVAILABLE_MEM_GB=4'))
6666$(info ** MEM_PER_JOB_GB** (default : 1GB per job, e.g., 'make MEM_PER_JOB_GB=2'))
6767$(info ----------------------------------------------------------------------)
68+ ifeq "$(V ) " ""
69+ $(info Hint : If the build fails, re-run with V=1 for full configure + validation output)
70+ $(info Verbose example : ./docker_repro.sh make BOARD=$(BOARD ) V=1)
71+ $(info ----------------------------------------------------------------------)
72+ endif
6873$(info !!!!!! Build starts !!!!!!)
6974
7075
@@ -284,6 +289,34 @@ all payload:
284289 @sha256sum $< | tee -a " $( HASHES) "
285290 @stat -c " %8s:%n" $< | tee -a " $( SIZES) "
286291
292+ # Validate coreboot CBFS size against IFD BIOS region
293+ validate_cbfs_ifd :
294+ ifneq ($(CONFIG_COREBOOT ) ,)
295+ @echo "Validating $(BOARD) CBFS size against IFD BIOS region..."
296+ @$(pwd)/bin/validate_cbfs_ifd_fit.sh \
297+ --coreboot-dir "$(build)/$(coreboot_dir)" \
298+ --board-dir "$(build)/$(BOARD)" \
299+ --config "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" || exit 1
300+ @echo "✓ CBFS configuration is valid"
301+ else
302+ @echo "Board $(BOARD) does not use coreboot, skipping validation"
303+ endif
304+
305+ # Auto-fix coreboot CBFS size to match IFD BIOS region
306+ fix_cbfs_ifd :
307+ ifneq ($(CONFIG_COREBOOT ) ,)
308+ @echo "Auto-fixing $(BOARD) CBFS size to match IFD BIOS region..."
309+ @$(pwd)/bin/validate_cbfs_ifd_fit.sh \
310+ --coreboot-dir "$(build)/$(coreboot_dir)" \
311+ --board-dir "$(build)/$(BOARD)" \
312+ --config "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \
313+ --fix || exit 1
314+ @echo ""
315+ @echo "If CONFIG_CBFS_SIZE was adjusted, next build will use the new size."
316+ else
317+ @echo "Board $(BOARD) does not use coreboot, nothing to fix"
318+ endif
319+
287320# Disable all built in rules
288321.INTERMEDIATE :
289322.SUFFIXES :
@@ -902,11 +935,27 @@ modules.clean:
902935# PUBKEY_ASC.
903936inject_gpg : $(board_build ) /$(CB_OUTPUT_FILE_GPG_INJ )
904937
905- $(board_build ) /$(CB_OUTPUT_BASENAME ) -gpg-injected.rom : $(board_build ) /$(CB_OUTPUT_FILE )
906- cp " $( board_build) /$( CB_OUTPUT_FILE) " \
907- " $( board_build) /$( CB_OUTPUT_FILE_GPG_INJ) "
908- ./bin/inject_gpg_key.sh --cbfstool " $( build) /$( coreboot_dir) /cbfstool" \
909- " $( board_build) /$( CB_OUTPUT_FILE_GPG_INJ) " " $( PUBKEY_ASC) "
938+ $(board_build ) /$(CB_OUTPUT_BASENAME ) -gpg-injected.rom : $(board_build ) /$(CB_OUTPUT_FILE ) $(PUBKEY_ASC )
939+ @set -e; \
940+ src=" $( board_build) /$( CB_OUTPUT_FILE) " ; \
941+ tgt=" $( board_build) /$( CB_OUTPUT_FILE_GPG_INJ) " ; \
942+ key=" $( PUBKEY_ASC) " ; \
943+ meta=" $( board_build) /$( CB_OUTPUT_FILE_GPG_INJ) .meta" ; \
944+ if [ -f " $$ tgt" ] && [ -f " $$ meta" ]; then \
945+ SRC_SHA256=$$(awk -F= '/^SRC_SHA256=/{print $$2}' "$$meta" ) ; \
946+ KEY_SHA256=$$(awk -F= '/^KEY_SHA256=/{print $$2}' "$$meta" ) ; \
947+ src_sum=$$(sha256sum "$$src" | awk '{print $$1}' ) ; \
948+ key_sum=$$(sha256sum "$$key" | awk '{print $$1}' ) ; \
949+ if [ " $$ src_sum" = " $$ SRC_SHA256" ] && [ " $$ key_sum" = " $$ KEY_SHA256" ]; then \
950+ echo " GPG injection up-to-date; skipping" ; \
951+ exit 0; \
952+ fi ; \
953+ fi ; \
954+ cp " $$ src" " $$ tgt" ; \
955+ ./bin/inject_gpg_key.sh --cbfstool " $( build) /$( coreboot_dir) /cbfstool" " $$ tgt" " $$ key" ; \
956+ SRC_SHA256=$$(sha256sum "$$src" | awk '{print $$1}' ) ; \
957+ KEY_SHA256=$$(sha256sum "$$key" | awk '{print $$1}' ) ; \
958+ printf ' SRC_SHA256=%s\nKEY_SHA256=%s\n' " $$ SRC_SHA256" " $$ KEY_SHA256" > " $$ meta"
910959
911960
912961
0 commit comments