summaryrefslogtreecommitdiff
authorXindong Xu <xindong.xu@amlogic.com>2020-10-28 07:35:13 (GMT)
committer Xindong Xu <xindong.xu@amlogic.com>2020-10-30 09:12:22 (GMT)
commitc6443dfb5fa0c4993799926187907abdf2064d58 (patch)
treee6ddb9cf86f57b184e8a284e95fe85611e16ad4f
parent1f846592b65553fef1fd03b70f532ce8cde56be7 (diff)
downloadcommon-c6443dfb5fa0c4993799926187907abdf2064d58.zip
common-c6443dfb5fa0c4993799926187907abdf2064d58.tar.gz
common-c6443dfb5fa0c4993799926187907abdf2064d58.tar.bz2
recovery: write attestation id when OTA [1/3]
PD#SWPL-35388 Problem: need to write attestation id when OTA Solution: write attestation id when OTA Verify: deadpool Change-Id: Ic93d79344d96cde6392a9f4fa9a5ab39d130a2b0 Signed-off-by: Xindong Xu <xindong.xu@amlogic.com>
Diffstat
-rw-r--r--core_amlogic.mk2
-rw-r--r--factory.mk5
-rw-r--r--id_attestation.xml21
-rwxr-xr-xreleasetools.py13
4 files changed, 40 insertions, 1 deletions
diff --git a/core_amlogic.mk b/core_amlogic.mk
index 52916c1..70224d3 100644
--- a/core_amlogic.mk
+++ b/core_amlogic.mk
@@ -58,7 +58,7 @@ TARGET_RECOVERY_UI_LIB += \
ifneq ($(AB_OTA_UPDATER),true)
TARGET_RECOVERY_UPDATER_LIBS := libinstall_amlogic
-TARGET_RECOVERY_UPDATER_EXTRA_LIBS += libsystemcontrol_static libfdt
+TARGET_RECOVERY_UPDATER_EXTRA_LIBS += libsystemcontrol_static libfdt libtinyxml2
endif
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/factory.mk b/factory.mk
index 41f8f0a..29aa3b3 100644
--- a/factory.mk
+++ b/factory.mk
@@ -122,6 +122,11 @@ endif#ifeq ($(PRODUCT_BUILD_SECURE_BOOT_IMAGE_DIRECTLY),true)
INSTALLED_RADIOIMAGE_TARGET += $(PRODUCT_OUT)/super_empty_all.img
BOARD_PACK_RADIOIMAGES += super_empty_all.img
+ifeq ($(TARGET_UPDATE_IDATTESTATION),true)
+INSTALLED_RADIOIMAGE_TARGET += device/amlogic/common/id_attestation.xml
+BOARD_PACK_RADIOIMAGES += id_attestation.xml
+endif
+
BOARD_PACK_RADIOIMAGES += $(filter system.img vendor.img,$(BUILT_IMAGES))
UPGRADE_FILES := \
diff --git a/id_attestation.xml b/id_attestation.xml
new file mode 100644
index 0000000..591e48c
--- a/dev/null
+++ b/id_attestation.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ATTESTATION_ID>
+ <SERIAL>
+ <val>1234567890</val>
+ </SERIAL>
+ <BRAND>
+ <val>example</val>
+ </BRAND>
+ <DEVICE>
+ <val>example</val>
+ </DEVICE>
+ <PRODUCT>
+ <val>example</val>
+ </PRODUCT>
+ <MANUFACTURER>
+ <val>example</val>
+ </MANUFACTURER>
+ <MODEL>
+ <val>example</val>
+ </MODEL>
+</ATTESTATION_ID>
diff --git a/releasetools.py b/releasetools.py
index 1e17015..b7206bf 100755
--- a/releasetools.py
+++ b/releasetools.py
@@ -152,6 +152,14 @@ def FullOTA_Assertions(info):
else:
OPTIONS.ota_partition_change = True
common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img)
+ try:
+ attestation_file = info.input_zip.read("RADIO/id_attestation.xml")
+ except KeyError:
+ OPTIONS.ota_update_id_attestation = False
+ print "no id_attestation.xml in target_files; skipping install"
+ else:
+ OPTIONS.ota_update_id_attestation = True
+ common.ZipWriteStr(info.output_zip, "id_attestation.xml", attestation_file)
if OPTIONS.ota_zip_check:
info.script.AppendExtra('if ota_zip_check() == "1" then')
info.script.AppendExtra('ui_print("ota_zip_check() == 1");')
@@ -229,6 +237,11 @@ package_extract_file("vbmeta.img", "/dev/block/vbmeta");""")
info.script.AppendExtra('set_update_stage("0");')
info.script.AppendExtra('endif;')
+ if OPTIONS.ota_update_id_attestation:
+ info.script.AppendExtra('if write_id_attestation(package_extract_file("id_attestation.xml")) == "0" then')
+ info.script.AppendExtra('ui_print("write id_attestation OK");')
+ info.script.AppendExtra('endif;')
+
SetBootloaderEnv(info.script, "upgrade_step", "1")
SetBootloaderEnv(info.script, "force_auto_update", "false")