summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--Makefile.rules4
l---------board/strago/Makefile1
-rw-r--r--board/strago/build.mk4
-rw-r--r--chip/mec1322/build.mk9
5 files changed, 24 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 321823a5d5..13c44d8b76 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,10 @@ PEM ?= board/$(BOARD)/dev_key.pem
include Makefile.toolchain
-all: $(out)/$(PROJECT).bin utils
+# Define the traditional first target. The dependencies of this are near the bottom
+# as they can be altered by chip and board files.
+all:
+.PHONY: all
# The board makefile sets $CHIP and the chip makefile sets $CORE.
# Include those now, since they must be defined for _flag_cfg below.
@@ -128,6 +131,8 @@ all-y+=$(call objs_from_dir,test,$(PROJECT))
dirs=core/$(CORE) chip/$(CHIP) board/$(BOARD) private common power test util
dirs+=$(shell find driver -type d)
+all: $(out)/$(PROJECT).bin utils ${PROJECT_EXTRA}
+
include Makefile.rules
endif # SYMLINK
diff --git a/Makefile.rules b/Makefile.rules
index 3a1b415ad3..2c6cd7b4cd 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -151,6 +151,10 @@ $(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).RO.flat $(out)/$(PROJECT).RW.flat
$(out)/%.obj: common/firmware_image.S $(out)/firmware_image.lds $(flat-y)
diff --git a/board/strago/Makefile b/board/strago/Makefile
new file mode 120000
index 0000000000..94aaae2c4d
--- /dev/null
+++ b/board/strago/Makefile
@@ -0,0 +1 @@
+../../Makefile \ No newline at end of file
diff --git a/board/strago/build.mk b/board/strago/build.mk
index 91ce24af42..4a0bc00f08 100644
--- a/board/strago/build.mk
+++ b/board/strago/build.mk
@@ -8,5 +8,9 @@
# the IC is SMSC MEC1322 / external SPI is 4MB / external clock is crystal
CHIP:=mec1322
+CHIP_SPI_SIZE_MB:=4
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/chip/mec1322/build.mk b/chip/mec1322/build.mk
index 7b1444dc6e..0c6284c420 100644
--- a/chip/mec1322/build.mk
+++ b/chip/mec1322/build.mk
@@ -22,3 +22,12 @@ chip-$(CONFIG_WATCHDOG)+=watchdog.o
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 \
+ --spi_size ${CHIP_SPI_SIZE_MB}