From 07bb39c104a4515b8a25c067c77ff5d6fbed9ca2 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Wed, 13 Jul 2022 10:34:49 +0800 Subject: [PATCH] image: add "append-gl-metadata" Signed-off-by: Jianhui Zhao --- include/image-commands.mk | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/image-commands.mk b/include/image-commands.mk index 8d77d5dc80..585a734bfb 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -64,6 +64,37 @@ define Build/append-metadata } endef +metadata_gl_json = \ + '{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \ + "metadata_version": "1.1", \ + "compat_version": "$(call json_quote,$(compat_version))", \ + $(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \ + $(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \ + [$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \ + "supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \ + $(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \ + "version": { \ + "release": "$(shell cat $(TOPDIR)/release)", \ + "date": "$(shell TZ='Asia/Chongqing' date '+%Y%m%d%H%M%S')", \ + "dist": "$(call json_quote,$(VERSION_DIST))", \ + "version": "$(call json_quote,$(VERSION_NUMBER))", \ + "firmware_type": "$(shell cat $(TOPDIR)/files/etc/version.type)", \ + "revision": "$(call json_quote,$(REVISION))", \ + "target": "$(call json_quote,$(TARGETID))", \ + "board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \ + }, \ + "upgrade_control":"$(shell python3 $(TOPDIR)/make_gl_metadata.py)", \ + "release_note":"$(shell sed ':a;N;s/\n/\\n/g;s/\r/\\r/g;ta' $(TOPDIR)/gl_release_note)" \ + }' + +define Build/append-gl-metadata + $(if $(SUPPORTED_DEVICES),-echo $(call metadata_gl_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@) + [ ! -s "$(BUILD_KEY)" -o ! -s "$@" ] || { \ + usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\ + fwtool -S "$@.sig" "$@" ;\ + } +endef + define Build/append-rootfs dd if=$(IMAGE_ROOTFS) >> $@ endef -- 2.25.1