summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIcarus Sparry <icarus.w.sparry@intel.com>2015-02-28 16:24:06 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-13 01:52:32 +0000
commit44fc1c686b3c20c2d4085ddbec80679d1c799821 (patch)
tree559574e880f5bd503de774d5cfdc768bf6ef2598
parentd0ba9ff7ed7588b586b2aab27f1544b3bc9edf81 (diff)
downloadchrome-ec-44fc1c686b3c20c2d4085ddbec80679d1c799821.tar.gz
Change ec.bin generation
Previously for the mec1322 chip an ec.bin file was created in the normal way and then it was "packed" in a post-processing stage to produce ec.spi.bin. This packing added digital signatures and another loader stage. This change allows a chip or board build.mk file to specify the rules used to produce ec.bin, and uses this for the mec1322 to do the packing. This means that we use the standard "ec.bin" name, and do not need to alter other scripts, such as the script which creates chromeos-firmwareupdate. BUG=None BRANCH=NONE TEST=buildall -j, flash on strago and see it still works. Change-Id: I3f880d64e60d14f82cb1d21c8b3f2d4ae5e0dfef Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com> Reviewed-on: https://chromium-review.googlesource.com/259180 Tested-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Kevin K Wong <kevin.k.wong@intel.com>
-rw-r--r--Makefile.rules7
-rw-r--r--board/glower/build.mk3
-rw-r--r--board/strago/build.mk4
-rwxr-xr-xchip/mec1322/build.mk18
4 files changed, 11 insertions, 21 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 4dd8b8a723..88fee33ed9 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -36,7 +36,8 @@ silent_err = $(if $(V),,2>/dev/null)
cmd_lds = $(CPP) -P -C -MMD -MF $@.d -MT $@ $(CPPFLAGS) \
-D$(call section_is,$*) \
-DSECTION=$(call section,$*) $< -o $@
-cmd_obj_to_bin = $(OBJCOPY) --gap-fill=0xff -O binary $^ $(out)/$*.bin.tmp
+# Allow obj_to_bin to be overridden by board or chip specific commands
+cmd_obj_to_bin ?= $(OBJCOPY) --gap-fill=0xff -O binary $^ $(out)/$*.bin.tmp
cmd_flat_to_obj = $(CC) -T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \
-Wl,--build-id=none -o $@ $<
cmd_elf_to_flat = $(OBJCOPY) -O binary $^ $@
@@ -156,10 +157,6 @@ $(out)/%.bin: $(out)/%.obj
$(call quiet,copyrw-y,COPY_RW))
$(call quiet,mv_from_tmp,MV )
-# Beware of ec.spi.spi.bin.
-$(out)/%.spi.bin: $(out)/%.bin
- $(call quiet,pack_package,PACK )
-
flat-y = $(out)/$(PROJECT).RW.flat
flat-$(CONFIG_FW_INCLUDE_RO) += $(out)/$(PROJECT).RO.flat
diff --git a/board/glower/build.mk b/board/glower/build.mk
index 5019d5e909..e28777724e 100644
--- a/board/glower/build.mk
+++ b/board/glower/build.mk
@@ -11,6 +11,3 @@ CHIP:=mec1322
CHIP_SPI_SIZE_KB:=512
board-y=board.o
-# As this file is read more than once, must put the rules
-# elsewhere (Makefile.rules) and just use variable to trigger them
-PROJECT_EXTRA+=${out}/ec.spi.bin
diff --git a/board/strago/build.mk b/board/strago/build.mk
index 23c88a95a9..1960ff993c 100644
--- a/board/strago/build.mk
+++ b/board/strago/build.mk
@@ -12,7 +12,3 @@ CHIP_SPI_SIZE_KB:=4096
board-y=board.o
board-$(CONFIG_BATTERY_SMART)+=battery.o
-
-# As this file is read more than once, must put the rules
-# elsewhere (Makefile.rules) and just use variable to trigger them
-PROJECT_EXTRA+=${out}/ec.spi.bin
diff --git a/chip/mec1322/build.mk b/chip/mec1322/build.mk
index 50d4e5e243..98907cbae6 100755
--- a/chip/mec1322/build.mk
+++ b/chip/mec1322/build.mk
@@ -23,16 +23,16 @@ chip-$(HAS_TASK_KEYSCAN)+=keyboard_raw.o
chip-$(CONFIG_DMA)+=dma.o
chip-$(CONFIG_SPI)+=spi.o
-
# location of the scripts and keys used to pack the SPI flash image
SCRIPTDIR:=./chip/${CHIP}/util
-# commands to package something
-cmd_pack_package = ${SCRIPTDIR}/pack_ec.py -o $@ -i $^ \
- --payload_key ${SCRIPTDIR}/rsakey_sign_payload.pem \
- --header_key ${SCRIPTDIR}/rsakey_sign_header.pem \
- --loader_file ${SCRIPTDIR}/ecloader.bin \
- --spi_size ${CHIP_SPI_SIZE_KB}
+# Allow SPI size to be overridden by board specific size, default to 256KB.
+CHIP_SPI_SIZE_KB?=256
-cmd_bin_to_mec1322_spi = \
- ./chip/mec1322/util/pack_ec.py $(MEC1322_PACK_EC_FLAG)
+# Command to convert $^ to $@.tmp
+cmd_obj_to_bin = $(OBJCOPY) --gap-fill=0xff -O binary $^ $@.tmp1 ; \
+ ${SCRIPTDIR}/pack_ec.py -o $@.tmp -i $@.tmp1 \
+ --loader_file ${SCRIPTDIR}/ecloader.bin \
+ --payload_key ${SCRIPTDIR}/rsakey_sign_payload.pem \
+ --header_key ${SCRIPTDIR}/rsakey_sign_header.pem \
+ --spi_size=${CHIP_SPI_SIZE_KB} ; rm -f $@.tmp1