From 6bd3b1a7f1e90e7ccab4ea89f5d520570497c79d Mon Sep 17 00:00:00 2001 From: Tianjie Date: Fri, 16 Oct 2020 18:53:47 -0700 Subject: [PATCH] Generate partial ota update package if the board defines it Many partners have asked for platform support of system-only update. So we config cuttlefish as an example to support the partial ota updates. Also make such package available on the build server. This allows continuous test to ensure the e2e update flow is working. Bug: 170921953 Test: generate & apply a partial update, check output in presubmit Change-Id: I79d0abeb1b2be18e6ff88f0455b6de6540a37794 --- core/Makefile | 28 +++++++++++++++++++--------- core/main.mk | 1 + 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/core/Makefile b/core/Makefile index af492289da..ef9ca283d2 100644 --- a/core/Makefile +++ b/core/Makefile @@ -4831,7 +4831,7 @@ ifeq ($(build_ota_package),true) # $(1): output file # $(2): additional args define build-ota-package-target -PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ +PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$(dir $(ZIP2ZIP)):$$PATH \ $(OTA_FROM_TARGET_FILES) \ --verbose \ --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \ @@ -4841,11 +4841,11 @@ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ $(BUILT_TARGET_FILES_PACKAGE) $(1) endef -name := $(TARGET_PRODUCT) +product_name := $(TARGET_PRODUCT) ifeq ($(TARGET_BUILD_TYPE),debug) - name := $(name)_debug + product_name := $(product_name)_debug endif -name := $(name)-ota-$(FILE_NAME_TAG) +name := $(product_name)-ota-$(FILE_NAME_TAG) INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata @@ -4860,11 +4860,7 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTA_FROM_TARGET_ otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true) -name := $(TARGET_PRODUCT) -ifeq ($(TARGET_BUILD_TYPE),debug) - name := $(name)_debug -endif -name := $(name)-ota-retrofit-$(FILE_NAME_TAG) +name := $(product_name)-ota-retrofit-$(FILE_NAME_TAG) INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) @@ -4881,6 +4877,20 @@ otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TAR endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE +ifneq ($(BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST),) +name := $(product_name)-partial-ota-$(FILE_NAME_TAG) + +INTERNAL_OTA_PARTIAL_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip +$(INTERNAL_OTA_PARTIAL_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) +$(INTERNAL_OTA_PARTIAL_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTA_FROM_TARGET_FILES) $(INTERNAL_OTATOOLS_FILES) + @echo "Package partial OTA: $@" + $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --partial "$(BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST)") + +.PHONY: partialotapackage +partialotapackage: $(INTERNAL_OTA_PARTIAL_PACKAGE_TARGET) + +endif # BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST + endif # build_ota_package # ----------------------------------------------------------------- diff --git a/core/main.mk b/core/main.mk index 40cc70f7d5..0bf590a311 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1715,6 +1715,7 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(INTERNAL_UPDATE_PACKAGE_TARGET) \ $(INTERNAL_OTA_PACKAGE_TARGET) \ $(INTERNAL_OTA_METADATA) \ + $(INTERNAL_OTA_PARTIAL_PACKAGE_TARGET) \ $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) \ $(BUILT_OTATOOLS_PACKAGE) \ $(SYMBOLS_ZIP) \