build: move elx-header into image-commands.mk
authorYanase Yuki <dev@zpc.sakura.ne.jp>
Thu, 5 Nov 2020 10:59:06 +0000 (19:59 +0900)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Fri, 5 Feb 2021 20:57:19 +0000 (21:57 +0100)
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>
include/image-commands.mk
target/linux/ramips/image/Makefile

index 07a96920aee4fdfbb7103b797f67469abbb6011c..c3f8b4b95a30eeecc4ff90892506f85100933ab9 100644 (file)
@@ -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 $@
index 2fb13dcf08dd1786d1b9d40f5b1fdbb7a9c75e56..21bd135a62617740117c9b934c7c2dc1dc23800d 100644 (file)
@@ -35,26 +35,6 @@ define Build/edimax-header
        @mv $@.new $@
 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/jcg-header
        $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \
                $(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \