Generate care_map.txt when AVB is enabled

When AVB is enabled, generate care_map.txt and add it to the target
files. Also copy it into the OTA package where it will later be used
by the update_verifier.

Bug: 62208947
Test: \
1. Run add_img_to_target_files on the TF of a new pixel device,
and care_map.txt generates successfully.

2. Make dist in oc-dr1-release and find care_map.txt in the OTA package.

3. update_verifier succeeds in reading all the blocks on the care_map,
and fails to read out-of-bound blocks.

Change-Id: I2881711e6f87789cb7de150dbeca18b756fed68a
This commit is contained in:
Tianjie Xu
2017-06-01 11:32:32 -07:00
parent 0996f815db
commit 6b2e155ee6
3 changed files with 16 additions and 7 deletions

View File

@@ -1167,7 +1167,8 @@ def WriteABOTAPackageWithBrilloScript(target_file, output_file,
# If dm-verity is supported for the device, copy contents of care_map
# into A/B OTA package.
target_zip = zipfile.ZipFile(target_file, "r")
if OPTIONS.info_dict.get("verity") == "true":
if (OPTIONS.info_dict.get("verity") == "true" or
OPTIONS.info_dict.get("board_avb_enable") == "true"):
care_map_path = "META/care_map.txt"
namelist = target_zip.namelist()
if care_map_path in namelist: