Resolve conflict AVB rollback index location

Add an `--avb-resolve-rollback-index-location-conflict`
option in merge_target_files. When this option is set,
the merge tool will resolve conflicting index locations
by assigning the smallest unused index location.

This is to support merging system and vendor target files
from two different targets. In this case, the two target
files may have conflict rollback index location because
they were built independently.

Test: atest releasetools_test
Test: validate_target_files *-target_files-*.zip
Test: merge_target_files &&
        add_img_to_target_files &&
        img_from_target_files &&
        flash device
Bug: 300604688
Change-Id: Ibd18ef2a9f3784157fe17966f5364c3c81c9bd9f
This commit is contained in:
Dennis Song
2023-10-02 04:31:34 +00:00
parent d61f2efdbb
commit 4aae62ee77
5 changed files with 131 additions and 36 deletions

View File

@@ -90,6 +90,10 @@ Usage: merge_target_files [args]
--keep-tmp
Keep tempoary files for debugging purposes.
--avb-resolve-rollback-index-location-conflict
If provided, resolve the conflict AVB rollback index location when
necessary.
The following only apply when using the VSDK to perform dexopt on vendor apps:
--framework-dexpreopt-config
@@ -144,6 +148,7 @@ OPTIONS.allow_duplicate_apkapex_keys = False
OPTIONS.vendor_otatools = None
OPTIONS.rebuild_sepolicy = False
OPTIONS.keep_tmp = False
OPTIONS.avb_resolve_rollback_index_location_conflict = False
OPTIONS.framework_dexpreopt_config = None
OPTIONS.framework_dexpreopt_tools = None
OPTIONS.vendor_dexpreopt_config = None
@@ -230,6 +235,8 @@ def generate_missing_images(target_files_dir):
]
if OPTIONS.rebuild_recovery:
add_img_args.append('--rebuild_recovery')
if OPTIONS.avb_resolve_rollback_index_location_conflict:
add_img_args.append('--avb_resolve_rollback_index_location_conflict')
add_img_args.append(target_files_dir)
add_img_to_target_files.main(add_img_args)
@@ -554,6 +561,8 @@ def main():
OPTIONS.rebuild_sepolicy = True
elif o == '--keep-tmp':
OPTIONS.keep_tmp = True
elif o == '--avb-resolve-rollback-index-location-conflict':
OPTIONS.avb_resolve_rollback_index_location_conflict = True
elif o == '--framework-dexpreopt-config':
OPTIONS.framework_dexpreopt_config = a
elif o == '--framework-dexpreopt-tools':
@@ -593,6 +602,7 @@ def main():
'vendor-otatools=',
'rebuild-sepolicy',
'keep-tmp',
'avb-resolve-rollback-index-location-conflict',
],
extra_option_handler=option_handler)