Correct logic for obtaining the path to full recovery image

Currently, an extra '/vendor' is appended in target_files_dir of
make_recovery_patch.py, which will yield an erroneous path when
attempting to build full recovery image on vendorimage-leas devices:

SYSTEM/vendor/vendor/etc/recovery.img

This patch addresses the issue by removing the extra '/vendor' of
target_files_dir, and add checks for whether the target builds
vendor image in MakeRecoveryPatch() as well. This ensures no
recovery image will be generated with prebuilt vendor.

Signed-off-by: Ricky Cheung <rcheung844@gmail.com>
Change-Id: I2dc6e43537deb606dd01fb090add2595502055c1
This commit is contained in:
Ricky Cheung 2024-03-29 18:55:05 +08:00 committed by Bartłomiej Rudecki
parent 7713f520fa
commit 0eda3e0123
Signed by: przekichane
GPG key ID: 751F23C6F014EF76

View file

@ -3819,13 +3819,13 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
full_recovery_image = info_dict.get("full_recovery_image") == "true"
board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true"
board_builds_vendorimage = info_dict.get("board_builds_vendorimage") == "true"
if board_uses_vendorimage:
# In this case, the output sink is rooted at VENDOR
if board_builds_vendorimage or not board_uses_vendorimage:
recovery_img_path = "etc/recovery.img"
else:
# In this case the output sink is rooted at SYSTEM
recovery_img_path = "vendor/etc/recovery.img"
logger.warning('Recovery patch generation is disable when prebuilt vendor image is used.')
return None
if full_recovery_image:
output_sink(recovery_img_path, recovery_img.data)