Daisuke Nojiri (dnojiri@chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16747
-gerrit
commit 2919c3fa0ffd5b1e9bae980a3c5c919dfe404d12 Author: Daisuke Nojiri dnojiri@chromium.org Date: Fri Sep 23 17:40:15 2016 -0700
rotor: Compose BOOTBLOCK region
This patch adds a Makefile rule for mvmap2315 to install a BDB and bootblock code in the BOOTBLOCK region.
BUG=chrome-os-partner:51907 BRANCH=none TEST=emerge-rotor coreboot and examined the output binary
Change-Id: I1e20a09b12f8f8ed4d095aa588e3eb930f359fc5 Signed-off-by: Daisuke Nojiri dnojiri@chromium.org --- src/soc/marvell/mvmap2315/Makefile.inc | 56 +++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-)
diff --git a/src/soc/marvell/mvmap2315/Makefile.inc b/src/soc/marvell/mvmap2315/Makefile.inc index d30ab68..d215552 100644 --- a/src/soc/marvell/mvmap2315/Makefile.inc +++ b/src/soc/marvell/mvmap2315/Makefile.inc @@ -63,4 +63,58 @@ romstage-y += wdt.c
CPPFLAGS_common += -Isrc/soc/marvell/mvmap2315/include/
-endif +# Common Boot Flow parameters +KEYDIR = $(VBOOT_SOURCE)/tests/testkeys +BOOTBLOCK_REGION_SIZE = 131072 +BOOTBLOCK_TYPE = -1 +BOOTBLOCK_PARTITION = -1 +BOOTBLOCK_LOAD_ADDRESS = -1 +BDB = $(obj)/bdb.bin + +# Calculate bootblock.raw.bin's size and offset +.PHONY: bootblock_offset +bootblock_offset: $(objcbfs)/bootblock.raw.bin + $(eval BOOTBLOCK_SIZE = $(call file-size, $<)) + $(eval BOOTBLOCK_OFFSET = $(call int-subtract, \ + $(BOOTBLOCK_REGION_SIZE) $(BOOTBLOCK_SIZE))) + +# Create a BDB +$(BDB): $(objcbfs)/bootblock.raw.bin $(FUTILITY) bootblock_offset \ + $(KEYDIR)/bdbkey.pem $(KEYDIR)/bdbkey.keyb \ + $(KEYDIR)/datakey.pem $(KEYDIR)/datakey.keyb + $(FUTILITY) bdb --create $@.tmp \ + --bdbkey_pri $(KEYDIR)/bdbkey.pem \ + --bdbkey_pub $(KEYDIR)/bdbkey.keyb \ + --datakey_pri $(KEYDIR)/datakey.pem \ + --datakey_pub $(KEYDIR)/datakey.keyb + $(FUTILITY) bdb --add $@.tmp \ + --data $< \ + --offset $(BOOTBLOCK_OFFSET) \ + --partition $(BOOTBLOCK_PARTITION) \ + --type $(BOOTBLOCK_TYPE) \ + --load_address $(BOOTBLOCK_LOAD_ADDRESS) + $(FUTILITY) bdb --resign $@.tmp \ + --datakey_pri $(KEYDIR)/datakey.pem + $(FUTILITY) bdb --verify $@.tmp \ + --key_digest $(VBOOT_SOURCE)/tests/testdata/bdbkey_digest.bin + mv $@.tmp $@ + +# Overrides generic pattern rule *.raw.bin -> *.bin for bootblock.bin +# +# bootblock.bin is structured as follows: +# +------------------+ +# | BDB | +# +------------------+ +# | 000............0 | +# +------------------+ +# |bootblock.raw.bin | +# +------------------+ +# And this will be placed in BOOTBLOCK region. +$(objcbfs)/bootblock.bin: $(objcbfs)/bootblock.raw.bin $(BDB) bootblock_offset + dd if=/dev/zero bs=1 count=$(BOOTBLOCK_REGION_SIZE) of=$@.tmp + dd if=$(BDB) bs=1 count=$(call file-size, $(BDB)) conv=notrunc of=$@.tmp + dd if=$(objcbfs)/bootblock.raw.bin bs=1 count=$(BOOTBLOCK_SIZE) \ + seek=$(BOOTBLOCK_OFFSET) conv=notrunc of=$@.tmp + mv $@.tmp $@ + +endif \ No newline at end of file