summaryrefslogtreecommitdiff
path: root/include/image-commands.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-11-14 17:31:53 +0100
committerFelix Fietkau <nbd@nbd.name>2016-11-19 11:24:10 +0100
commit77265e00c70a7f6c01d2bc68c3a41de34b18deb3 (patch)
tree417d3e7546724e3ddb8f38855e37ba639afbffd8 /include/image-commands.mk
parentcc853810a4aae04f1afcad3439bf9db6fc1f4852 (diff)
downloadmtk-20170518-77265e00c70a7f6c01d2bc68c3a41de34b18deb3.zip
mtk-20170518-77265e00c70a7f6c01d2bc68c3a41de34b18deb3.tar.gz
mtk-20170518-77265e00c70a7f6c01d2bc68c3a41de34b18deb3.tar.bz2
build: add support code for appending metadata to images
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'include/image-commands.mk')
-rw-r--r--include/image-commands.mk18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/image-commands.mk b/include/image-commands.mk
index 6386e55..083a389 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -172,3 +172,21 @@ define Build/sysupgrade-tar
--rootfs $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \
$@
endef
+
+json_quote=$(subst ','\'',$(subst ",\",$(1)))
+#")')
+metadata_devices=$(if $(1),$(subst "$(space)","$(comma)",$(strip $(foreach v,$(1),"$(call json_quote,$(v))"))))
+metadata_json = \
+ '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
+ "supported_devices":[$(call metadata_devices,$(1))], \
+ "version": { \
+ "dist": "$(call json_quote,$(VERSION_DIST))", \
+ "version": "$(call json_quote,$(VERSION_NUMBER))", \
+ "revision": "$(call json_quote,$(REVISION))", \
+ "board": "$(call json_quote,$(BOARD))" \
+ } \
+ }'
+
+define Build/append-metadata
+ $(if $(SUPPORTED_DEVICES),echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
+endef