From 4837944712e305ff97ff1da1ba2f77c956c6310e Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Wed, 11 Sep 2024 15:47:16 -0700 Subject: [PATCH] Fix OTA package re-sign on release key servers Release key signing passes more args than just --package_key, honor these flags properly in signing script. Test: th Bug: 354019928 Change-Id: I49215e92f28da2ac4cd72fb9e5c6bbc94a3e3f02 --- tools/releasetools/sign_target_files_apks.py | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index a72342f2d7..0254f37be5 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -582,6 +582,24 @@ def IsBuildPropFile(filename): filename.endswith("/prop.default") +def GetOtaSigningArgs(): + args = [] + if OPTIONS.package_key: + args.extend(["--package_key", OPTIONS.package_key]) + if OPTIONS.payload_signer: + args.extend(["--payload_signer=" + OPTIONS.payload_signer]) + if OPTIONS.payload_signer_args: + args.extend(["--payload_signer_args=" + OPTIONS.payload_signer_args]) + if OPTIONS.search_path: + args.extend(["--search_path", OPTIONS.search_path]) + if OPTIONS.payload_signer_maximum_signature_size: + args.extend(["--payload_signer_maximum_signature_size", + OPTIONS.payload_signer_maximum_signature_size]) + if OPTIONS.private_key_suffix: + args.extend(["--private_key_suffix", OPTIONS.private_key_suffix]) + return args + + def RegenerateKernelPartitions(input_tf_zip: zipfile.ZipFile, output_tf_zip: zipfile.ZipFile, misc_info): """Re-generate boot and dtbo partitions using new signing configuration""" files_to_unzip = [ @@ -648,9 +666,9 @@ def RegenerateBootOTA(input_tf_zip: zipfile.ZipFile, filename, input_ota): if os.path.exists(signed_16k_dtbo_image): signed_dtbo_image += ":" + signed_16k_dtbo_image - - args = ["ota_from_raw_img", "--package_key", OPTIONS.package_key, + args = ["ota_from_raw_img", "--max_timestamp", timestamp, "--output", input_ota.name] + args.extend(GetOtaSigningArgs()) if "dtbo" in partitions: args.extend(["--partition_name", "boot,dtbo", signed_boot_image, signed_dtbo_image])