From aba5c9eacd54e9b0cf5fbeaa1157ca8ec1d00786 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Mon, 27 Sep 2021 14:08:41 +0800 Subject: [PATCH] Fix aosp_x86_64-user build failure Commit Ia982eb2ee3d1eb64db72c1836e433bcc53e71e3f removes boot-5.4.img and leaves only a boot-5.10.img file, which makes 'boot_container' become false. This leads to the failure in AddVbmetaDigest() as it will search a 'boot.img' based on the 'boot' descriptor from the vbmeta.img. Add a condition that if boot_images[0] is not 'boot.img' then the build is also a boot container. Bug: 199807830 Test: build aosp_x86_64-user Change-Id: I4a9487b075186f0abf2ba74d3a1cf78072352a05 --- tools/releasetools/add_img_to_target_files.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index 01cc2336d1..2a4b56ba85 100644 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -712,8 +712,10 @@ def AddVbmetaDigest(output_zip): # Calculate the vbmeta digest and put the result in to META/ boot_images = OPTIONS.info_dict.get("boot_images") # Disable the digest calculation if the target_file is used as a container - # for boot images. - boot_container = boot_images and len(boot_images.split()) >= 2 + # for boot images. A boot container might contain boot-5.4.img, boot-5.10.img + # etc., instead of just a boot.img and will fail in vbmeta digest calculation. + boot_container = boot_images and ( + len(boot_images.split()) >= 2 or boot_images.split()[0] != 'boot.img') if (OPTIONS.info_dict.get("avb_enable") == "true" and not boot_container and OPTIONS.info_dict.get("avb_building_vbmeta_image") == "true"): avbtool = OPTIONS.info_dict["avb_avbtool"]