aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/image/Makefile
diff options
context:
space:
mode:
authorINAGAKI Hiroshi <musashino.open@gmail.com>2019-08-19 21:38:24 +0900
committerChuanhong Guo <gch981213@gmail.com>2019-09-25 14:44:36 +0800
commitc1394dabf6547dbc25e9563ef980aed9589479ab (patch)
tree8dadd2cacb31a45acd4e8832a60730f6126352d3 /target/linux/ramips/image/Makefile
parent6c3ae072dce1fc42224fc291e6eae2bd0008fb64 (diff)
downloadupstream-c1394dabf6547dbc25e9563ef980aed9589479ab.tar.gz
upstream-c1394dabf6547dbc25e9563ef980aed9589479ab.tar.bz2
upstream-c1394dabf6547dbc25e9563ef980aed9589479ab.zip
ramips: move "elx-header" to Makefile from mt7620.mk and mt7621.mk
I-O DATA WNPR2600G has an "elx-header", so move this definition to generic makefile to use it from mt7621 subtarget. This definition is also added to mt7621.mk in f285e8634c57d28aa970b80c5c59e85485f35c7d, so remove it from mt7621.mk. And added a line to cleanup used header file. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Diffstat (limited to 'target/linux/ramips/image/Makefile')
-rw-r--r--target/linux/ramips/image/Makefile20
1 files changed, 20 insertions, 0 deletions
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 816146ece5..16748b8260 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -89,6 +89,26 @@ define Build/relocate-kernel
rm -rf $@.relocate
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/umedia-header
fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
endef