aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSebastian Kemper <sebastian_ml@gmx.net>2018-12-01 19:13:50 +0100
committerChristian Lamparter <chunkeey@gmail.com>2018-12-17 00:21:34 +0100
commit247fdceab6caa1d3bc29ca629833a2f705eb9d59 (patch)
treeb749d0435937830cfea77183242e40fb7715e17c /include
parent2630aae36fc2628647c349fc680c7b595fd73e4f (diff)
downloadupstream-247fdceab6caa1d3bc29ca629833a2f705eb9d59.tar.gz
upstream-247fdceab6caa1d3bc29ca629833a2f705eb9d59.tar.bz2
upstream-247fdceab6caa1d3bc29ca629833a2f705eb9d59.zip
image: add cameo-factory command
This command enables factory image generation for Cameo boards. On upgrade the vendor firmware will check the size of the provided image and if a specific string is located at the end of the binary. cameo-factory will generate an image that the vendor firmware accepts. Tested on a D-Link DIR-825 C1 with vendor firmwares 3.01 and 3.04. Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
Diffstat (limited to 'include')
-rw-r--r--include/image-commands.mk12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk
index ac724d20ac..63539bad08 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -44,6 +44,18 @@ define Build/buffalo-dhp-image
mv $@.new $@
endef
+# blow up binary to given size and put a given string at its end:
+# cameo-factory <size[k]> <string>
+define Build/cameo-factory
+ factory_stamp=$(word 2,$(1)); \
+ ((reduced_size=$(subst k,*1024,$(word 1,$(1)))-$${#factory_stamp})); \
+ ( \
+ dd if=$@ bs=$$reduced_size conv=sync; \
+ echo -n $$factory_stamp; \
+ ) > $@.new && \
+ mv $@.new $@
+endef
+
define Build/eva-image
$(STAGING_DIR_HOST)/bin/lzma2eva $(KERNEL_LOADADDR) $(KERNEL_LOADADDR) $@ $@.new
mv $@.new $@