aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorINAGAKI Hiroshi <musashino.open@gmail.com>2020-12-11 23:14:03 +0900
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2021-01-29 15:28:12 +0100
commit0071c7cd8246197ae27d8a0c4b5bdf7976dbe362 (patch)
treedf553b0040a92c2524fb17a325cf58bdc456f3f5
parent396a35dd51f1d58c051d0c1f1100e44950933d3b (diff)
downloadupstream-0071c7cd8246197ae27d8a0c4b5bdf7976dbe362.tar.gz
upstream-0071c7cd8246197ae27d8a0c4b5bdf7976dbe362.tar.bz2
upstream-0071c7cd8246197ae27d8a0c4b5bdf7976dbe362.zip
build: add elecom-product-header for ELECOM devices
A header used in ELECOM WRC-300GHBK2-I and WRC-1750GHBK2-I/C is also used in ELECOM WRC-2533GHBK-I, so split the code to generate the header and move it to image-commands.mk to use from ramips target. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> Reviewed-by: Sungbo Eo <mans0n@gorani.run>
-rw-r--r--include/image-commands.mk12
-rw-r--r--target/linux/ath79/image/generic.mk10
2 files changed, 15 insertions, 7 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 3beec80c8b..70fa0b8357 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -155,6 +155,18 @@ define Build/check-size
}
endef
+define Build/elecom-product-header
+ $(eval product=$(word 1,$(1)))
+ $(eval fw=$(word 2,$(1)))
+
+ ( \
+ echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
+ echo -n "0.00" | dd bs=16 count=1 conv=sync; \
+ dd if=$(fw); \
+ ) > $(fw).new
+ mv $(fw).new $(fw)
+endef
+
define Build/eva-image
$(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new
mv $@.new $@
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 7432607fcd..c43d396db5 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -19,14 +19,10 @@ define Build/add-elecom-factory-initramfs
-f 0x70000 -S 0x01100000 \
-i $@ -o $@.factory
- ( \
- echo -n -e "ELECOM\x00\x00$(product)" | dd bs=40 count=1 conv=sync; \
- echo -n "0.00" | dd bs=16 count=1 conv=sync; \
- dd if=$@.factory; \
- ) > $@.factory.new
+ $(call Build/elecom-product-header,$(product) $@.factory)
- if [ "$$(stat -c%s $@.factory.new)" -le $$(($(subst k,* 1024,$(subst m, * 1024k,$(IMAGE_SIZE))))) ]; then \
- mv $@.factory.new $(BIN_DIR)/$(KERNEL_INITRAMFS_PREFIX)-factory.bin; \
+ if [ "$$(stat -c%s $@.factory)" -le $$(($(subst k,* 1024,$(subst m, * 1024k,$(IMAGE_SIZE))))) ]; then \
+ mv $@.factory $(BIN_DIR)/$(KERNEL_INITRAMFS_PREFIX)-factory.bin; \
else \
echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \
fi