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

Commit 96a322f2 authored by Gabriele M's avatar Gabriele M Committed by Tom Powell
Browse files

ota_from_target_files: Remove device dependent arguments

These device-specific arguments are defined at build time and are
necessary to generate the zip correctly. Don't use command line
arguments to specify them, but write all the needed information
in misc_info.txt when the target-files zip is generated.
ota_from_target_files will then read misc_info.txt and set
everything automatically.

Change-Id: Ibdbca575b76eb07b53fccfcea52a351c7e333f91
parent 9caf8603
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -2142,6 +2142,8 @@ ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
else
	$(hide) build/tools/getb64key.py $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem > $(zip_root)/META/releasekey.txt
endif
	$(hide) echo "ota_override_device=$(OTA_SCRIPT_OVERRIDE_DEVICE)" >> $(zip_root)/META/misc_info.txt
	$(hide) echo "ota_override_prop=$(OTA_SCRIPT_OVERRIDE_PROP)" >> $(zip_root)/META/misc_info.txt
ifdef BOARD_PREBUILT_VENDORIMAGE
	$(hide) mkdir -p $(zip_root)/IMAGES
	$(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
@@ -2207,15 +2209,15 @@ endif
endif

ifeq ($(TARGET_OTA_ASSERT_DEVICE),)
    $(INTERNAL_OTA_PACKAGE_TARGET): override_device := auto
    OTA_SCRIPT_OVERRIDE_DEVICE := auto
else
    $(INTERNAL_OTA_PACKAGE_TARGET): override_device := $(TARGET_OTA_ASSERT_DEVICE)
    OTA_SCRIPT_OVERRIDE_DEVICE := $(TARGET_OTA_ASSERT_DEVICE)
endif

ifneq ($(TARGET_UNIFIED_DEVICE),)
    $(INTERNAL_OTA_PACKAGE_TARGET): override_prop := --override_prop=true
    OTA_SCRIPT_OVERRIDE_PROP := true
    ifeq ($(TARGET_OTA_ASSERT_DEVICE),)
        $(INTERNAL_OTA_PACKAGE_TARGET): override_device := $(TARGET_DEVICE)
        OTA_SCRIPT_OVERRIDE_DEVICE := $(TARGET_OTA_ASSERT_DEVICE)
    endif
endif

@@ -2225,7 +2227,6 @@ endif

$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE)
	@echo "$(OTA_FROM_TARGET_SCRIPT)" > $(PRODUCT_OUT)/ota_script_path
	@echo "$(override_device)" > $(PRODUCT_OUT)/ota_override_device
	@echo "Package OTA: $@"
	$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
	   $(OTA_FROM_TARGET_SCRIPT) -v \
@@ -2233,7 +2234,6 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE)
	   -p $(HOST_OUT) \
	   -k $(KEY_CERT_PAIR) \
	   --backup=$(backuptool) \
	   --override_device=$(override_device) $(override_prop) \
	   $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
	   $(BUILT_TARGET_FILES_PACKAGE) $@

+5 −13
Original line number Diff line number Diff line
@@ -118,13 +118,6 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
      Enable or disable the execution of backuptool.sh.
      Disabled by default.

  --override_device <device>
      Override device-specific asserts. Can be a comma-separated list.

  --override_prop <boolean>
      Override build.prop items with custom vendor init.
      Enabled when TARGET_UNIFIED_DEVICE is defined in BoardConfig

  --payload_signer <signer>
      Specify the signer when signing the payload and metadata for A/B OTAs.
      By default (i.e. without this flag), it calls 'openssl pkeyutl' to sign
@@ -2039,10 +2032,6 @@ def main(argv):
      OPTIONS.log_diff = a
    elif o in ("--backup",):
      OPTIONS.backuptool = bool(a.lower() == 'true')
    elif o in ("--override_device",):
      OPTIONS.override_device = a
    elif o in ("--override_prop",):
      OPTIONS.override_prop = bool(a.lower() == 'true')
    elif o == "--payload_signer":
      OPTIONS.payload_signer = a
    elif o == "--payload_signer_args":
@@ -2077,8 +2066,6 @@ def main(argv):
                                 "gen_verify",
                                 "log_diff=",
                                 "backup=",
                                 "override_device=",
                                 "override_prop=",
                                 "payload_signer=",
                                 "payload_signer_args=",
                             ], extra_option_handler=option_handler)
@@ -2105,6 +2092,11 @@ def main(argv):
  OPTIONS.info_dict = common.LoadInfoDict(input_zip)
  common.ZipClose(input_zip)

  if "ota_override_device" in OPTIONS.info_dict:
    OPTIONS.override_device = OPTIONS.info_dict.get("ota_override_device")
  if "ota_override_prop" in OPTIONS.info_dict:
    OPTIONS.override_prop = OPTIONS.info_dict.get("ota_override_prop") == "true"

  ab_update = OPTIONS.info_dict.get("ab_update") == "true"

  if ab_update: