Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7d257cc authored by Bowgo Tsai's avatar Bowgo Tsai
Browse files

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
parent 3e581283
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -910,7 +910,10 @@ 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,
          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(