From 519d18286eb33bb1413f4cf207dc8a3ab4034c40 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 27 Dec 2018 12:47:23 -0800 Subject: [PATCH] Don't build retrofit OTA package if vendor.img is unavailable. We used to build retrofit full OTA package as long as PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true. This doesn't work with AOSP targets that have the flag set but without any available vendor image. This CL detects such a condition and uses a separate flag to guard the retrofit OTA building as well as the split super images generation. Bug: 120852744 Test: `m -j dist` on blueline (w/ vendor images) and aosp_blueline (w/o vendor images). Change-Id: I65726f24f8fc546be6802941a6a06590a3804c16 --- core/Makefile | 6 ++++-- core/config.mk | 15 +++++++++++++++ tools/releasetools/add_img_to_target_files.py | 5 +++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/core/Makefile b/core/Makefile index 1b2b7041e1..06ac70ec81 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3426,6 +3426,8 @@ define dump-dynamic-partitions-info echo "lpmake=$(notdir $(LPMAKE))" >> $(1) $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \ echo "build_super_partition=true" >> $(1))) + $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \ + echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1)) echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1) $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \ echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1)) @@ -3886,7 +3888,7 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \ .PHONY: otapackage otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) -ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) +ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true) name := $(TARGET_PRODUCT) ifeq ($(TARGET_BUILD_TYPE),debug) name := $(name)_debug @@ -3912,7 +3914,7 @@ $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) -endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS +endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE endif # build_ota_package diff --git a/core/config.mk b/core/config.mk index fdaaba9f13..c0a159dce6 100644 --- a/core/config.mk +++ b/core/config.mk @@ -1058,6 +1058,19 @@ endif # The metadata device must be supplied to init via the kernel command-line. BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE) +BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := true + +# If "vendor" is listed as one of the dynamic partitions but without its image available (e.g. an +# AOSP target built without vendor image), don't build the retrofit full OTA package. Because we +# won't be able to build meaningful super_* images for retrofitting purpose. +ifneq (,$(filter vendor,$(BOARD_SUPER_PARTITION_PARTITION_LIST))) +ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE +ifndef BOARD_PREBUILT_VENDORIMAGE +BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := +endif # BOARD_PREBUILT_VENDORIMAGE +endif # BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE +endif # BOARD_SUPER_PARTITION_PARTITION_LIST + else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS # For normal devices, we populate BOARD_SUPER_PARTITION_BLOCK_DEVICES so the @@ -1079,11 +1092,13 @@ endif ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super) BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE) endif +BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS endif # BOARD_SUPER_PARTITION_SIZE .KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES .KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE +.KATI_READONLY := BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE $(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \ $(eval BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE := $(strip $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))) \ diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index 1872a58127..da5ea4aa1a 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -859,11 +859,12 @@ def AddImagesToTargetFiles(filename): banner("vbmeta") AddVBMeta(output_zip, partitions, "vbmeta", vbmeta_partitions) - if OPTIONS.info_dict.get("build_super_partition"): + if OPTIONS.info_dict.get("build_super_partition") == "true": banner("super_empty") AddSuperEmpty(output_zip) - if OPTIONS.info_dict.get("dynamic_partition_retrofit") == "true": + if OPTIONS.info_dict.get( + "build_retrofit_dynamic_partitions_ota_package") == "true": banner("super split images") AddSuperSplit(output_zip)