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

Commit a9951bda authored by Ricky Cheung's avatar Ricky Cheung
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.

Signed-off-by: default avatarRicky Cheung <rcheung844@gmail.com>
Change-Id: I2dc6e43537deb606dd01fb090add2595502055c1
parent 9493e54a
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3873,15 +3873,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)
+1 −1
Original line number Diff line number Diff line
@@ -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: