support different boot partition sizes in aosp_arm64

The different boot images in aosp_arm64 have different partition size
requirements. Add support for defining a partition size associated with
each boot image variant.

This support is limited to aosp_arm64 currently, which is built with
recovery-as-boot.

A previous version of this change did not update the boot-debug image
AVB logic with the required macro for multiple boot partition size
support. This is now required because the aosp-arm64 boot.img is
configured as a chained AVB partition.

Bug: 156036850
Bug: 155049180
Change-Id: I66b57de91042bfd56ba54a3659843d8cf7873955
This commit is contained in:
Steve Muckle
2020-05-07 17:32:10 -07:00
parent 29beb858ef
commit 903a1ca7e1
3 changed files with 35 additions and 10 deletions

View File

@@ -677,9 +677,14 @@ def LoadInfoDict(input_file, repacking=False):
makeint("userdata_size")
makeint("cache_size")
makeint("recovery_size")
makeint("boot_size")
makeint("fstab_version")
boot_images = "boot.img"
if "boot_images" in d:
boot_images = d["boot_images"]
for b in boot_images.split():
makeint(b.replace(".img","_size"))
# Load recovery fstab if applicable.
d["fstab"] = _FindAndLoadRecoveryFstab(d, input_file, read_helper)
@@ -1329,7 +1334,10 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
# AVB: if enabled, calculate and add hash to boot.img or recovery.img.
if info_dict.get("avb_enable") == "true":
avbtool = info_dict["avb_avbtool"]
part_size = info_dict[partition_name + "_size"]
if partition_name == "recovery":
part_size = info_dict["recovery_size"]
else:
part_size = info_dict[image_name.replace(".img","_size")]
cmd = [avbtool, "add_hash_footer", "--image", img.name,
"--partition_size", str(part_size), "--partition_name",
partition_name]