Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7264f02e authored by Ricky Cheung's avatar Ricky Cheung Committed by Nolen Johnson
Browse files

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.

[npjohnson]: !fixup Id706d90f54c4a87676b58fd11d76236bffa183f0
was squashed into this.

Signed-off-by: default avatarRicky Cheung <rcheung844@gmail.com>
Change-Id: I2dc6e43537deb606dd01fb090add2595502055c1
(cherry picked from commit a9951bda)
parent a6d7a365
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -3589,15 +3589,16 @@ 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
  recovery_img_path = "etc/recovery.img"
  if board_builds_vendorimage:
    recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
  else:
    # In this case the output sink is rooted at SYSTEM
    recovery_img_path = "vendor/etc/recovery.img"
  elif not board_uses_vendorimage:
    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)