Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65b98cd3 authored by Tianjie Xu's avatar Tianjie Xu Committed by Gerrit Code Review
Browse files

Merge "Generate care_map.txt when AVB is enabled"

parents b5e90583 6b2e155e
Loading
Loading
Loading
Loading
+13 −6
Original line number Original line Diff line number Diff line
@@ -236,9 +236,14 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
  if block_list:
  if block_list:
    block_list.Write()
    block_list.Write()


  # Set the 'adjusted_partition_size' that excludes the verity blocks of the
  # given image. When avb is enabled, this size is the max image size returned
  # by the avb tool.
  is_verity_partition = "verity_block_device" in image_props
  is_verity_partition = "verity_block_device" in image_props
  verity_supported = image_props.get("verity") == "true"
  verity_supported = (image_props.get("verity") == "true" or
  if is_verity_partition and verity_supported:
                      image_props.get("board_avb_enable") == "true")
  is_avb_enable = image_props.get("avb_hashtree_enable") == "true"
  if verity_supported and (is_verity_partition or is_avb_enable):
    adjusted_blocks_value = image_props.get("partition_size")
    adjusted_blocks_value = image_props.get("partition_size")
    if adjusted_blocks_value:
    if adjusted_blocks_value:
      adjusted_blocks_key = what + "_adjusted_partition_size"
      adjusted_blocks_key = what + "_adjusted_partition_size"
@@ -530,12 +535,14 @@ def AddImagesToTargetFiles(filename):
    # partitions (if present), then write this file to target_files package.
    # partitions (if present), then write this file to target_files package.
    care_map_list = []
    care_map_list = []
    for line in lines:
    for line in lines:
      if line.strip() == "system" and OPTIONS.info_dict.get(
      if line.strip() == "system" and (
          "system_verity_block_device", None) is not None:
          "system_verity_block_device" in OPTIONS.info_dict or
          OPTIONS.info_dict.get("system_avb_hashtree_enable") == "true"):
        assert os.path.exists(system_img_path)
        assert os.path.exists(system_img_path)
        care_map_list += GetCareMap("system", system_img_path)
        care_map_list += GetCareMap("system", system_img_path)
      if line.strip() == "vendor" and OPTIONS.info_dict.get(
      if line.strip() == "vendor" and (
          "vendor_verity_block_device", None) is not None:
          "vendor_verity_block_device" in OPTIONS.info_dict or
          OPTIONS.info_dict.get("vendor_avb_hashtree_enable") == "true"):
        assert os.path.exists(vendor_img_path)
        assert os.path.exists(vendor_img_path)
        care_map_list += GetCareMap("vendor", vendor_img_path)
        care_map_list += GetCareMap("vendor", vendor_img_path)


+1 −0
Original line number Original line Diff line number Diff line
@@ -624,6 +624,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
      "verity_key",
      "verity_key",
      "verity_signer_cmd",
      "verity_signer_cmd",
      "verity_fec",
      "verity_fec",
      "board_avb_enable",
      "avb_signing_args",
      "avb_signing_args",
      "avb_avbtool"
      "avb_avbtool"
      )
      )
+2 −1
Original line number Original line Diff line number Diff line
@@ -1167,7 +1167,8 @@ def WriteABOTAPackageWithBrilloScript(target_file, output_file,
  # If dm-verity is supported for the device, copy contents of care_map
  # If dm-verity is supported for the device, copy contents of care_map
  # into A/B OTA package.
  # into A/B OTA package.
  target_zip = zipfile.ZipFile(target_file, "r")
  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"
    care_map_path = "META/care_map.txt"
    namelist = target_zip.namelist()
    namelist = target_zip.namelist()
    if care_map_path in namelist:
    if care_map_path in namelist: