Add PRODUCT_BUILD_*_IMAGE, BUILDING_*_IMAGE to control building of images

These centralize the decisions on whether to build certain images or
not, and allow the product definition to override that choice.

There are a few use cases here:

 * For GSI-like cases, we only want to build the system image. This
   didn't really change, but it's somewhat simpler to configure, and
   easier to understand the build logic.

 * On the opposite side, when you're planning on using a GSI, the device
   specific build can only build the vendor images (or some other set).

 * Some cases (Fuchsia, etc) don't want to build any images, as they'll
   be distributing the build artifacts in their own packaging.

I suspect in the future, TARGET_BUILD_APPS may be able to be refactored
into the third use case.

Test: treehugger
Test: Create a product definition that includes nothing, try to build it.
Test: compare build-aosp_crosshatch.ninja and build-crosshatch.ninja before/after
Change-Id: I685ab841be3718d3dd7052c28ccd764bb6f1991a
This commit is contained in:
Dan Willemsen 2019-01-16 12:42:05 -08:00
parent df0808331d
commit 674952098b
5 changed files with 231 additions and 60 deletions

View File

@ -835,6 +835,7 @@ $(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
# -----------------------------------------------------------------
# the ramdisk
ifdef BUILDING_RAMDISK_IMAGE
INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
$(ALL_GENERATED_SOURCES) \
$(ALL_DEFAULT_INSTALLED_MODULES))
@ -863,6 +864,9 @@ ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
@echo "make $@: ignoring dependencies"
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
endif # BUILDING_RAMDISK_IMAGE
INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
@ -1975,6 +1979,8 @@ $(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
sed "s/^/-i /" | tr '\n' ' ') -o $@
# -----------------------------------------------------------------
ifdef BUILDING_SYSTEM_IMAGE
# installed file list
# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
# We put installed-files.txt ahead of image itself in the dependency graph
@ -2140,6 +2146,8 @@ $(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
endif
endif
endif # BUILDING_SYSTEM_IMAGE
.PHONY: sync syncsys
sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
@ -2230,16 +2238,16 @@ $(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(p
echo "-D $(TARGET_OUT)" >> $@.lst
echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_VENDOR_IMAGE
echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
endif
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_IMAGE
echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
endif
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_SERVICES_IMAGE
echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
endif
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_ODM_IMAGE
echo "-D $(TARGET_OUT_ODM)" >> $@.lst
endif
ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
@ -2307,15 +2315,7 @@ boottarball-nodeps btnod: $(FS_GET_STATS) \
INTERNAL_USERDATAIMAGE_FILES := \
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
# Don't build userdata.img if it's extfs but no partition size
skip_userdata.img :=
ifdef INTERNAL_USERIMAGES_EXT_VARIANT
ifndef BOARD_USERDATAIMAGE_PARTITION_SIZE
skip_userdata.img := true
endif
endif
ifneq ($(skip_userdata.img),true)
ifdef BUILDING_USERDATA_IMAGE
userdataimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,userdata)
BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
@ -2344,8 +2344,7 @@ $(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
$(build-userdataimage-target)
endif # not skip_userdata.img
skip_userdata.img :=
endif # BUILDING_USERDATA_IMAGE
# ASAN libraries in the system image - build rule.
ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
@ -2419,7 +2418,7 @@ endif # BOARD_BPT_INPUT_FILES
# -----------------------------------------------------------------
# cache partition image
ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_CACHE_IMAGE
INTERNAL_CACHEIMAGE_FILES := \
$(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
@ -2447,16 +2446,15 @@ $(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAG
cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
$(build-cacheimage-target)
else # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
else # BUILDING_CACHE_IMAGE
# we need to ignore the broken cache link when doing the rsync
IGNORE_CACHE_LINK := --exclude=cache
endif # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
endif # BUILDING_CACHE_IMAGE
# -----------------------------------------------------------------
# system_other partition image
ifdef BUILDING_SYSTEM_OTHER_IMAGE
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
BOARD_USES_SYSTEM_OTHER := true
# Marker file to identify that odex files are installed
INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
@ -2464,7 +2462,6 @@ $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
$(hide) touch $@
endif
ifdef BOARD_USES_SYSTEM_OTHER
INTERNAL_SYSTEMOTHERIMAGE_FILES := \
$(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
@ -2515,12 +2512,12 @@ endif
systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
$(build-systemotherimage-target)
endif # BOARD_USES_SYSTEM_OTHER
endif # BUILDING_SYSTEM_OTHER_IMAGE
# -----------------------------------------------------------------
# vendor partition image
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_VENDOR_IMAGE
INTERNAL_VENDORIMAGE_FILES := \
$(filter $(TARGET_OUT_VENDOR)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
@ -2607,7 +2604,7 @@ endif
# -----------------------------------------------------------------
# product partition image
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_IMAGE
INTERNAL_PRODUCTIMAGE_FILES := \
$(filter $(TARGET_OUT_PRODUCT)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
@ -2662,7 +2659,7 @@ endif
# -----------------------------------------------------------------
# product_services partition image
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_SERVICES_IMAGE
INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
$(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
@ -2717,7 +2714,7 @@ endif
# -----------------------------------------------------------------
# odm partition image
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_ODM_IMAGE
INTERNAL_ODMIMAGE_FILES := \
$(filter $(TARGET_OUT_ODM)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
@ -3543,33 +3540,37 @@ endif # BOARD_USES_RECOVERY_AS_BOOT
$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
mkdir -p $(zip_root)/RADIO; \
cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
ifdef BUILDING_SYSTEM_IMAGE
@# Contents of the system image
$(hide) $(call package_files-copy-root, \
$(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
endif
ifdef BUILDING_USERDATA_IMAGE
@# Contents of the data image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_DATA),$(zip_root)/DATA)
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
endif
ifdef BUILDING_VENDOR_IMAGE
@# Contents of the vendor image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
endif
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_IMAGE
@# Contents of the product image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
endif
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_SERVICES_IMAGE
@# Contents of the product_services image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
endif
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_ODM_IMAGE
@# Contents of the odm image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_ODM),$(zip_root)/ODM)
endif
ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
ifdef BUILDING_SYSTEM_OTHER_IMAGE
@# Contents of the system_other image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
@ -3768,17 +3769,19 @@ endif # BOARD_PREBUILT_DTBOIMAGE
echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
@# Run fs_config on all the system, vendor, boot ramdisk,
@# and recovery ramdisk files in the zip, and save the output
ifdef BUILDING_SYSTEM_IMAGE
$(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
endif
ifdef BUILDING_VENDOR_IMAGE
$(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
endif
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_IMAGE
$(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
endif
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_PRODUCT_SERVICES_IMAGE
$(hide) $(call fs_config,$(zip_root)/PRODUCT_SERVICES,product_services/) > $(zip_root)/META/product_services_filesystem_config.txt
endif
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
ifdef BUILDING_ODM_IMAGE
$(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
endif
@# ROOT always contains the files for the root under normal boot.
@ -3794,7 +3797,7 @@ endif
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
$(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
endif
ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
ifdef BUILDING_SYSTEM_OTHER_IMAGE
$(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
endif
@# Metadata for compatibility verification.

View File

@ -1063,11 +1063,11 @@ BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := true
# 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 BUILDING_VENDOR_IMAGE
ifndef BOARD_PREBUILT_VENDORIMAGE
BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE :=
endif # BOARD_PREBUILT_VENDORIMAGE
endif # BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
endif # BUILDING_VENDOR_IMAGE
endif # BOARD_SUPER_PARTITION_PARTITION_LIST
else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS

View File

@ -295,27 +295,113 @@ ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT)
endif
###########################################
# Configure whether we're building the system image
BUILDING_SYSTEM_IMAGE := true
ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),)
ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE
ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
BUILDING_SYSTEM_IMAGE :=
endif
endif
else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false)
BUILDING_SYSTEM_IMAGE :=
endif
.KATI_READONLY := BUILDING_SYSTEM_IMAGE
# Are we building a system_other image
BUILDING_SYSTEM_OTHER_IMAGE :=
ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),)
ifdef BUILDING_SYSTEM_IMAGE
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
BUILDING_SYSTEM_OTHER_IMAGE := true
endif
endif
else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true)
BUILDING_SYSTEM_OTHER_IMAGE := true
ifndef BUILDING_SYSTEM_IMAGE
$(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image)
endif
endif
.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE
# Are we building a cache image
BUILDING_CACHE_IMAGE :=
ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),)
ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
BUILDING_CACHE_IMAGE := true
endif
else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true)
BUILDING_CACHE_IMAGE := true
ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
$(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined)
endif
endif
.KATI_READONLY := BUILDING_CACHE_IMAGE
# TODO: Add BUILDING_BOOT_IMAGE / BUILDING_RECOVERY_IMAGE
# This gets complicated with BOARD_USES_RECOVERY_AS_BOOT, so skipping for now.
# Are we building a ramdisk image
BUILDING_RAMDISK_IMAGE := true
ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
# TODO: Be smarter about this. This probably only needs to happen when one of the follow is true:
# BUILDING_BOOT_IMAGE
# BUILDING_RECOVERY_IMAGE
else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
BUILDING_RAMDISK_IMAGE :=
endif
.KATI_READONLY := BUILDING_RAMDISK_IMAGE
# Are we building a userdata image
BUILDING_USERDATA_IMAGE :=
ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)
ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
BUILDING_USERDATA_IMAGE := true
endif
else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
BUILDING_USERDATA_IMAGE := true
endif
.KATI_READONLY := BUILDING_USERDATA_IMAGE
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
TARGET_COPY_OUT_VENDOR := system/vendor
TARGET_COPY_OUT_VENDOR := system/vendor
else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
$(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
$(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
endif
PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
BOARD_USES_VENDORIMAGE :=
ifdef BOARD_PREBUILT_VENDORIMAGE
BOARD_USES_VENDORIMAGE := true
BOARD_USES_VENDORIMAGE := true
endif
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_VENDORIMAGE := true
BOARD_USES_VENDORIMAGE := true
endif
ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
BOARD_USES_VENDORIMAGE := true
BOARD_USES_VENDORIMAGE := true
else ifdef BOARD_USES_VENDORIMAGE
$(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
$(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
endif
.KATI_READONLY := BOARD_USES_VENDORIMAGE
BUILDING_VENDOR_IMAGE :=
ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),)
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
BUILDING_VENDOR_IMAGE := true
endif
else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true)
BUILDING_VENDOR_IMAGE := true
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
$(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined)
endif
endif
ifdef BOARD_PREBUILT_VENDORIMAGE
BUILDING_VENDOR_IMAGE :=
endif
.KATI_READONLY := BUILDING_VENDOR_IMAGE
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
@ -328,61 +414,110 @@ PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRO
BOARD_USES_PRODUCTIMAGE :=
ifdef BOARD_PREBUILT_PRODUCTIMAGE
BOARD_USES_PRODUCTIMAGE := true
BOARD_USES_PRODUCTIMAGE := true
endif
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_PRODUCTIMAGE := true
BOARD_USES_PRODUCTIMAGE := true
endif
ifeq ($(TARGET_COPY_OUT_PRODUCT),product)
BOARD_USES_PRODUCTIMAGE := true
BOARD_USES_PRODUCTIMAGE := true
else ifdef BOARD_USES_PRODUCTIMAGE
$(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image)
$(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image)
endif
.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
BUILDING_PRODUCT_IMAGE :=
ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),)
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
BUILDING_PRODUCT_IMAGE := true
endif
else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true)
BUILDING_PRODUCT_IMAGE := true
ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
$(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined)
endif
endif
ifdef BOARD_PREBUILT_PRODUCTIMAGE
BUILDING_PRODUCT_IMAGE :=
endif
.KATI_READONLY := BUILDING_PRODUCT_IMAGE
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT_SERVICES
ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),$(_product_services_path_placeholder))
TARGET_COPY_OUT_PRODUCT_SERVICES := system/product_services
TARGET_COPY_OUT_PRODUCT_SERVICES := system/product_services
else ifeq ($(filter product_services system/product_services,$(TARGET_COPY_OUT_PRODUCT_SERVICES)),)
$(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.)
$(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.)
endif
PRODUCT_COPY_FILES := $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),$(PRODUCT_COPY_FILES))
BOARD_USES_PRODUCT_SERVICESIMAGE :=
ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
BOARD_USES_PRODUCT_SERVICESIMAGE := true
BOARD_USES_PRODUCT_SERVICESIMAGE := true
endif
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_PRODUCT_SERVICESIMAGE := true
BOARD_USES_PRODUCT_SERVICESIMAGE := true
endif
ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),product_services)
BOARD_USES_PRODUCT_SERVICESIMAGE := true
BOARD_USES_PRODUCT_SERVICESIMAGE := true
else ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
$(error TARGET_COPY_OUT_PRODUCT_SERVICES must be set to 'product_services' to use a product_services image)
$(error TARGET_COPY_OUT_PRODUCT_SERVICES must be set to 'product_services' to use a product_services image)
endif
BUILDING_PRODUCT_SERVICES_IMAGE :=
ifeq ($(PRODUCT_SERVICES_BUILD_PRODUCT_SERVICES_IMAGE),)
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
BUILDING_PRODUCT_SERVICES_IMAGE := true
endif
else ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),true)
BUILDING_PRODUCT_SERVICES_IMAGE := true
ifndef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
$(error PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE set to true, but BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE not defined)
endif
endif
ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
BUILDING_PRODUCT_SERVICES_IMAGE :=
endif
.KATI_READONLY := BUILDING_PRODUCT_SERVICES_IMAGE
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
TARGET_COPY_OUT_ODM := vendor/odm
TARGET_COPY_OUT_ODM := vendor/odm
else ifeq ($(filter odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
$(error TARGET_COPY_OUT_ODM must be either 'odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.)
$(error TARGET_COPY_OUT_ODM must be either 'odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.)
endif
PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
BOARD_USES_ODMIMAGE :=
ifdef BOARD_PREBUILT_ODMIMAGE
BOARD_USES_ODMIMAGE := true
BOARD_USES_ODMIMAGE := true
endif
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
BOARD_USES_ODMIMAGE := true
BOARD_USES_ODMIMAGE := true
endif
ifeq ($(TARGET_COPY_OUT_ODM),odm)
BOARD_USES_ODMIMAGE := true
BOARD_USES_ODMIMAGE := true
else ifdef BOARD_USES_ODMIMAGE
$(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image)
$(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image)
endif
BUILDING_ODM_IMAGE :=
ifeq ($(ODM_BUILD_ODM_IMAGE),)
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
BUILDING_ODM_IMAGE := true
endif
else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true)
BUILDING_ODM_IMAGE := true
ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
$(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined)
endif
endif
ifdef BOARD_PREBUILT_ODMIMAGE
BUILDING_ODM_IMAGE :=
endif
.KATI_READONLY := BUILDING_ODM_IMAGE
###########################################
# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set.
TARGET_RECOVERY_UPDATER_LIBS ?=

View File

@ -216,6 +216,15 @@ _product_var_list := \
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
PRODUCT_XOM_EXCLUDE_PATHS \
PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES \
PRODUCT_BUILD_SYSTEM_IMAGE \
PRODUCT_BUILD_SYSTEM_OTHER_IMAGE \
PRODUCT_BUILD_VENDOR_IMAGE \
PRODUCT_BUILD_PRODUCT_IMAGE \
PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE \
PRODUCT_BUILD_ODM_IMAGE \
PRODUCT_BUILD_CACHE_IMAGE \
PRODUCT_BUILD_RAMDISK_IMAGE \
PRODUCT_BUILD_USERDATA_IMAGE \
define dump-product
$(info ==== $(1) ====)\

View File

@ -566,3 +566,27 @@ PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := \
PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES))
.KATI_READONLY := PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
# Macro to use below. $(1) is the name of the partition
define product-build-image-config
PRODUCT_BUILD_$(1)_IMAGE := $$(firstword $$(strip $$(PRODUCTS.$$(INTERNAL_PRODUCT).PRODUCT_BUILD_$(1)_IMAGE)))
.KATI_READONLY := PRODUCT_BUILD_$(1)_IMAGE
ifneq ($$(filter-out true false,$$(PRODUCT_BUILD_$(1)_IMAGE)),)
$$(error Invalid PRODUCT_BUILD_$(1)_IMAGE: $$(PRODUCT_BUILD_$(1)_IMAGE) -- true false and empty are supported)
endif
endef
# Copy and check the value of each PRODUCT_BUILD_*_IMAGE variable
$(foreach image, \
SYSTEM \
SYSTEM_OTHER \
VENDOR \
PRODUCT \
PRODUCT_SERVICES \
ODM \
CACHE \
RAMDISK \
USERDATA, \
$(eval $(call product-build-image-config,$(image))))
product-build-image-config :=