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
Signed-off-by: RITEFANG <1721985272@qq.com>
This commit is contained in:
Ricky Cheung
2024-03-29 18:55:05 +08:00
committed by SkyMinus
parent 88602b1464
commit a12cd56eda
2 changed files with 7 additions and 3 deletions

View File

@@ -3828,15 +3828,19 @@ 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:
if board_builds_vendorimage:
# In this case, the output sink is rooted at VENDOR
recovery_img_path = "etc/recovery.img"
recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
else:
elif not board_uses_vendorimage:
# In this case the output sink is rooted at SYSTEM
recovery_img_path = "vendor/etc/recovery.img"
recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat"
else:
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)

View File

@@ -56,7 +56,7 @@ def main(argv):
if board_builds_vendorimage:
target_files_dir = "VENDOR"
elif not board_uses_vendorimage:
target_files_dir = "SYSTEM/vendor"
target_files_dir = "SYSTEM"
def output_sink(fn, data):
if target_files_dir is None: