From 425f7d1cb3fc5c1adc740db546c5b18227ea3c82 Mon Sep 17 00:00:00 2001 From: Hongguang Chen Date: Mon, 7 Nov 2022 13:36:38 -0800 Subject: [PATCH] Support chained init_boot partition signing Bug: 256048561 Bug: 256237041 Test: sign_target_files_apks -d certs --avb_init_boot_algorithm \ SHA256_RSA4096 --avb_init_boot_key init_boot_rsa4096.pem \ xxx.zip signed.zip (Check signed.zip/META/misc_info.txt) Change-Id: I65fc7913089ae318d90df55a533d3e2ebd93b029 (cherry picked from commit 0d6b727e03efd49a77e864077a01837e993f600f) Merged-In: I65fc7913089ae318d90df55a533d3e2ebd93b029 (cherry picked from commit acf1b3afe28f03a4816575960c9e903293a80d76) --- tools/releasetools/sign_target_files_apks.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 6f96d8f6a6..837eaf9c1e 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -99,14 +99,14 @@ Usage: sign_target_files_apks [flags] input_target_files output_target_files The second dir will be used for lookup if BOARD_USES_RECOVERY_AS_BOOT is set to true. - --avb_{boot,recovery,system,system_other,vendor,dtbo,vbmeta,vbmeta_system, - vbmeta_vendor}_algorithm - --avb_{boot,recovery,system,system_other,vendor,dtbo,vbmeta,vbmeta_system, - vbmeta_vendor}_key + --avb_{boot,init_boot,recovery,system,system_other,vendor,dtbo,vbmeta, + vbmeta_system,vbmeta_vendor}_algorithm + --avb_{boot,init_boot,recovery,system,system_other,vendor,dtbo,vbmeta, + vbmeta_system,vbmeta_vendor}_key Use the specified algorithm (e.g. SHA256_RSA4096) and the key to AVB-sign the specified image. Otherwise it uses the existing values in info dict. - --avb_{apex,boot,recovery,system,system_other,vendor,dtbo,vbmeta, + --avb_{apex,init_boot,boot,recovery,system,system_other,vendor,dtbo,vbmeta, vbmeta_system,vbmeta_vendor}_extra_args Specify any additional args that are needed to AVB-sign the image (e.g. "--signing_helper /path/to/helper"). The args will be appended to @@ -1427,6 +1427,12 @@ def main(argv): OPTIONS.avb_algorithms['dtbo'] = a elif o == "--avb_dtbo_extra_args": OPTIONS.avb_extra_args['dtbo'] = a + elif o == "--avb_init_boot_key": + OPTIONS.avb_keys['init_boot'] = a + elif o == "--avb_init_boot_algorithm": + OPTIONS.avb_algorithms['init_boot'] = a + elif o == "--avb_init_boot_extra_args": + OPTIONS.avb_extra_args['init_boot'] = a elif o == "--avb_recovery_key": OPTIONS.avb_keys['recovery'] = a elif o == "--avb_recovery_algorithm": @@ -1518,6 +1524,9 @@ def main(argv): "avb_dtbo_algorithm=", "avb_dtbo_key=", "avb_dtbo_extra_args=", + "avb_init_boot_algorithm=", + "avb_init_boot_key=", + "avb_init_boot_extra_args=", "avb_recovery_algorithm=", "avb_recovery_key=", "avb_recovery_extra_args=",