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
diff --git a/tools/releasetools/merge/merge_target_files.py b/tools/releasetools/merge/merge_target_files.py
index a0d3a1c..6bf1b49 100755
--- a/tools/releasetools/merge/merge_target_files.py
+++ b/tools/releasetools/merge/merge_target_files.py
@@ -90,6 +90,10 @@
--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.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 @@
]
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 @@
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 @@
'vendor-otatools=',
'rebuild-sepolicy',
'keep-tmp',
+ 'avb-resolve-rollback-index-location-conflict',
],
extra_option_handler=option_handler)