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
This commit is contained in:
@@ -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')
|
||||
|
@@ -178,24 +178,31 @@ OPTIONS.android_jar_path = None
|
||||
|
||||
|
||||
AVB_FOOTER_ARGS_BY_PARTITION = {
|
||||
'boot' : 'avb_boot_add_hash_footer_args',
|
||||
'dtbo' : 'avb_dtbo_add_hash_footer_args',
|
||||
'product' : 'avb_product_add_hashtree_footer_args',
|
||||
'recovery' : 'avb_recovery_add_hash_footer_args',
|
||||
'system' : 'avb_system_add_hashtree_footer_args',
|
||||
'system_ext' : 'avb_system_ext_add_hashtree_footer_args',
|
||||
'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',
|
||||
'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",
|
||||
'vbmeta' : 'avb_vbmeta_args',
|
||||
'vbmeta_system' : 'avb_vbmeta_system_args',
|
||||
'vbmeta_vendor' : 'avb_vbmeta_vendor_args',
|
||||
'boot': 'avb_boot_add_hash_footer_args',
|
||||
'dtbo': 'avb_dtbo_add_hash_footer_args',
|
||||
'product': 'avb_product_add_hashtree_footer_args',
|
||||
'recovery': 'avb_recovery_add_hash_footer_args',
|
||||
'system': 'avb_system_add_hashtree_footer_args',
|
||||
'system_ext': 'avb_system_ext_add_hashtree_footer_args',
|
||||
'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",
|
||||
'vbmeta': 'avb_vbmeta_args',
|
||||
'vbmeta_system': 'avb_vbmeta_system_args',
|
||||
'vbmeta_vendor': 'avb_vbmeta_vendor_args',
|
||||
}
|
||||
|
||||
|
||||
# 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():
|
||||
|
Reference in New Issue
Block a user