summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bowgo Tsai <bowgotsai@google.com> 2025-02-13 18:09:04 +0800
committer Bowgo Tsai <bowgotsai@google.com> 2025-02-15 02:24:50 +0800
commita7d257cc8fc0055812b93912926e3f5bf827f162 (patch)
treebb70351e01b2ade81c01182e3fd817a35bcc4a8f
parent3e5812831b026f152cc75dcc17c1cff6e34c1782 (diff)
Fix pvmfw.img signing error
This commit fixes the following error, by extracting 'SYSTEM/apex/com.android.virt.apex' from a target-files zip file to a temp file, then gets the Microdroid AVB key from it. FileNotFoundError: [Errno 2] No such file or directory: 'SYSTEM/apex/com.android.virt.apex' Bug: 384813199 Bug: 395932577 Test: m sign_target_files_apks Test: sign_target_files_apks --allow_gsi_debug_sepolicy \ --extra_apex_payload_key com.android.virt.apex= \ -e com.android.virt.apex= \ gsi_arm64-target_files-${build_id}.zip signed.zip Test: unzip signed.zip IMAGES/pvmfw.img Test: avbtool extract_public_key --key external/avb/test/data/testkey_rsa4096.pem --out key.pub Test: grep -U -F -f key.pub IMAGES/pvmfw.img => grep: IMAGES/pvmfw.img: binary file matches Change-Id: I4a4129d221778906fb739a574d7adb48e91e9eda
-rwxr-xr-xtools/releasetools/sign_target_files_apks.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index f1855a543d..2fa3fb5e89 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -910,8 +910,11 @@ def ProcessTargetFiles(input_tf_zip: zipfile.ZipFile, output_tf_zip: zipfile.Zip
# b/384813199: handles the pre-signed com.android.virt.apex in GSI.
if payload_key == 'PRESIGNED':
- new_pubkey = GetMicrodroidVbmetaKey(virt_apex_path,
- misc_info['avb_avbtool'])
+ with tempfile.NamedTemporaryFile() as virt_apex_temp_file:
+ virt_apex_temp_file.write(input_tf_zip.read(virt_apex_path))
+ virt_apex_temp_file.flush()
+ new_pubkey = GetMicrodroidVbmetaKey(virt_apex_temp_file.name,
+ misc_info['avb_avbtool'])
else:
new_pubkey_path = common.ExtractAvbPublicKey(
misc_info['avb_avbtool'], payload_key)