1# 2# Copyright (C) 2019 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# ############################################################### 18# This file includes BoardConfig.mk for the device being built, 19# and checks the variable defined therein. 20# ############################################################### 21 22_board_strip_readonly_list := 23_board_strip_readonly_list += BOARD_BOOTLOADER_IN_UPDATE_PACKAGE 24_board_strip_readonly_list += BOARD_EGL_CFG 25_board_strip_readonly_list += BOARD_HAVE_BLUETOOTH 26_board_strip_readonly_list += BOARD_INSTALLER_CMDLINE 27_board_strip_readonly_list += BOARD_KERNEL_CMDLINE 28_board_strip_readonly_list += BOARD_BOOT_HEADER_VERSION 29_board_strip_readonly_list += BOARD_BOOTCONFIG 30_board_strip_readonly_list += BOARD_KERNEL_BASE 31_board_strip_readonly_list += BOARD_USES_GENERIC_AUDIO 32_board_strip_readonly_list += BOARD_USES_RECOVERY_AS_BOOT 33_board_strip_readonly_list += BOARD_VENDOR_USE_AKMD 34_board_strip_readonly_list += BOARD_WPA_SUPPLICANT_DRIVER 35_board_strip_readonly_list += BOARD_WLAN_DEVICE 36_board_strip_readonly_list += TARGET_BOARD_PLATFORM 37_board_strip_readonly_list += TARGET_BOARD_PLATFORM_GPU 38_board_strip_readonly_list += TARGET_BOOTLOADER_BOARD_NAME 39_board_strip_readonly_list += TARGET_FS_CONFIG_GEN 40_board_strip_readonly_list += TARGET_NO_BOOTLOADER 41_board_strip_readonly_list += TARGET_NO_KERNEL 42_board_strip_readonly_list += TARGET_NO_RECOVERY 43_board_strip_readonly_list += TARGET_NO_RADIOIMAGE 44_board_strip_readonly_list += TARGET_HARDWARE_3D 45_board_strip_readonly_list += WITH_DEXPREOPT 46 47# Arch variables 48_board_strip_readonly_list += TARGET_ARCH 49_board_strip_readonly_list += TARGET_ARCH_VARIANT 50_board_strip_readonly_list += TARGET_CPU_ABI 51_board_strip_readonly_list += TARGET_CPU_ABI2 52_board_strip_readonly_list += TARGET_CPU_VARIANT 53_board_strip_readonly_list += TARGET_CPU_VARIANT_RUNTIME 54_board_strip_readonly_list += TARGET_2ND_ARCH 55_board_strip_readonly_list += TARGET_2ND_ARCH_VARIANT 56_board_strip_readonly_list += TARGET_2ND_CPU_ABI 57_board_strip_readonly_list += TARGET_2ND_CPU_ABI2 58_board_strip_readonly_list += TARGET_2ND_CPU_VARIANT 59_board_strip_readonly_list += TARGET_2ND_CPU_VARIANT_RUNTIME 60# TARGET_ARCH_SUITE is an alternative arch configuration to TARGET_ARCH (and related variables), 61# that can be used for soong-only builds to build for several architectures at once. 62# Allowed values currently are "ndk" and "mainline_sdk". 63_board_strip_readonly_list += TARGET_ARCH_SUITE 64 65# File system variables 66_board_strip_readonly_list += BOARD_FLASH_BLOCK_SIZE 67_board_strip_readonly_list += BOARD_BOOTIMAGE_PARTITION_SIZE 68_board_strip_readonly_list += BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE 69_board_strip_readonly_list += BOARD_RECOVERYIMAGE_PARTITION_SIZE 70_board_strip_readonly_list += BOARD_SYSTEMIMAGE_PARTITION_SIZE 71_board_strip_readonly_list += BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE 72_board_strip_readonly_list += BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE 73_board_strip_readonly_list += BOARD_USERDATAIMAGE_PARTITION_SIZE 74_board_strip_readonly_list += BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 75_board_strip_readonly_list += BOARD_CACHEIMAGE_PARTITION_SIZE 76_board_strip_readonly_list += BOARD_VENDORIMAGE_PARTITION_SIZE 77_board_strip_readonly_list += BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 78_board_strip_readonly_list += BOARD_PRODUCTIMAGE_PARTITION_SIZE 79_board_strip_readonly_list += BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 80_board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE 81_board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 82_board_strip_readonly_list += BOARD_ODMIMAGE_PARTITION_SIZE 83_board_strip_readonly_list += BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 84_board_strip_readonly_list += BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE 85_board_strip_readonly_list += BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE 86_board_strip_readonly_list += BOARD_ODM_DLKMIMAGE_PARTITION_SIZE 87_board_strip_readonly_list += BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE 88_board_strip_readonly_list += BOARD_SYSTEM_DLKMIMAGE_PARTITION_SIZE 89_board_strip_readonly_list += BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE 90_board_strip_readonly_list += BOARD_PVMFWIMAGE_PARTITION_SIZE 91 92# Logical partitions related variables. 93_board_strip_readonly_list += BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE 94_board_strip_readonly_list += BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE 95_board_strip_readonly_list += BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE 96_board_strip_readonly_list += BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE 97_board_strip_readonly_list += BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE 98_board_strip_readonly_list += BOARD_SYSTEM_DLKMIMAGE_PARTITION_RESERVED_SIZE 99_board_strip_readonly_list += BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE 100_board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE 101_board_strip_readonly_list += BOARD_SUPER_PARTITION_SIZE 102_board_strip_readonly_list += BOARD_SUPER_PARTITION_GROUPS 103 104# Kernel related variables 105_board_strip_readonly_list += BOARD_KERNEL_BINARIES 106_board_strip_readonly_list += BOARD_KERNEL_MODULE_INTERFACE_VERSIONS 107 108# Variables related to generic kernel image (GKI) and generic boot image 109# - BOARD_USES_GENERIC_KERNEL_IMAGE is the global variable that defines if the 110# board uses GKI and generic boot image. 111# Update mechanism of the boot image is not enforced by this variable. 112# - BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE controls whether the recovery image 113# contains a kernel or not. 114# - BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT controls whether ramdisk 115# recovery resources are built to vendor_boot. 116# - BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT controls whether recovery 117# resources are built as a standalone recovery ramdisk in vendor_boot. 118# - BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT controls whether GSI AVB keys are 119# built to vendor_boot. 120# - BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES controls whether boot images in $OUT are added 121# to target files package directly. 122_board_strip_readonly_list += BOARD_USES_GENERIC_KERNEL_IMAGE 123_board_strip_readonly_list += BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE 124_board_strip_readonly_list += BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT 125_board_strip_readonly_list += BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT 126_board_strip_readonly_list += BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT 127_board_strip_readonly_list += BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES 128 129# Prebuilt image variables 130_board_strip_readonly_list += BOARD_PREBUILT_INIT_BOOT_IMAGE 131 132# Defines the list of logical vendor ramdisk names to build or include in vendor_boot. 133_board_strip_readonly_list += BOARD_VENDOR_RAMDISK_FRAGMENTS 134 135# These are all variables used to build $(INSTALLED_MISC_INFO_TARGET) 136# in build/make/core/Makefile. Their values get used in command line 137# arguments, so they have to be stripped to make the ninja files stable. 138_board_strip_list := 139_board_strip_list += BOARD_DTBOIMG_PARTITION_SIZE 140_board_strip_list += BOARD_AVB_DTBO_KEY_PATH 141_board_strip_list += BOARD_AVB_DTBO_ALGORITHM 142_board_strip_list += BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION 143_board_strip_list += BOARD_AVB_PVMFW_KEY_PATH 144_board_strip_list += BOARD_AVB_PVMFW_ALGORITHM 145_board_strip_list += BOARD_AVB_PVMFW_ROLLBACK_INDEX_LOCATION 146_board_strip_list += BOARD_PARTIAL_OTA_UPDATE_PARTITIONS_LIST 147_board_strip_list += BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION 148_board_strip_list += BOARD_AVB_VBMETA_VENDOR_ALGORITHM 149_board_strip_list += BOARD_AVB_VBMETA_VENDOR_KEY_PATH 150_board_strip_list += BOARD_AVB_VBMETA_VENDOR 151_board_strip_list += BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION 152_board_strip_list += BOARD_AVB_VBMETA_SYSTEM_ALGORITHM 153_board_strip_list += BOARD_AVB_VBMETA_SYSTEM_KEY_PATH 154_board_strip_list += BOARD_AVB_VBMETA_SYSTEM 155_board_strip_list += BOARD_AVB_RECOVERY_KEY_PATH 156_board_strip_list += BOARD_AVB_RECOVERY_ALGORITHM 157_board_strip_list += BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION 158_board_strip_list += BOARD_AVB_VENDOR_BOOT_KEY_PATH 159_board_strip_list += BOARD_AVB_VENDOR_BOOT_ALGORITHM 160_board_strip_list += BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX_LOCATION 161_board_strip_list += BOARD_AVB_VENDOR_KERNEL_BOOT_KEY_PATH 162_board_strip_list += BOARD_AVB_VENDOR_KERNEL_BOOT_ALGORITHM 163_board_strip_list += BOARD_AVB_VENDOR_KERNEL_BOOT_ROLLBACK_INDEX_LOCATION 164_board_strip_list += BOARD_MKBOOTIMG_ARGS 165_board_strip_list += BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE 166_board_strip_list += BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE 167_board_strip_list += ODM_MANIFEST_SKUS 168 169 170_build_broken_var_list := \ 171 BUILD_BROKEN_CLANG_PROPERTY \ 172 BUILD_BROKEN_CLANG_ASFLAGS \ 173 BUILD_BROKEN_CLANG_CFLAGS \ 174 BUILD_BROKEN_DEPFILE \ 175 BUILD_BROKEN_DUP_RULES \ 176 BUILD_BROKEN_DUP_SYSPROP \ 177 BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \ 178 BUILD_BROKEN_ENFORCE_SYSPROP_OWNER \ 179 BUILD_BROKEN_INPUT_DIR_MODULES \ 180 BUILD_BROKEN_MISSING_REQUIRED_MODULES \ 181 BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \ 182 BUILD_BROKEN_PREBUILT_ELF_FILES \ 183 BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \ 184 BUILD_BROKEN_USES_NETWORK \ 185 BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE \ 186 BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \ 187 BUILD_BROKEN_INCORRECT_PARTITION_IMAGES \ 188 BUILD_BROKEN_GENRULE_SANDBOXING \ 189 BUILD_BROKEN_DONT_CHECK_SYSTEMSDK \ 190 191_build_broken_var_list += \ 192 $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \ 193 $(DEFAULT_WARNING_BUILD_MODULE_TYPES) \ 194 $(DEFAULT_ERROR_BUILD_MODULE_TYPES), \ 195 BUILD_BROKEN_USES_$(m)) 196 197_board_true_false_vars := $(_build_broken_var_list) 198_board_strip_readonly_list += $(_build_broken_var_list) \ 199 BUILD_BROKEN_NINJA_USES_ENV_VARS 200 201# Conditional to building on linux, as dex2oat currently does not work on darwin. 202ifeq ($(HOST_OS),linux) 203 WITH_DEXPREOPT ?= true 204endif 205 206# ############################################################### 207# Broken build defaults 208# ############################################################### 209$(foreach v,$(_build_broken_var_list),$(eval $(v) :=)) 210BUILD_BROKEN_NINJA_USES_ENV_VARS := 211 212# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) 213# or under vendor/*/$(TARGET_DEVICE). Search in both places, but 214# make sure only one exists. 215# Real boards should always be associated with an OEM vendor. 216ifdef TARGET_DEVICE_DIR 217 ifneq ($(origin TARGET_DEVICE_DIR),command line) 218 $(error TARGET_DEVICE_DIR may not be set manually) 219 endif 220 board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk 221else 222 board_config_mk := \ 223 $(strip $(sort $(wildcard \ 224 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ 225 device/generic/goldfish/board/$(TARGET_DEVICE)/BoardConfig.mk \ 226 device/google/cuttlefish/board/$(TARGET_DEVICE)/BoardConfig.mk \ 227 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 228 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 229 ))) 230 ifeq ($(board_config_mk),) 231 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) 232 endif 233 ifneq ($(words $(board_config_mk)),1) 234 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) 235 endif 236 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) 237 .KATI_READONLY := TARGET_DEVICE_DIR 238endif 239 240ifndef RBC_PRODUCT_CONFIG 241include $(board_config_mk) 242else 243 $(shell mkdir -p $(OUT_DIR)/rbc) 244 $(call dump-variables-rbc, $(OUT_DIR)/rbc/make_vars_pre_board_config.mk) 245 246 $(shell $(OUT_DIR)/mk2rbc \ 247 --mode=write -r --outdir $(OUT_DIR)/rbc \ 248 --boardlauncher=$(OUT_DIR)/rbc/boardlauncher.rbc \ 249 --input_variables=$(OUT_DIR)/rbc/make_vars_pre_board_config.mk \ 250 --makefile_list=$(OUT_DIR)/.module_paths/configuration.list \ 251 $(board_config_mk)) 252 ifneq ($(.SHELLSTATUS),0) 253 $(error board configuration converter failed: $(.SHELLSTATUS)) 254 endif 255 256 $(shell build/soong/scripts/update_out $(OUT_DIR)/rbc/rbc_board_config_results.mk \ 257 $(OUT_DIR)/rbcrun --mode=rbc $(OUT_DIR)/rbc/boardlauncher.rbc) 258 ifneq ($(.SHELLSTATUS),0) 259 $(error board configuration runner failed: $(.SHELLSTATUS)) 260 endif 261 262 include $(OUT_DIR)/rbc/rbc_board_config_results.mk 263endif 264 265ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE))) 266 $(error $(board_config_mk) erroneously sets both TARGET_ARCH and TARGET_ARCH_SUITE) 267endif 268ifeq ($(TARGET_ARCH)$(TARGET_ARCH_SUITE),) 269 $(error Target architectures not defined by board config: $(board_config_mk)) 270endif 271ifeq ($(TARGET_CPU_ABI)$(TARGET_ARCH_SUITE),) 272 $(error TARGET_CPU_ABI not defined by board config: $(board_config_mk)) 273endif 274 275ifneq ($(MALLOC_IMPL),) 276 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).) 277 $(error Use `MALLOC_LOW_MEMORY := true` to use low-memory allocator config) 278endif 279board_config_mk := 280 281# Clean up and verify BoardConfig variables 282$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var))))) 283$(foreach var,$(_board_strip_list),$(eval $(var) := $$(strip $$($(var))))) 284$(foreach var,$(_board_true_false_vars), \ 285 $(if $(filter-out true false,$($(var))), \ 286 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))"))) 287 288include $(BUILD_SYSTEM)/board_config_wifi.mk 289 290# Set up soong config for "soong_config_value_variable". 291-include vendor/google/build/soong/soong_config_namespace/camera.mk 292 293# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified. 294TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT)) 295TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT)) 296 297ifdef TARGET_ARCH 298 # The combo makefiles check and set defaults for various CPU configuration 299 combo_target := TARGET_ 300 combo_2nd_arch_prefix := 301 include $(BUILD_SYSTEM)/combo/select.mk 302endif 303 304ifdef TARGET_2ND_ARCH 305 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 306 include $(BUILD_SYSTEM)/combo/select.mk 307endif 308 309.KATI_READONLY := $(_board_strip_readonly_list) 310 311INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE) 312ifneq (,$(BOARD_BOOTCONFIG)) 313 INTERNAL_KERNEL_CMDLINE += bootconfig 314 INTERNAL_BOOTCONFIG := $(BOARD_BOOTCONFIG) 315endif 316 317ifneq ($(filter %64,$(TARGET_ARCH)),) 318 TARGET_IS_64_BIT := true 319endif 320 321ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) 322 TARGET_SUPPORTS_32_BIT_APPS := true 323endif 324 325# Quick check to warn about likely cryptic errors later in the build. 326ifeq ($(TARGET_IS_64_BIT),true) 327 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) 328 $(error Building a 32-bit-app-only product on a 64-bit device. \ 329 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) 330 endif 331endif 332 333# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are 334# comma separated lists of the 32 and 64 bit ABIs (in order of 335# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT 336# are defined by the board config, we use them. Else, we construct 337# these lists based on whether TARGET_IS_64_BIT is set. 338# 339# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target 340# is always 32 bits. If this isn't the case, these variables should 341# be overriden in the board configuration. 342# 343# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always 344# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs. 345_target_native_bridge_abi_list_32_bit := 346_target_native_bridge_abi_list_64_bit := 347 348ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) 349 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) 350 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 351 _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI) 352 endif 353endif 354 355# "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported 356# in all builds with SANITIZE_TARGET=hwaddress. 357ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),) 358 ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),) 359 TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT) 360 endif 361endif 362 363ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) 364 ifneq (true,$(TARGET_IS_64_BIT)) 365 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 366 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI) 367 else 368 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) 369 # For a 64 bit target, assume that the 2ND_CPU_ABI 370 # is a 32 bit ABI. 371 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) 372 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI) 373 endif 374 endif 375endif 376 377# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order 378# of preference) that the target supports. If a TARGET_CPU_ABI_LIST 379# is specified by the board configuration, we use that. If not, we 380# build a list out of the TARGET_CPU_ABIs specified by the config. 381# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference. 382ifeq (,$(TARGET_CPU_ABI_LIST)) 383 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \ 384 $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit) 385endif 386 387# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference. 388TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit) 389TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit) 390 391# Strip whitespace from the ABI list string. 392TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) 393TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) 394TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) 395 396# Check if config about image building is valid or not. 397define check_image_config 398 $(eval _uc_name := $(call to-upper,$(1))) \ 399 $(eval _lc_name := $(call to-lower,$(1))) \ 400 $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \ 401 $(if $(BOARD_USES_$(_uc_name)IMAGE),, \ 402 $(error If TARGET_COPY_OUT_$(_uc_name) is '$(_lc_name)', either BOARD_PREBUILT_$(_uc_name)IMAGE or BOARD_$(_uc_name)IMAGE_FILE_SYSTEM_TYPE must be set)), \ 403 $(if $(BOARD_USES_$(_uc_name)IMAGE), \ 404 $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \ 405 $(eval _uc_name :=) \ 406 $(eval _lc_name :=) 407endef 408 409########################################### 410# Configure whether we're building the system image 411BUILDING_SYSTEM_IMAGE := true 412ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),) 413 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE 414 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE 415 BUILDING_SYSTEM_IMAGE := 416 endif 417 endif 418else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false) 419 BUILDING_SYSTEM_IMAGE := 420endif 421.KATI_READONLY := BUILDING_SYSTEM_IMAGE 422 423# Are we building a system_other image 424BUILDING_SYSTEM_OTHER_IMAGE := 425ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),) 426 ifdef BUILDING_SYSTEM_IMAGE 427 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) 428 BUILDING_SYSTEM_OTHER_IMAGE := true 429 endif 430 endif 431else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true) 432 BUILDING_SYSTEM_OTHER_IMAGE := true 433 ifndef BUILDING_SYSTEM_IMAGE 434 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image) 435 endif 436endif 437.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE 438 439# Are we building a cache image 440BUILDING_CACHE_IMAGE := 441ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),) 442 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 443 BUILDING_CACHE_IMAGE := true 444 endif 445else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true) 446 BUILDING_CACHE_IMAGE := true 447 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 448 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined) 449 endif 450endif 451.KATI_READONLY := BUILDING_CACHE_IMAGE 452 453# Are we building a boot image 454BUILDING_BOOT_IMAGE := 455ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),) 456 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 457 BUILDING_BOOT_IMAGE := 458 else ifdef BOARD_PREBUILT_BOOTIMAGE 459 BUILDING_BOOT_IMAGE := 460 else ifdef BOARD_BOOTIMAGE_PARTITION_SIZE 461 BUILDING_BOOT_IMAGE := true 462 else ifneq (,$(foreach kernel,$(BOARD_KERNEL_BINARIES),$(BOARD_$(call to-upper,$(kernel))_BOOTIMAGE_PARTITION_SIZE))) 463 BUILDING_BOOT_IMAGE := true 464 endif 465else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true) 466 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 467 $(warning *** PRODUCT_BUILD_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT.) 468 $(warning *** Skipping building boot image.) 469 BUILDING_BOOT_IMAGE := 470 else 471 BUILDING_BOOT_IMAGE := true 472 endif 473endif 474.KATI_READONLY := BUILDING_BOOT_IMAGE 475 476# Are we building an init boot image 477BUILDING_INIT_BOOT_IMAGE := 478ifeq ($(PRODUCT_BUILD_INIT_BOOT_IMAGE),) 479 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 480 BUILDING_INIT_BOOT_IMAGE := 481 else ifdef BOARD_PREBUILT_INIT_BOOT_IMAGE 482 BUILDING_INIT_BOOT_IMAGE := 483 else ifdef BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE 484 BUILDING_INIT_BOOT_IMAGE := true 485 endif 486else ifeq ($(PRODUCT_BUILD_INIT_BOOT_IMAGE),true) 487 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 488 $(error PRODUCT_BUILD_INIT_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT. Use only one option.) 489 else 490 BUILDING_INIT_BOOT_IMAGE := true 491 endif 492endif 493.KATI_READONLY := BUILDING_INIT_BOOT_IMAGE 494 495# Are we building a recovery image 496BUILDING_RECOVERY_IMAGE := 497ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),) 498 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 499 BUILDING_RECOVERY_IMAGE := true 500 else ifeq ($(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT),true) 501 # Set to true to build recovery resources for vendor_boot 502 BUILDING_RECOVERY_IMAGE := true 503 else ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE 504 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) 505 BUILDING_RECOVERY_IMAGE := true 506 endif 507 endif 508else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true) 509 BUILDING_RECOVERY_IMAGE := true 510endif 511.KATI_READONLY := BUILDING_RECOVERY_IMAGE 512 513# Are we building a vendor boot image 514BUILDING_VENDOR_BOOT_IMAGE := 515ifdef BOARD_BOOT_HEADER_VERSION 516 ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),) 517 ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),) 518 BUILDING_VENDOR_BOOT_IMAGE := true 519 else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),true) 520 BUILDING_VENDOR_BOOT_IMAGE := true 521 endif 522 endif 523endif 524.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE 525 526# Are we building a vendor kernel boot image 527BUILDING_VENDOR_KERNEL_BOOT_IMAGE := 528ifeq ($(PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE),true) 529 ifneq ($(BUILDING_VENDOR_BOOT_IMAGE),true) 530 $(error BUILDING_VENDOR_BOOT_IMAGE is required, but BUILDING_VENDOR_BOOT_IMAGE is not true) 531 endif 532 ifndef BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE 533 $(error BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE is required when PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE is true) 534 endif 535 BUILDING_VENDOR_KERNEL_BOOT_IMAGE := true 536else ifeq ($(PRODUCT_BUILD_VENDOR_KERNEL),) 537 ifdef BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE 538 ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true) 539 BUILDING_VENDOR_KERNEL_BOOT_IMAGE := true 540 endif 541 endif 542endif # end of PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE 543.KATI_READONLY := BUILDING_VENDOR_KERNEL_BOOT_IMAGE 544 545# Are we building a ramdisk image 546BUILDING_RAMDISK_IMAGE := true 547ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),) 548 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true: 549 # BUILDING_BOOT_IMAGE 550 # BUILDING_RECOVERY_IMAGE 551else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false) 552 BUILDING_RAMDISK_IMAGE := 553endif 554.KATI_READONLY := BUILDING_RAMDISK_IMAGE 555 556# Are we building a debug vendor_boot image 557BUILDING_DEBUG_VENDOR_BOOT_IMAGE := 558# Can't build vendor_boot-debug.img if we're not building a ramdisk. 559ifndef BUILDING_RAMDISK_IMAGE 560 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true) 561 $(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a ramdisk image. \ 562 Skip building the debug vendor_boot image.) 563 endif 564# Can't build vendor_boot-debug.img if we're not building a vendor_boot.img. 565else ifndef BUILDING_VENDOR_BOOT_IMAGE 566 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true) 567 $(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a vendor_boot image. \ 568 Skip building the debug vendor_boot image.) 569 endif 570else 571 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),) 572 BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true 573 else ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true) 574 BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true 575 endif 576endif 577.KATI_READONLY := BUILDING_DEBUG_VENDOR_BOOT_IMAGE 578 579_has_boot_img_artifact := 580ifneq ($(strip $(TARGET_NO_KERNEL)),true) 581 ifdef BUILDING_BOOT_IMAGE 582 _has_boot_img_artifact := true 583 endif 584 # BUILDING_RECOVERY_IMAGE && BOARD_USES_RECOVERY_AS_BOOT implies that 585 # recovery is being built with the file name *boot.img*, which still counts 586 # as "building boot.img". 587 ifdef BUILDING_RECOVERY_IMAGE 588 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 589 _has_boot_img_artifact := true 590 endif 591 endif 592endif 593 594# Are we building a debug boot image 595BUILDING_DEBUG_BOOT_IMAGE := 596# Can't build boot-debug.img if we're not building a ramdisk. 597ifndef BUILDING_RAMDISK_IMAGE 598 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true) 599 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a ramdisk image. \ 600 Skip building the debug boot image.) 601 endif 602# Can't build boot-debug.img if we're not building a boot.img. 603else ifndef _has_boot_img_artifact 604 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true) 605 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a boot image. \ 606 Skip building the debug boot image.) 607 endif 608else ifdef BUILDING_INIT_BOOT_IMAGE 609 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true) 610 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we don't have a ramdisk in the boot image. \ 611 Skip building the debug boot image.) 612 endif 613else 614 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),) 615 BUILDING_DEBUG_BOOT_IMAGE := true 616 # Don't build boot-debug.img if we're already building vendor_boot-debug.img. 617 ifdef BUILDING_DEBUG_VENDOR_BOOT_IMAGE 618 BUILDING_DEBUG_BOOT_IMAGE := 619 endif 620 else ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true) 621 BUILDING_DEBUG_BOOT_IMAGE := true 622 endif 623endif 624.KATI_READONLY := BUILDING_DEBUG_BOOT_IMAGE 625_has_boot_img_artifact := 626 627# Are we building a userdata image 628BUILDING_USERDATA_IMAGE := 629ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),) 630 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE 631 BUILDING_USERDATA_IMAGE := true 632 endif 633else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true) 634 BUILDING_USERDATA_IMAGE := true 635endif 636.KATI_READONLY := BUILDING_USERDATA_IMAGE 637 638# Are we building a vbmeta image 639BUILDING_VBMETA_IMAGE := true 640ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false) 641 BUILDING_VBMETA_IMAGE := 642endif 643.KATI_READONLY := BUILDING_VBMETA_IMAGE 644 645# Are we building a super_empty image 646BUILDING_SUPER_EMPTY_IMAGE := 647ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),) 648 ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) 649 ifneq ($(BOARD_SUPER_PARTITION_SIZE),) 650 BUILDING_SUPER_EMPTY_IMAGE := true 651 endif 652 endif 653else ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),true) 654 ifneq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) 655 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but PRODUCT_USE_DYNAMIC_PARTITIONS is not true) 656 endif 657 ifeq ($(BOARD_SUPER_PARTITION_SIZE),) 658 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but BOARD_SUPER_PARTITION_SIZE is not defined) 659 endif 660 BUILDING_SUPER_EMPTY_IMAGE := true 661endif 662.KATI_READONLY := BUILDING_SUPER_EMPTY_IMAGE 663 664########################################### 665# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR 666ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) 667 TARGET_COPY_OUT_VENDOR := system/vendor 668else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) 669 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) 670endif 671PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) 672 673BOARD_USES_VENDORIMAGE := 674ifdef BOARD_PREBUILT_VENDORIMAGE 675 BOARD_USES_VENDORIMAGE := true 676endif 677ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 678 BOARD_USES_VENDORIMAGE := true 679endif 680# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image. 681# But target's BOARD_PREBUILT_VENDORIMAGE is not filled. 682ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) 683 BOARD_USES_VENDORIMAGE := true 684else ifdef BOARD_USES_VENDORIMAGE 685 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) 686endif 687.KATI_READONLY := BOARD_USES_VENDORIMAGE 688 689BUILDING_VENDOR_IMAGE := 690ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),) 691 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 692 BUILDING_VENDOR_IMAGE := true 693 endif 694else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true) 695 BUILDING_VENDOR_IMAGE := true 696 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 697 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined) 698 endif 699endif 700ifdef BOARD_PREBUILT_VENDORIMAGE 701 BUILDING_VENDOR_IMAGE := 702endif 703.KATI_READONLY := BUILDING_VENDOR_IMAGE 704 705########################################### 706# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT 707ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) 708TARGET_COPY_OUT_PRODUCT := system/product 709else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) 710$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) 711endif 712PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) 713 714BOARD_USES_PRODUCTIMAGE := 715ifdef BOARD_PREBUILT_PRODUCTIMAGE 716 BOARD_USES_PRODUCTIMAGE := true 717endif 718ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 719 BOARD_USES_PRODUCTIMAGE := true 720endif 721$(call check_image_config,product) 722.KATI_READONLY := BOARD_USES_PRODUCTIMAGE 723 724BUILDING_PRODUCT_IMAGE := 725ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),) 726 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 727 BUILDING_PRODUCT_IMAGE := true 728 endif 729else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true) 730 BUILDING_PRODUCT_IMAGE := true 731 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 732 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined) 733 endif 734endif 735ifdef BOARD_PREBUILT_PRODUCTIMAGE 736 BUILDING_PRODUCT_IMAGE := 737endif 738.KATI_READONLY := BUILDING_PRODUCT_IMAGE 739 740########################################### 741# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to 742# TARGET_COPY_OUT_PRODUCT as a workaround. 743TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT) 744 745########################################### 746# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT 747ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder)) 748TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext 749else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),) 750$(error TARGET_COPY_OUT_SYSTEM_EXT must be either 'system_ext' or 'system/system_ext', seeing '$(TARGET_COPY_OUT_SYSTEM_EXT)'.) 751endif 752PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES)) 753 754BOARD_USES_SYSTEM_EXTIMAGE := 755ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE 756 BOARD_USES_SYSTEM_EXTIMAGE := true 757endif 758ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 759 BOARD_USES_SYSTEM_EXTIMAGE := true 760endif 761$(call check_image_config,system_ext) 762.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE 763 764BUILDING_SYSTEM_EXT_IMAGE := 765ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),) 766 ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 767 BUILDING_SYSTEM_EXT_IMAGE := true 768 endif 769else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true) 770 BUILDING_SYSTEM_EXT_IMAGE := true 771 ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 772 $(error PRODUCT_BUILD_SYSTEM_EXT_IMAGE set to true, but BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE not defined) 773 endif 774endif 775ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE 776 BUILDING_SYSTEM_EXT_IMAGE := 777endif 778.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE 779 780########################################### 781# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM 782ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder)) 783 TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm 784else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),) 785 $(error TARGET_COPY_OUT_VENDOR_DLKM must be either 'vendor_dlkm', 'system/vendor/vendor_dlkm' or 'vendor/vendor_dlkm', seeing '$(TARGET_COPY_OUT_VENDOR_DLKM)'.) 786endif 787PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES)) 788 789BOARD_USES_VENDOR_DLKMIMAGE := 790ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE 791 BOARD_USES_VENDOR_DLKMIMAGE := true 792endif 793ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE 794 BOARD_USES_VENDOR_DLKMIMAGE := true 795endif 796$(call check_image_config,vendor_dlkm) 797 798BUILDING_VENDOR_DLKM_IMAGE := 799ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),) 800 ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE 801 BUILDING_VENDOR_DLKM_IMAGE := true 802 endif 803else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true) 804 BUILDING_VENDOR_DLKM_IMAGE := true 805 ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE 806 $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) 807 endif 808endif 809ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE 810 BUILDING_VENDOR_DLKM_IMAGE := 811endif 812.KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE 813 814########################################### 815# Now we can substitute with the real value of TARGET_COPY_OUT_ODM 816ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) 817 TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm 818else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),) 819 $(error TARGET_COPY_OUT_ODM must be either 'odm', 'system/vendor/odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.) 820endif 821PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES)) 822 823BOARD_USES_ODMIMAGE := 824ifdef BOARD_PREBUILT_ODMIMAGE 825 BOARD_USES_ODMIMAGE := true 826endif 827ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 828 BOARD_USES_ODMIMAGE := true 829endif 830$(call check_image_config,odm) 831 832BUILDING_ODM_IMAGE := 833ifeq ($(PRODUCT_BUILD_ODM_IMAGE),) 834 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 835 BUILDING_ODM_IMAGE := true 836 endif 837else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true) 838 BUILDING_ODM_IMAGE := true 839 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 840 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined) 841 endif 842endif 843ifdef BOARD_PREBUILT_ODMIMAGE 844 BUILDING_ODM_IMAGE := 845endif 846.KATI_READONLY := BUILDING_ODM_IMAGE 847 848 849########################################### 850# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM 851ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder)) 852 TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm 853else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),) 854 $(error TARGET_COPY_OUT_ODM_DLKM must be either 'odm_dlkm', 'system/vendor/odm_dlkm' or 'vendor/odm_dlkm', seeing '$(TARGET_COPY_OUT_ODM_DLKM)'.) 855endif 856PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES)) 857 858BOARD_USES_ODM_DLKMIMAGE := 859ifdef BOARD_PREBUILT_ODM_DLKMIMAGE 860 BOARD_USES_ODM_DLKMIMAGE := true 861endif 862ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE 863 BOARD_USES_ODM_DLKMIMAGE := true 864endif 865$(call check_image_config,odm_dlkm) 866 867BUILDING_ODM_DLKM_IMAGE := 868ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),) 869 ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE 870 BUILDING_ODM_DLKM_IMAGE := true 871 endif 872else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true) 873 BUILDING_ODM_DLKM_IMAGE := true 874 ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE 875 $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) 876 endif 877endif 878ifdef BOARD_PREBUILT_ODM_DLKMIMAGE 879 BUILDING_ODM_DLKM_IMAGE := 880endif 881.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE 882 883########################################### 884# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_DLKM 885ifeq ($(TARGET_COPY_OUT_SYSTEM_DLKM),$(_system_dlkm_path_placeholder)) 886 TARGET_COPY_OUT_SYSTEM_DLKM := $(TARGET_COPY_OUT_SYSTEM)/system_dlkm 887else ifeq ($(filter system_dlkm system/system_dlkm,$(TARGET_COPY_OUT_SYSTEM_DLKM)),) 888 $(error TARGET_COPY_OUT_SYSTEM_DLKM must be either 'system_dlkm' or 'system/system_dlkm', seeing '$(TARGET_COPY_OUT_ODM_DLKM)'.) 889endif 890PRODUCT_COPY_FILES := $(subst $(_system_dlkm_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_DLKM),$(PRODUCT_COPY_FILES)) 891 892BOARD_USES_SYSTEM_DLKMIMAGE := 893ifdef BOARD_PREBUILT_SYSTEM_DLKMIMAGE 894 BOARD_USES_SYSTEM_DLKMIMAGE := true 895endif 896ifdef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE 897 BOARD_USES_SYSTEM_DLKMIMAGE := true 898endif 899$(call check_image_config,system_dlkm) 900 901BUILDING_SYSTEM_DLKM_IMAGE := 902ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),) 903 ifdef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE 904 BUILDING_SYSTEM_DLKM_IMAGE := true 905 endif 906else ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),true) 907 BUILDING_SYSTEM_DLKM_IMAGE := true 908 ifndef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE 909 $(error PRODUCT_BUILD_SYSTEM_DLKM_IMAGE set to true, but BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) 910 endif 911endif 912ifdef BOARD_PREBUILT_SYSTEM_DLKMIMAGE 913 BUILDING_SYSTEM_DLKM_IMAGE := 914endif 915.KATI_READONLY := BUILDING_SYSTEM_DLKM_IMAGE 916 917BOARD_USES_PVMFWIMAGE := 918ifeq ($(PRODUCT_BUILD_PVMFW_IMAGE),true) 919 BOARD_USES_PVMFWIMAGE := true 920endif 921.KATI_READONLY := BOARD_USES_PVMFWIMAGE 922 923########################################### 924# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE. 925TARGET_RECOVERY_UPDATER_LIBS ?= 926AB_OTA_UPDATER ?= 927.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER 928 929# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true 930ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true) 931 ifneq ($(AB_OTA_UPDATER),true) 932 $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true) 933 endif 934endif 935 936# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB 937# to see if non-A/B is supported. 938TARGET_OTA_ALLOW_NON_AB := false 939ifneq ($(AB_OTA_UPDATER),true) 940 TARGET_OTA_ALLOW_NON_AB := true 941else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true) 942 TARGET_OTA_ALLOW_NON_AB := true 943endif 944.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB 945 946ifneq ($(TARGET_OTA_ALLOW_NON_AB),true) 947 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) 948 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB) 949 endif 950endif 951 952# For Non A/B full OTA, disable brotli compression. 953ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) 954 BOARD_NON_AB_OTA_DISABLE_COMPRESSION := true 955endif 956 957# Quick check for building generic OTA packages. Currently it only supports A/B OTAs. 958ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) 959 ifneq ($(AB_OTA_UPDATER),true) 960 $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported) 961 endif 962endif 963 964ifdef BOARD_PREBUILT_DTBIMAGE_DIR 965 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true) 966 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported) 967 endif 968endif 969 970# Check BOARD_VNDK_VERSION 971define check_vndk_version 972 $(eval vndk_path := prebuilts/vndk/v$(1)) \ 973 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) 974endef 975 976TARGET_VENDOR_TEST_SUFFIX := /vendor 977 978ifeq (,$(TARGET_BUILD_UNBUNDLED)) 979ifdef PRODUCT_EXTRA_VNDK_VERSIONS 980 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) 981endif 982endif 983 984# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS 985_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) 986ifneq (,$(_unsupported_systemsdk_versions)) 987 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ 988 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) 989endif 990 991########################################### 992# BOARD_API_LEVEL for vendor API surface 993ifdef RELEASE_BOARD_API_LEVEL 994 ifdef BOARD_API_LEVEL 995 $(error BOARD_API_LEVEL must not be set manually. The build system automatically sets this value.) 996 endif 997 BOARD_API_LEVEL := $(RELEASE_BOARD_API_LEVEL) 998 .KATI_READONLY := BOARD_API_LEVEL 999endif 1000 1001########################################### 1002# Handle BUILD_BROKEN_USES_BUILD_* 1003 1004$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\ 1005 $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\ 1006 $(KATI_obsolete_var $(m),Please convert to Soong),\ 1007 $(KATI_deprecated_var $(m),Please convert to Soong))) 1008 1009$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\ 1010 $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)\#copy_headers),\ 1011 $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)\#copy_headers)) 1012 1013$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\ 1014 $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\ 1015 $(KATI_deprecated_var $(m),Please convert to Soong),\ 1016 $(KATI_obsolete_var $(m),Please convert to Soong))) 1017 1018ifndef BUILDING_RECOVERY_IMAGE 1019 ifeq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE)) 1020 $(error Should not set BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE if not building recovery image) 1021 endif 1022endif 1023 1024ifndef BUILDING_VENDOR_BOOT_IMAGE 1025 ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)) 1026 $(error Should not set BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT if not building vendor_boot image) 1027 endif 1028 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS 1029 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if not building vendor_boot image) 1030 endif 1031else # BUILDING_VENDOR_BOOT_IMAGE 1032 ifneq (,$(call math_lt,$(BOARD_BOOT_HEADER_VERSION),4)) 1033 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS 1034 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if \ 1035 BOARD_BOOT_HEADER_VERSION is less than 4) 1036 endif 1037 ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT)) 1038 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \ 1039 BOARD_BOOT_HEADER_VERSION is less than 4) 1040 endif 1041 endif 1042endif # BUILDING_VENDOR_BOOT_IMAGE 1043 1044ifneq ($(words $(BOARD_VENDOR_RAMDISK_FRAGMENTS)),$(words $(sort $(BOARD_VENDOR_RAMDISK_FRAGMENTS)))) 1045 $(error BOARD_VENDOR_RAMDISK_FRAGMENTS has duplicate entries: $(BOARD_VENDOR_RAMDISK_FRAGMENTS)) 1046endif 1047 1048ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT)) 1049 ifneq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)) 1050 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \ 1051 BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set) 1052 endif 1053endif 1054 1055# If BOARD_USES_GENERIC_KERNEL_IMAGE is set, BOARD_USES_RECOVERY_AS_BOOT must not be set. 1056# Devices without a dedicated recovery partition uses BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT to 1057# build recovery into vendor_boot. 1058ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE)) 1059 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT)) 1060 $(error BOARD_USES_RECOVERY_AS_BOOT cannot be true if BOARD_USES_GENERIC_KERNEL_IMAGE is true. \ 1061 Use BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT instead) 1062 endif 1063endif 1064 1065ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)) 1066 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT)) 1067 $(error BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT and BOARD_USES_RECOVERY_AS_BOOT cannot be \ 1068 both true. Recovery resources should be installed to either boot or vendor_boot, but not both) 1069 endif 1070endif 1071