aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYanase Yuki <dev@zpc.sakura.ne.jp>2020-11-05 19:59:06 +0900
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2021-02-05 21:57:19 +0100
commitd468ff97b71994d5f30751fdd22c530c85a52f42 (patch)
treef9b71d436dfe231e68de29db26ae1bfc0c56101d /include
parent321035420cb7c5bb5fd53879824d2886a6f288e8 (diff)
downloadupstream-d468ff97b71994d5f30751fdd22c530c85a52f42.tar.gz
upstream-d468ff97b71994d5f30751fdd22c530c85a52f42.tar.bz2
upstream-d468ff97b71994d5f30751fdd22c530c85a52f42.zip
build: move elx-header into image-commands.mk
ELECOM WAB-I1750-PS will need this in ath79, so move it to common Makefile. Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Diffstat (limited to 'include')
-rw-r--r--include/image-commands.mk20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 07a96920ae..c3f8b4b95a 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -167,6 +167,26 @@ define Build/elecom-product-header
mv $(fw).new $(fw)
endef
+define Build/elx-header
+ $(eval hw_id=$(word 1,$(1)))
+ $(eval xor_pattern=$(word 2,$(1)))
+ ( \
+ echo -ne "\x00\x00\x00\x00\x00\x00\x00\x03" | \
+ dd bs=42 count=1 conv=sync; \
+ hw_id="$(hw_id)"; \
+ echo -ne "\x$${hw_id:0:2}\x$${hw_id:2:2}\x$${hw_id:4:2}\x$${hw_id:6:2}" | \
+ dd bs=20 count=1 conv=sync; \
+ echo -ne "$$(printf '%08x' $$(stat -c%s $@) | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
+ dd bs=8 count=1 conv=sync; \
+ echo -ne "$$($(STAGING_DIR_HOST)/bin/mkhash md5 $@ | fold -s2 | xargs -I {} echo \\x{} | tr -d '\n')" | \
+ dd bs=58 count=1 conv=sync; \
+ ) > $(KDIR)/tmp/$(DEVICE_NAME).header
+ $(call Build/xor-image,-p $(xor_pattern) -x)
+ cat $(KDIR)/tmp/$(DEVICE_NAME).header $@ > $@.new
+ mv $@.new $@
+ rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header
+endef
+
define Build/eva-image
$(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new
mv $@.new $@