openvpn: reduce binary size using --gc-sections on linking
[openwrt/staging/blogic.git] / include / image-commands.mk
index 6386e55b7958b36945385e84a519f0cb1a59c764..083a3890316c633e9a1ffaab6bd7790ebb29ea34 100644 (file)
@@ -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