Merge "Allow sign_target_files_apks.py to create zip64 signed TF.zip."
diff --git a/core/Makefile b/core/Makefile
index a23cdd4..f666bce 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1784,6 +1784,8 @@
--include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
endif
+INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
+
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += --setup_rootfs_from_kernel $(BUILT_SYSTEMIMAGE)
endif
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 1d8090a..0d77be1 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -69,7 +69,7 @@
OPTIONS.add_missing = False
OPTIONS.rebuild_recovery = False
-OPTIONS.replace_recovery_patch_files_list = []
+OPTIONS.replace_updated_files_list = []
OPTIONS.replace_verity_public_key = False
OPTIONS.replace_verity_private_key = False
OPTIONS.is_signing = False
@@ -99,8 +99,7 @@
assert which in ("system", "vendor")
simg = sparse_img.SparseImage(imgname)
- care_map_list = []
- care_map_list.append(which)
+ care_map_list = [which]
care_map_ranges = simg.care_map
key = which + "_adjusted_partition_size"
@@ -130,7 +129,7 @@
arc_name = "SYSTEM/" + fn
if arc_name in output_zip.namelist():
- OPTIONS.replace_recovery_patch_files_list.append(arc_name)
+ OPTIONS.replace_updated_files_list.append(arc_name)
else:
common.ZipWrite(output_zip, ofile.name, arc_name)
@@ -427,17 +426,21 @@
img.Write()
-def ReplaceRecoveryPatchFiles(zip_filename):
- """Update the related files under SYSTEM/ after rebuilding recovery."""
+def ReplaceUpdatedFiles(zip_filename, files_list):
+ """Update all the zip entries listed in the files_list.
- cmd = ["zip", "-d", zip_filename] + OPTIONS.replace_recovery_patch_files_list
+ For now the list includes META/care_map.txt, and the related files under
+ SYSTEM/ after rebuilding recovery.
+ """
+
+ cmd = ["zip", "-d", zip_filename] + files_list
p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p.communicate()
output_zip = zipfile.ZipFile(zip_filename, "a",
compression=zipfile.ZIP_DEFLATED,
allowZip64=True)
- for item in OPTIONS.replace_recovery_patch_files_list:
+ for item in files_list:
file_path = os.path.join(OPTIONS.input_tmp, item)
assert os.path.exists(file_path)
common.ZipWrite(output_zip, file_path, arcname=item)
@@ -616,17 +619,20 @@
assert os.path.exists(img_path), "cannot find " + img_name
if care_map_list:
- file_path = "META/care_map.txt"
- if output_zip:
- common.ZipWriteStr(output_zip, file_path, '\n'.join(care_map_list))
+ care_map_path = "META/care_map.txt"
+ if output_zip and care_map_path not in output_zip.namelist():
+ common.ZipWriteStr(output_zip, care_map_path, '\n'.join(care_map_list))
else:
- with open(os.path.join(OPTIONS.input_tmp, file_path), 'w') as fp:
+ with open(os.path.join(OPTIONS.input_tmp, care_map_path), 'w') as fp:
fp.write('\n'.join(care_map_list))
+ if output_zip:
+ OPTIONS.replace_updated_files_list.append(care_map_path)
if output_zip:
common.ZipClose(output_zip)
- if OPTIONS.replace_recovery_patch_files_list:
- ReplaceRecoveryPatchFiles(output_zip.filename)
+ if OPTIONS.replace_updated_files_list:
+ ReplaceUpdatedFiles(output_zip.filename,
+ OPTIONS.replace_updated_files_list)
def main(argv):