Add care_map to target_files package

Generate a new file containing care_data of system (and vendor)
partition, and add it under META/ of target file package. For
A/B update, copy this file to OTA package for later use by
update_verifier.

Bug: 27175949

Change-Id: I90bb972703afaeb94bc3efe718fd81b1cfbcabcc
This commit is contained in:
Tianjie Xu
2016-03-07 16:31:19 -08:00
parent f8acad1480
commit cfa86223d6
3 changed files with 69 additions and 13 deletions

View File

@@ -1314,6 +1314,19 @@ def WriteABOTAPackageWithBrilloScript(target_file, output_file,
compress_type=zipfile.ZIP_STORED)
WriteMetadata(metadata, output_zip)
# If dm-verity is supported for the device, copy contents of care_map
# into A/B OTA package.
if OPTIONS.info_dict.get("verity") == "true":
target_zip = zipfile.ZipFile(target_file, "r")
care_map_path = "META/care_map.txt"
namelist = target_zip.namelist()
if care_map_path in namelist:
care_map_data = target_zip.read(care_map_path)
common.ZipWriteStr(output_zip, "care_map.txt", care_map_data)
else:
print "Warning: cannot find care map file in target_file package"
common.ZipClose(target_zip)
# Sign the whole package to comply with the Android OTA package format.
common.ZipClose(output_zip)
SignOutput(temp_zip_file.name, output_file)