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

Commit 651987c5 authored by Ethan Chen's avatar Ethan Chen
Browse files

ota: Allow devices to skip generation of recovery-from-boot.p

* Not all devices have a real recovery partition, so those devices
  should skip this generation step.

Change-Id: I4abc3f92b879e6997e4874543ec9772c3179b1d0
parent ac8f2eb0
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1449,6 +1449,10 @@ ifneq ($(TARGET_UNIFIED_DEVICE),)
    $(INTERNAL_OTA_PACKAGE_TARGET): override_prop := --override_prop=true
endif

ifneq ($(TARGET_NO_SEPARATE_RECOVERY),)
    $(INTERNAL_OTA_PACKAGE_TARGET): separate_recovery := --no_separate_recovery=true
endif

$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
	@echo "$(OTA_FROM_TARGET_SCRIPT)" > $(PRODUCT_OUT)/ota_script_path
	@echo "$(override_device)" > $(PRODUCT_OUT)/ota_override_device
@@ -1459,7 +1463,9 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS)
	   -p $(HOST_OUT) \
	   -k $(KEY_CERT_PAIR) \
	   --backup=$(backuptool) \
	   --override_device=$(override_device) $(override_prop) \
	   --override_device=$(override_device) \
	   $(override_prop) \
	   $(separate_recovery) \
	   $(BUILT_TARGET_FILES_PACKAGE) $@

CM_TARGET_PACKAGE := $(PRODUCT_OUT)/cm-$(CM_VERSION).zip
+22 −11
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
      Override build.prop items with custom vendor init.
      Enabled when TARGET_UNIFIED_DEVICE is defined in BoardConfig

  --no_separate_recovery <boolean>
      Do not generate recovery image. For devices which do not have a truly
      separate recovery partition.

"""

import sys
@@ -102,6 +106,7 @@ OPTIONS.worker_threads = 3
OPTIONS.backuptool = False
OPTIONS.override_device = 'auto'
OPTIONS.override_prop = False
OPTIONS.no_separate_recovery = False

def MostPopularKey(d, default):
  """Given a dict, return the key corresponding to the largest
@@ -471,6 +476,7 @@ def WriteFullOTAPackage(input_zip, output_zip):

  script.FormatPartition("/system")
  script.Mount("/system")
  if not OPTIONS.no_separate_recovery:
    script.UnpackPackageDir("recovery", "/system")
  script.UnpackPackageDir("system", "/system")

@@ -479,6 +485,7 @@ def WriteFullOTAPackage(input_zip, output_zip):

  boot_img = common.GetBootableImage("boot.img", "boot.img",
                                     OPTIONS.input_tmp, "BOOT")
  if not OPTIONS.no_separate_recovery:
    recovery_img = common.GetBootableImage("recovery.img", "recovery.img",
                                           OPTIONS.input_tmp, "RECOVERY")
    MakeRecoveryPatch(OPTIONS.input_tmp, output_zip, recovery_img, boot_img)
@@ -646,6 +653,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
      "/tmp/boot.img", "boot.img", OPTIONS.target_tmp, "BOOT")
  updating_boot = (source_boot.data != target_boot.data)

  if not OPTIONS.no_separate_recovery:
    source_recovery = common.GetBootableImage(
        "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY",
        OPTIONS.source_info_dict)
@@ -794,7 +802,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
    script.Print("Unpacking new files...")
    script.UnpackPackageDir("system", "/system")

  if updating_recovery:
  if updating_recovery and not OPTIONS.no_separate_recovery:
    script.Print("Unpacking new recovery...")
    script.UnpackPackageDir("recovery", "/system")

@@ -870,6 +878,8 @@ def main(argv):
      OPTIONS.override_device = a
    elif o in ("--override_prop"):
      OPTIONS.override_prop = bool(a.lower() == 'true')
    elif o in ("--no_separate_recovery"):
      OPTIONS.no_separate_recovery = bool(a.lower() == 'true')
    else:
      return False
    return True
@@ -886,7 +896,8 @@ def main(argv):
                                              "aslr_mode=",
                                              "backup=",
                                              "override_device=",
                                              "override_prop="],
                                              "override_prop=",
                                              "no_separate_recovery="],
                             extra_option_handler=option_handler)

  if len(args) != 2: