summaryrefslogtreecommitdiff
path: root/common/build.mk
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-12-18 12:19:29 +0800
committerCommit Bot <commit-bot@chromium.org>2019-12-19 23:47:27 +0000
commitd4e9357a4923a43a92d04433fcdd04caf797ea49 (patch)
treebbdbe888baf1df4983858a2150c226a9ef267169 /common/build.mk
parentd908467173042943558bf5c03662cae5bf7c5210 (diff)
downloadchrome-ec-d4e9357a4923a43a92d04433fcdd04caf797ea49.tar.gz
kukui: include a dummy bootblock if BOOTBLOCK variable not set
Add a dummy bootblock to make sure size check is accurate during `make buildall`. The default size is picked from build 12769.0: $ ls -al */coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:20 kodama/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:20 krane/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:20 kukui/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 damu/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 jacuzzi/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 juniper/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:33 kappa/coreboot/bootblock.bin -rw-r--r-- 1 21504 Dec 19 02:21 flapjack/coreboot/bootblock.bin BUG=chromium:1034518 TEST=1) make buildall # use dummy bootblock 2) make BOARD=kukui # same as above, ~1.7k bytes left 3) make BOARD=kukui BOOTBLOCK=/dev/null # empty bootblock, 23k bytes left 4) make BOARD=kukui BOOTBLOCK=a-large-file # fail early before linking BRANCH=kukui Change-Id: I65c18f567dce0cb315e0cdc4f30ada5e83275d72 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1973550 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common/build.mk')
-rw-r--r--common/build.mk20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/build.mk b/common/build.mk
index 51ced0ae42..5ac14389ce 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -192,6 +192,26 @@ $(out)/RW/common/aes-gcm.o: CFLAGS+=-std=c99 -Wno-declaration-after-statement
$(out)/RO/common/aes-gcm.o: CFLAGS+=-std=c99 -Wno-declaration-after-statement
ifneq ($(CONFIG_BOOTBLOCK),)
+
+ifdef BOOTBLOCK
+
+# verify the file size is less than or equal to DEFAULT_BOOTBLOCK_SIZE
+$(shell test `stat -c "%s" "$(BOOTBLOCK)"` -le "$(DEFAULT_BOOTBLOCK_SIZE)")
+ifneq ($(.SHELLSTATUS),0)
+$(error bootblock $(BOOTBLOCK) larger than $(DEFAULT_BOOTBLOCK_SIZE) bytes)
+endif
+
+else
+
+# generate a dummy bootblock file
+BOOTBLOCK := $(out)/.dummy-bootblock
+
+.PHONY: $(out)/.dummy-bootblock
+$(out)/.dummy-bootblock:
+ @dd if=/dev/zero of=$@ bs=1 count=$(DEFAULT_BOOTBLOCK_SIZE) status=none
+
+endif # BOOTBLOCK
+
build-util-bin += gen_emmc_transfer_data
# Bootblock is only packed in RO image.