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

Commit bf0b8a86 authored by Tianjie's avatar Tianjie
Browse files

Add a check for missing entries in AVB_FOOTER_ARGS_BY_PARTITION

Fail the signing if the AVB_FOOTER_ARGS_BY_PARTITION isn't in sync
with common.AVB_PARTITIONS.

Bug: 181787095
Test: run sign_target_files_apks on a S image

Change-Id: I6ccf5fb9f39b92c1da2554f5b3826d2cd87d84d7
parent 697c6eec
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -109,7 +109,9 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL")

# The partitions allowed to be signed by AVB (Android Verified Boot 2.0). Note
# that system_other is not in the list because we don't want to include its
# descriptor into vbmeta.img.
# descriptor into vbmeta.img. When adding a new entry here, the
# AVB_FOOTER_ARGS_BY_PARTITION in sign_target_files_apks need to be updated
# accordingly.
AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'pvmfw', 'recovery',
                  'system', 'system_ext', 'vendor', 'vendor_boot',
                  'vendor_dlkm', 'odm_dlkm')
+22 −15
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ AVB_FOOTER_ARGS_BY_PARTITION = {
    'system_other': 'avb_system_other_add_hashtree_footer_args',
    'odm': 'avb_odm_add_hashtree_footer_args',
    'odm_dlkm': 'avb_odm_dlkm_add_hashtree_footer_args',
    'pvmfw': 'avb_pvmfw_add_hash_footer_args',
    'vendor': 'avb_vendor_add_hashtree_footer_args',
    'vendor_boot': 'avb_vendor_boot_add_hash_footer_args',
    'vendor_dlkm': "avb_vendor_dlkm_add_hashtree_footer_args",
@@ -196,6 +197,12 @@ AVB_FOOTER_ARGS_BY_PARTITION = {
}


# Check that AVB_FOOTER_ARGS_BY_PARTITION is in sync with AVB_PARTITIONS.
for partition in common.AVB_PARTITIONS:
  if partition not in AVB_FOOTER_ARGS_BY_PARTITION:
    raise RuntimeError("Missing {} in AVB_FOOTER_ARGS".format(partition))


def GetApkCerts(certmap):
  # apply the key remapping to the contents of the file
  for apk, cert in certmap.items():