From 40adb17a1cc0a7a69da7db033151d6ba1734ba8e Mon Sep 17 00:00:00 2001 From: Iavor-Valentin Iftime Date: Tue, 19 Apr 2022 18:17:56 +0000 Subject: [PATCH] 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 --- tools/releasetools/sign_target_files_apks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index c803340d48..8c0073382f 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -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)