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 sanity-checks the variable defined therein. 20# ############################################################### 21 22_board_strip_readonly_list := \ 23 BOARD_EGL_CFG \ 24 BOARD_HAVE_BLUETOOTH \ 25 BOARD_INSTALLER_CMDLINE \ 26 BOARD_KERNEL_CMDLINE \ 27 BOARD_KERNEL_BASE \ 28 BOARD_USES_GENERIC_AUDIO \ 29 BOARD_VENDOR_USE_AKMD \ 30 BOARD_WPA_SUPPLICANT_DRIVER \ 31 BOARD_WLAN_DEVICE \ 32 TARGET_ARCH \ 33 TARGET_ARCH_VARIANT \ 34 TARGET_CPU_ABI \ 35 TARGET_CPU_ABI2 \ 36 TARGET_CPU_VARIANT \ 37 TARGET_CPU_VARIANT_RUNTIME \ 38 TARGET_2ND_ARCH \ 39 TARGET_2ND_ARCH_VARIANT \ 40 TARGET_2ND_CPU_ABI \ 41 TARGET_2ND_CPU_ABI2 \ 42 TARGET_2ND_CPU_VARIANT \ 43 TARGET_2ND_CPU_VARIANT_RUNTIME \ 44 TARGET_BOARD_PLATFORM \ 45 TARGET_BOARD_PLATFORM_GPU \ 46 TARGET_BOOTLOADER_BOARD_NAME \ 47 TARGET_FS_CONFIG_GEN \ 48 TARGET_NO_BOOTLOADER \ 49 TARGET_NO_KERNEL \ 50 TARGET_NO_RECOVERY \ 51 TARGET_NO_RADIOIMAGE \ 52 TARGET_HARDWARE_3D \ 53 WITH_DEXPREOPT \ 54 55# File system variables 56_board_strip_readonly_list += \ 57 BOARD_FLASH_BLOCK_SIZE \ 58 BOARD_BOOTIMAGE_PARTITION_SIZE \ 59 BOARD_RECOVERYIMAGE_PARTITION_SIZE \ 60 BOARD_SYSTEMIMAGE_PARTITION_SIZE \ 61 BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE \ 62 BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \ 63 BOARD_USERDATAIMAGE_PARTITION_SIZE \ 64 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ 65 BOARD_CACHEIMAGE_PARTITION_SIZE \ 66 BOARD_VENDORIMAGE_PARTITION_SIZE \ 67 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \ 68 BOARD_PRODUCTIMAGE_PARTITION_SIZE \ 69 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \ 70 BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE \ 71 BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE \ 72 BOARD_ODMIMAGE_PARTITION_SIZE \ 73 BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \ 74 75# Logical partitions related variables. 76_dynamic_partitions_var_list += \ 77 BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \ 78 BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ 79 BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \ 80 BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \ 81 BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE \ 82 BOARD_SUPER_PARTITION_SIZE \ 83 BOARD_SUPER_PARTITION_GROUPS \ 84 85_board_strip_readonly_list += $(_dynamic_partitions_var_list) 86 87_build_broken_var_list := \ 88 BUILD_BROKEN_ANDROIDMK_EXPORTS \ 89 BUILD_BROKEN_DUP_COPY_HEADERS \ 90 BUILD_BROKEN_DUP_RULES \ 91 BUILD_BROKEN_PHONY_TARGETS \ 92 BUILD_BROKEN_ENG_DEBUG_TAGS \ 93 BUILD_BROKEN_USES_NETWORK \ 94 95_board_true_false_vars := $(_build_broken_var_list) 96_board_strip_readonly_list += $(_build_broken_var_list) 97 98# Conditional to building on linux, as dex2oat currently does not work on darwin. 99ifeq ($(HOST_OS),linux) 100 WITH_DEXPREOPT := true 101endif 102 103# ############################################################### 104# Broken build defaults 105# ############################################################### 106$(foreach v,$(_build_broken_var_list),$(eval $(v) :=)) 107 108# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) 109# or under vendor/*/$(TARGET_DEVICE). Search in both places, but 110# make sure only one exists. 111# Real boards should always be associated with an OEM vendor. 112ifdef TARGET_DEVICE_DIR 113 ifneq ($(origin TARGET_DEVICE_DIR),command line) 114 $(error TARGET_DEVICE_DIR may not be set manually) 115 endif 116 board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk 117else 118 board_config_mk := \ 119 $(strip $(sort $(wildcard \ 120 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ 121 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 122 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 123 ))) 124 ifeq ($(board_config_mk),) 125 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) 126 endif 127 ifneq ($(words $(board_config_mk)),1) 128 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) 129 endif 130 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) 131 .KATI_READONLY := TARGET_DEVICE_DIR 132endif 133include $(board_config_mk) 134ifeq ($(TARGET_ARCH),) 135 $(error TARGET_ARCH not defined by board config: $(board_config_mk)) 136endif 137ifneq ($(MALLOC_IMPL),) 138 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).) 139 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory) 140endif 141board_config_mk := 142 143# Clean up and verify BoardConfig variables 144$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var))))) 145$(foreach var,$(_board_true_false_vars), \ 146 $(if $(filter-out true false,$($(var))), \ 147 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))"))) 148 149# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified. 150TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT)) 151TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT)) 152 153# The combo makefiles sanity-check and set defaults for various CPU configuration 154combo_target := TARGET_ 155combo_2nd_arch_prefix := 156include $(BUILD_SYSTEM)/combo/select.mk 157 158ifdef TARGET_2ND_ARCH 159 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 160 include $(BUILD_SYSTEM)/combo/select.mk 161endif 162 163.KATI_READONLY := $(_board_strip_readonly_list) 164 165INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE) 166ifeq ($(TARGET_CPU_ABI),) 167 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) 168endif 169ifneq ($(filter %64,$(TARGET_ARCH)),) 170 TARGET_IS_64_BIT := true 171endif 172 173ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) 174 TARGET_SUPPORTS_32_BIT_APPS := true 175endif 176 177# Sanity check to warn about likely cryptic errors later in the build. 178ifeq ($(TARGET_IS_64_BIT),true) 179 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) 180 $(warning Building a 32-bit-app-only product on a 64-bit device. \ 181 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) 182 endif 183endif 184 185# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are 186# comma separated lists of the 32 and 64 bit ABIs (in order of 187# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT 188# are defined by the board config, we use them. Else, we construct 189# these lists based on whether TARGET_IS_64_BIT is set. 190# 191# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target 192# is always 32 bits. If this isn't the case, these variables should 193# be overriden in the board configuration. 194ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) 195 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) 196 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 197 endif 198endif 199 200ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) 201 ifneq (true,$(TARGET_IS_64_BIT)) 202 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 203 else 204 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) 205 # For a 64 bit target, assume that the 2ND_CPU_ABI 206 # is a 32 bit ABI. 207 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) 208 endif 209 endif 210endif 211 212# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order 213# of preference) that the target supports. If a TARGET_CPU_ABI_LIST 214# is specified by the board configuration, we use that. If not, we 215# build a list out of the TARGET_CPU_ABIs specified by the config. 216ifeq (,$(TARGET_CPU_ABI_LIST)) 217 ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true) 218 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) 219 else 220 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) 221 endif 222endif 223 224# Strip whitespace from the ABI list string. 225TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) 226TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) 227TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) 228 229ifneq ($(BUILD_BROKEN_ANDROIDMK_EXPORTS),true) 230$(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword) 231endif 232 233########################################### 234# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK 235ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 236TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT) 237endif 238 239########################################### 240# Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK 241ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 242TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk 243endif 244 245########################################### 246# Configure whether we're building the system image 247BUILDING_SYSTEM_IMAGE := true 248ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),) 249 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE 250 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE 251 BUILDING_SYSTEM_IMAGE := 252 endif 253 endif 254else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false) 255 BUILDING_SYSTEM_IMAGE := 256endif 257.KATI_READONLY := BUILDING_SYSTEM_IMAGE 258 259# Are we building a system_other image 260BUILDING_SYSTEM_OTHER_IMAGE := 261ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),) 262 ifdef BUILDING_SYSTEM_IMAGE 263 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) 264 BUILDING_SYSTEM_OTHER_IMAGE := true 265 endif 266 endif 267else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true) 268 BUILDING_SYSTEM_OTHER_IMAGE := true 269 ifndef BUILDING_SYSTEM_IMAGE 270 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image) 271 endif 272endif 273.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE 274 275# Are we building a cache image 276BUILDING_CACHE_IMAGE := 277ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),) 278 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 279 BUILDING_CACHE_IMAGE := true 280 endif 281else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true) 282 BUILDING_CACHE_IMAGE := true 283 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 284 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined) 285 endif 286endif 287.KATI_READONLY := BUILDING_CACHE_IMAGE 288 289# TODO: Add BUILDING_BOOT_IMAGE / BUILDING_RECOVERY_IMAGE 290# This gets complicated with BOARD_USES_RECOVERY_AS_BOOT, so skipping for now. 291 292# Are we building a ramdisk image 293BUILDING_RAMDISK_IMAGE := true 294ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),) 295 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true: 296 # BUILDING_BOOT_IMAGE 297 # BUILDING_RECOVERY_IMAGE 298else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false) 299 BUILDING_RAMDISK_IMAGE := 300endif 301.KATI_READONLY := BUILDING_RAMDISK_IMAGE 302 303# Are we building a userdata image 304BUILDING_USERDATA_IMAGE := 305ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),) 306 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE 307 BUILDING_USERDATA_IMAGE := true 308 endif 309else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true) 310 BUILDING_USERDATA_IMAGE := true 311endif 312.KATI_READONLY := BUILDING_USERDATA_IMAGE 313 314########################################### 315# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR 316ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) 317 TARGET_COPY_OUT_VENDOR := system/vendor 318else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) 319 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) 320endif 321PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) 322 323BOARD_USES_VENDORIMAGE := 324ifdef BOARD_PREBUILT_VENDORIMAGE 325 BOARD_USES_VENDORIMAGE := true 326endif 327ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 328 BOARD_USES_VENDORIMAGE := true 329endif 330ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) 331 BOARD_USES_VENDORIMAGE := true 332else ifdef BOARD_USES_VENDORIMAGE 333 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) 334endif 335.KATI_READONLY := BOARD_USES_VENDORIMAGE 336 337BUILDING_VENDOR_IMAGE := 338ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),) 339 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 340 BUILDING_VENDOR_IMAGE := true 341 endif 342else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true) 343 BUILDING_VENDOR_IMAGE := true 344 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 345 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined) 346 endif 347endif 348ifdef BOARD_PREBUILT_VENDORIMAGE 349 BUILDING_VENDOR_IMAGE := 350endif 351.KATI_READONLY := BUILDING_VENDOR_IMAGE 352 353########################################### 354# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT 355ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) 356TARGET_COPY_OUT_PRODUCT := system/product 357else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) 358$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) 359endif 360PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) 361 362BOARD_USES_PRODUCTIMAGE := 363ifdef BOARD_PREBUILT_PRODUCTIMAGE 364 BOARD_USES_PRODUCTIMAGE := true 365endif 366ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 367 BOARD_USES_PRODUCTIMAGE := true 368endif 369ifeq ($(TARGET_COPY_OUT_PRODUCT),product) 370 BOARD_USES_PRODUCTIMAGE := true 371else ifdef BOARD_USES_PRODUCTIMAGE 372 $(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image) 373endif 374.KATI_READONLY := BOARD_USES_PRODUCTIMAGE 375 376BUILDING_PRODUCT_IMAGE := 377ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),) 378 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 379 BUILDING_PRODUCT_IMAGE := true 380 endif 381else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true) 382 BUILDING_PRODUCT_IMAGE := true 383 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 384 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined) 385 endif 386endif 387ifdef BOARD_PREBUILT_PRODUCTIMAGE 388 BUILDING_PRODUCT_IMAGE := 389endif 390.KATI_READONLY := BUILDING_PRODUCT_IMAGE 391 392########################################### 393# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT_SERVICES 394MERGE_PRODUCT_SERVICES_INTO_PRODUCT := 395ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),$(_product_services_path_placeholder)) 396 TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT) 397 MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true 398else ifeq ($(TARGET_COPY_OUT_PRODUCT),$(TARGET_COPY_OUT_PRODUCT_SERVICES)) 399 MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true 400else ifeq ($(filter system/product_services,$(TARGET_COPY_OUT_PRODUCT_SERVICES)),) 401 $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either '$(TARGET_COPY_OUT_PRODUCT)'\ 402 or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.) 403endif 404.KATI_READONLY := MERGE_PRODUCT_SERVICES_INTO_PRODUCT 405PRODUCT_COPY_FILES := $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),$(PRODUCT_COPY_FILES)) 406 407BOARD_USES_PRODUCT_SERVICESIMAGE := 408ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE 409 BOARD_USES_PRODUCT_SERVICESIMAGE := true 410endif 411ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE 412 BOARD_USES_PRODUCT_SERVICESIMAGE := true 413endif 414ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),product_services) 415 BOARD_USES_PRODUCT_SERVICESIMAGE := true 416else ifdef BOARD_USES_PRODUCT_SERVICESIMAGE 417 $(error A 'product_services' partition should not be used. Use 'system/product_services' instead.) 418endif 419 420BUILDING_PRODUCT_SERVICES_IMAGE := 421ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),) 422 ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE 423 BUILDING_PRODUCT_SERVICES_IMAGE := true 424 endif 425else ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),true) 426 BUILDING_PRODUCT_SERVICES_IMAGE := true 427 ifndef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE 428 $(error PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE set to true, but BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE not defined) 429 endif 430endif 431ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE 432 BUILDING_PRODUCT_SERVICES_IMAGE := 433endif 434.KATI_READONLY := BUILDING_PRODUCT_SERVICES_IMAGE 435 436########################################### 437# Now we can substitute with the real value of TARGET_COPY_OUT_ODM 438ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) 439 TARGET_COPY_OUT_ODM := vendor/odm 440else ifeq ($(filter odm vendor/odm,$(TARGET_COPY_OUT_ODM)),) 441 $(error TARGET_COPY_OUT_ODM must be either 'odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.) 442endif 443PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES)) 444 445BOARD_USES_ODMIMAGE := 446ifdef BOARD_PREBUILT_ODMIMAGE 447 BOARD_USES_ODMIMAGE := true 448endif 449ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 450 BOARD_USES_ODMIMAGE := true 451endif 452ifeq ($(TARGET_COPY_OUT_ODM),odm) 453 BOARD_USES_ODMIMAGE := true 454else ifdef BOARD_USES_ODMIMAGE 455 $(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image) 456endif 457 458BUILDING_ODM_IMAGE := 459ifeq ($(PRODUCT_BUILD_ODM_IMAGE),) 460 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 461 BUILDING_ODM_IMAGE := true 462 endif 463else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true) 464 BUILDING_ODM_IMAGE := true 465 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 466 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined) 467 endif 468endif 469ifdef BOARD_PREBUILT_ODMIMAGE 470 BUILDING_ODM_IMAGE := 471endif 472.KATI_READONLY := BUILDING_ODM_IMAGE 473 474########################################### 475# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set. 476TARGET_RECOVERY_UPDATER_LIBS ?= 477AB_OTA_UPDATER ?= 478.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER 479ifeq ($(AB_OTA_UPDATER),true) 480 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) 481 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER) 482 endif 483endif 484 485ifdef BOARD_PREBUILT_DTBIMAGE_DIR 486 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true) 487 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported) 488 endif 489endif 490 491# Check BOARD_VNDK_VERSION 492define check_vndk_version 493 $(eval vndk_path := prebuilts/vndk/v$(1)) \ 494 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) 495endef 496 497ifdef BOARD_VNDK_VERSION 498 ifneq ($(BOARD_VNDK_VERSION),current) 499 $(error BOARD_VNDK_VERSION: Only "current" is implemented) 500 endif 501 502 TARGET_VENDOR_TEST_SUFFIX := /vendor 503else 504 TARGET_VENDOR_TEST_SUFFIX := 505endif 506 507########################################### 508# APEXes are by default flattened, i.e. non-updatable. 509# It can be unflattened (and updatable) by inheriting from 510# updatable_apex.mk 511ifeq (,$(TARGET_FLATTEN_APEX)) 512TARGET_FLATTEN_APEX := true 513endif 514 515ifeq (,$(TARGET_BUILD_APPS)) 516ifdef PRODUCT_EXTRA_VNDK_VERSIONS 517 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) 518endif 519endif 520 521# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS 522_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) 523ifneq (,$(_unsupported_systemsdk_versions)) 524 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ 525 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) 526endif 527