Uses a per-partition fingerprint for building images and avb_salt.
This causes the output image files of a merged build to be identical
to the image files of the input partial builds, for each images in
PARTITIONS_WITH_CARE_MAP.
Test: python -m unittest test_common
Test: `m dist`; `unzip out/dist/target_files.zip IMAGES/\*`;
`zip -d out/dist/target_files.zip IMAGES/\*`
`add_img_to_target_files -a out/dist/target_files.zip`.
Verify that the rebuilt images are identical to the deleted ones.
Test: Build a merged target (using merge_target_files.py). Verify that
the partial target-files.zip IMAGES are identical to the merged
target-files.zip IMAGES for PARTITIONS_WITH_CARE_MAP images.
Bug: 150405807
Change-Id: I5fdf5783c1aff9c14cf5408090389b1f65b69ca6
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index ed9183e..54bb857 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -540,7 +540,6 @@
"verity_disable",
"avb_enable",
"avb_avbtool",
- "avb_salt",
"use_dynamic_partition_size",
)
for p in common_props:
@@ -553,6 +552,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_system_key_path", "avb_key_path")
copy_prop("avb_system_algorithm", "avb_algorithm")
+ copy_prop("avb_system_salt", "avb_salt")
copy_prop("fs_type", "fs_type")
# Copy the generic system fs type first, override with specific one if
# available.
@@ -584,6 +584,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_system_other_key_path", "avb_key_path")
copy_prop("avb_system_other_algorithm", "avb_algorithm")
+ copy_prop("avb_system_other_salt", "avb_salt")
copy_prop("fs_type", "fs_type")
copy_prop("system_fs_type", "fs_type")
copy_prop("system_other_size", "partition_size")
@@ -619,6 +620,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_vendor_key_path", "avb_key_path")
copy_prop("avb_vendor_algorithm", "avb_algorithm")
+ copy_prop("avb_vendor_salt", "avb_salt")
copy_prop("vendor_fs_type", "fs_type")
copy_prop("vendor_size", "partition_size")
if not copy_prop("vendor_journal_size", "journal_size"):
@@ -641,6 +643,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_product_key_path", "avb_key_path")
copy_prop("avb_product_algorithm", "avb_algorithm")
+ copy_prop("avb_product_salt", "avb_salt")
copy_prop("product_fs_type", "fs_type")
copy_prop("product_size", "partition_size")
if not copy_prop("product_journal_size", "journal_size"):
@@ -663,6 +666,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_system_ext_key_path", "avb_key_path")
copy_prop("avb_system_ext_algorithm", "avb_algorithm")
+ copy_prop("avb_system_ext_salt", "avb_salt")
copy_prop("system_ext_fs_type", "fs_type")
copy_prop("system_ext_size", "partition_size")
if not copy_prop("system_ext_journal_size", "journal_size"):
@@ -687,6 +691,7 @@
"avb_add_hashtree_footer_args")
copy_prop("avb_odm_key_path", "avb_key_path")
copy_prop("avb_odm_algorithm", "avb_algorithm")
+ copy_prop("avb_odm_salt", "avb_salt")
copy_prop("odm_fs_type", "fs_type")
copy_prop("odm_size", "partition_size")
if not copy_prop("odm_journal_size", "journal_size"):