summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--Makefile.rules2
-rw-r--r--baseboard/kukui/build.mk3
-rw-r--r--board/flapjack/build.mk3
-rw-r--r--common/build.mk20
5 files changed, 27 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 41e87a173b..11dc09bcb7 100644
--- a/Makefile
+++ b/Makefile
@@ -60,10 +60,6 @@ config=$(out)/.config
# If no key file is provided, use the default dev key
PEM ?= $(BDIR)/dev_key.pem
-# If CONFIG_BOOTBLOCK is set, includes AP-FW bootblock in the EC image.
-# If no bootblock is provided, just pack an empty file.
-BOOTBLOCK ?=
-
# Port for flash_ec. Defaults to 9999.
PORT ?= 9999
diff --git a/Makefile.rules b/Makefile.rules
index 1bdf99e2af..38a480f50e 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -123,7 +123,7 @@ cmd_tp_hash = $(out)/util/gen_touchpad_hash \
$(if $(TOUCHPAD_FW),-f $(TOUCHPAD_FW)) -o $@
cmd_emmc_bootblock = $(out)/util/gen_emmc_transfer_data \
- $(if $(BOOTBLOCK),-i $(BOOTBLOCK)) -o $@
+ -i $(BOOTBLOCK) -o $@
cmd_ipi_table = $(out)/util/gen_ipi_table $@
cmd_cp_script = cp "$<" "$@" && chmod +x "$@"
diff --git a/baseboard/kukui/build.mk b/baseboard/kukui/build.mk
index cd0b5a7353..ab62483bc7 100644
--- a/baseboard/kukui/build.mk
+++ b/baseboard/kukui/build.mk
@@ -19,3 +19,6 @@ baseboard-$(VARIANT_KUKUI_CHARGER_MT6370)+=charger_mt6370.o
baseboard-$(VARIANT_KUKUI_POGO_KEYBOARD)+=base_detect_kukui.o
$(out)/RO/baseboard/$(BASEBOARD)/emmc.o: $(out)/bootblock_data.h
+
+# bootblock size from 12769.0
+DEFAULT_BOOTBLOCK_SIZE:=21504
diff --git a/board/flapjack/build.mk b/board/flapjack/build.mk
index 5c408de94a..a368c187bf 100644
--- a/board/flapjack/build.mk
+++ b/board/flapjack/build.mk
@@ -16,3 +16,6 @@ board-$(CONFIG_BOOTBLOCK)+=emmc.o
board-$(BOARD_KRANE)+=base_detect_krane.o
$(out)/RO/board/$(BOARD)/emmc.o: $(out)/bootblock_data.h
+
+# 21504 bytes plus some extra buffer
+DEFAULT_BOOTBLOCK_SIZE:=23000
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.