Rebuild and copy recovery and boot img when using vendor_otatools

Rebuild recovery and boot images with vbmeta footers and copy together with recovery patch/install files when building vendor images using vendor otatools. Fixes validate_target_files failure.

Bug: 220126689
Bug: 186097910

Test: sign_target_files_apks \
        --vendor_otatools=otatools_vendor_dir \
	--vendor_partitions=vendor,odm \
	merged-target_files.zip \
	signed-target_files.zip
Test: validate_target_files signed-target_files.zip

Change-Id: Id45c67405bc37b769757db1701507f82cc6068d3
This commit is contained in:
Iavor-Valentin Iftime 2022-04-19 18:17:56 +00:00
parent 95654c5113
commit 40adb17a1c
1 changed files with 7 additions and 2 deletions

View File

@ -1354,12 +1354,13 @@ def BuildVendorPartitions(output_zip_path):
vendor_misc_info["no_boot"] = "true" # boot
vendor_misc_info["vendor_boot"] = "false" # vendor_boot
vendor_misc_info["no_recovery"] = "true" # recovery
vendor_misc_info["avb_enable"] = "false" # vbmeta
vendor_misc_info["board_bpt_enable"] = "false" # partition-table
vendor_misc_info["has_dtbo"] = "false" # dtbo
vendor_misc_info["has_pvmfw"] = "false" # pvmfw
vendor_misc_info["avb_custom_images_partition_list"] = "" # custom images
vendor_misc_info["avb_enable"] = "false" # vbmeta
vendor_misc_info["avb_building_vbmeta_image"] = "false" # skip building vbmeta
vendor_misc_info["use_dynamic_partitions"] = "false" # super_empty
vendor_misc_info["build_super_partition"] = "false" # super split
with open(vendor_misc_info_path, "w") as output:
@ -1414,8 +1415,12 @@ def BuildVendorPartitions(output_zip_path):
map_file_path = "IMAGES/{}.map".format(p)
common.ZipWrite(output_zip, os.path.join(vendor_tempdir, img_file_path), img_file_path)
common.ZipWrite(output_zip, os.path.join(vendor_tempdir, map_file_path), map_file_path)
# copy recovery patch & install.sh
# copy recovery.img, boot.img, recovery patch & install.sh
if OPTIONS.rebuild_recovery:
recovery_img = "IMAGES/recovery.img"
boot_img = "IMAGES/boot.img"
common.ZipWrite(output_zip, os.path.join(vendor_tempdir, recovery_img), recovery_img)
common.ZipWrite(output_zip, os.path.join(vendor_tempdir, boot_img), boot_img)
recovery_patch_path = "VENDOR/recovery-from-boot.p"
recovery_sh_path = "VENDOR/bin/install-recovery.sh"
common.ZipWrite(output_zip, os.path.join(vendor_tempdir, recovery_patch_path), recovery_patch_path)