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_USES_RECOVERY_AS_BOOT \ 30 BOARD_VENDOR_USE_AKMD \ 31 BOARD_WPA_SUPPLICANT_DRIVER \ 32 BOARD_WLAN_DEVICE \ 33 TARGET_ARCH \ 34 TARGET_ARCH_VARIANT \ 35 TARGET_CPU_ABI \ 36 TARGET_CPU_ABI2 \ 37 TARGET_CPU_VARIANT \ 38 TARGET_CPU_VARIANT_RUNTIME \ 39 TARGET_2ND_ARCH \ 40 TARGET_2ND_ARCH_VARIANT \ 41 TARGET_2ND_CPU_ABI \ 42 TARGET_2ND_CPU_ABI2 \ 43 TARGET_2ND_CPU_VARIANT \ 44 TARGET_2ND_CPU_VARIANT_RUNTIME \ 45 TARGET_BOARD_PLATFORM \ 46 TARGET_BOARD_PLATFORM_GPU \ 47 TARGET_BOOTLOADER_BOARD_NAME \ 48 TARGET_FS_CONFIG_GEN \ 49 TARGET_NO_BOOTLOADER \ 50 TARGET_NO_KERNEL \ 51 TARGET_NO_RECOVERY \ 52 TARGET_NO_RADIOIMAGE \ 53 TARGET_HARDWARE_3D \ 54 WITH_DEXPREOPT \ 55 56# File system variables 57_board_strip_readonly_list += \ 58 BOARD_FLASH_BLOCK_SIZE \ 59 BOARD_BOOTIMAGE_PARTITION_SIZE \ 60 BOARD_RECOVERYIMAGE_PARTITION_SIZE \ 61 BOARD_SYSTEMIMAGE_PARTITION_SIZE \ 62 BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE \ 63 BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \ 64 BOARD_USERDATAIMAGE_PARTITION_SIZE \ 65 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ 66 BOARD_CACHEIMAGE_PARTITION_SIZE \ 67 BOARD_VENDORIMAGE_PARTITION_SIZE \ 68 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \ 69 BOARD_PRODUCTIMAGE_PARTITION_SIZE \ 70 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \ 71 BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE \ 72 BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE \ 73 BOARD_ODMIMAGE_PARTITION_SIZE \ 74 BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \ 75 76# Logical partitions related variables. 77_dynamic_partitions_var_list += \ 78 BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \ 79 BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ 80 BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \ 81 BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \ 82 BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \ 83 BOARD_SUPER_PARTITION_SIZE \ 84 BOARD_SUPER_PARTITION_GROUPS \ 85 86_board_strip_readonly_list += $(_dynamic_partitions_var_list) 87 88_build_broken_var_list := \ 89 BUILD_BROKEN_DUP_RULES \ 90 BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \ 91 BUILD_BROKEN_PREBUILT_ELF_FILES \ 92 BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \ 93 BUILD_BROKEN_USES_NETWORK \ 94 BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \ 95 96_build_broken_var_list += \ 97 $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \ 98 $(DEFAULT_WARNING_BUILD_MODULE_TYPES) \ 99 $(DEFAULT_ERROR_BUILD_MODULE_TYPES), \ 100 BUILD_BROKEN_USES_$(m)) 101 102_board_true_false_vars := $(_build_broken_var_list) 103_board_strip_readonly_list += $(_build_broken_var_list) \ 104 BUILD_BROKEN_NINJA_USES_ENV_VARS 105 106# Conditional to building on linux, as dex2oat currently does not work on darwin. 107ifeq ($(HOST_OS),linux) 108 WITH_DEXPREOPT := true 109endif 110 111# ############################################################### 112# Broken build defaults 113# ############################################################### 114$(foreach v,$(_build_broken_var_list),$(eval $(v) :=)) 115BUILD_BROKEN_NINJA_USES_ENV_VARS := 116 117# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) 118# or under vendor/*/$(TARGET_DEVICE). Search in both places, but 119# make sure only one exists. 120# Real boards should always be associated with an OEM vendor. 121ifdef TARGET_DEVICE_DIR 122 ifneq ($(origin TARGET_DEVICE_DIR),command line) 123 $(error TARGET_DEVICE_DIR may not be set manually) 124 endif 125 board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk 126else 127 board_config_mk := \ 128 $(strip $(sort $(wildcard \ 129 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ 130 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 131 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 132 ))) 133 ifeq ($(board_config_mk),) 134 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) 135 endif 136 ifneq ($(words $(board_config_mk)),1) 137 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) 138 endif 139 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) 140 .KATI_READONLY := TARGET_DEVICE_DIR 141endif 142include $(board_config_mk) 143ifeq ($(TARGET_ARCH),) 144 $(error TARGET_ARCH not defined by board config: $(board_config_mk)) 145endif 146ifneq ($(MALLOC_IMPL),) 147 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).) 148 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory) 149endif 150board_config_mk := 151 152# Clean up and verify BoardConfig variables 153$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var))))) 154$(foreach var,$(_board_true_false_vars), \ 155 $(if $(filter-out true false,$($(var))), \ 156 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))"))) 157 158# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified. 159TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT)) 160TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT)) 161 162# The combo makefiles sanity-check and set defaults for various CPU configuration 163combo_target := TARGET_ 164combo_2nd_arch_prefix := 165include $(BUILD_SYSTEM)/combo/select.mk 166 167ifdef TARGET_2ND_ARCH 168 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 169 include $(BUILD_SYSTEM)/combo/select.mk 170endif 171 172.KATI_READONLY := $(_board_strip_readonly_list) 173 174INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE) 175ifeq ($(TARGET_CPU_ABI),) 176 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) 177endif 178ifneq ($(filter %64,$(TARGET_ARCH)),) 179 TARGET_IS_64_BIT := true 180endif 181 182ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) 183 TARGET_SUPPORTS_32_BIT_APPS := true 184endif 185 186# Sanity check to warn about likely cryptic errors later in the build. 187ifeq ($(TARGET_IS_64_BIT),true) 188 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) 189 $(error Building a 32-bit-app-only product on a 64-bit device. \ 190 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) 191 endif 192endif 193 194# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are 195# comma separated lists of the 32 and 64 bit ABIs (in order of 196# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT 197# are defined by the board config, we use them. Else, we construct 198# these lists based on whether TARGET_IS_64_BIT is set. 199# 200# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target 201# is always 32 bits. If this isn't the case, these variables should 202# be overriden in the board configuration. 203# 204# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always 205# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs. 206_target_native_bridge_abi_list_32_bit := 207_target_native_bridge_abi_list_64_bit := 208 209ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) 210 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) 211 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 212 _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI) 213 endif 214endif 215 216# "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported 217# in all builds with SANITIZE_TARGET=hwaddress. 218ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),) 219 ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),) 220 TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT) 221 endif 222endif 223 224ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) 225 ifneq (true,$(TARGET_IS_64_BIT)) 226 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 227 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI) 228 else 229 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) 230 # For a 64 bit target, assume that the 2ND_CPU_ABI 231 # is a 32 bit ABI. 232 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) 233 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI) 234 endif 235 endif 236endif 237 238# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order 239# of preference) that the target supports. If a TARGET_CPU_ABI_LIST 240# is specified by the board configuration, we use that. If not, we 241# build a list out of the TARGET_CPU_ABIs specified by the config. 242# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference. 243ifeq (,$(TARGET_CPU_ABI_LIST)) 244 ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true) 245 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) \ 246 $(_target_native_bridge_abi_list_32_bit) $(_target_native_bridge_abi_list_64_bit) 247 else 248 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \ 249 $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit) 250 endif 251endif 252 253# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference. 254TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit) 255TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit) 256 257# Strip whitespace from the ABI list string. 258TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) 259TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) 260TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) 261 262# Check if config about image building is valid or not. 263define check_image_config 264 $(eval _uc_name := $(call to-upper,$(1))) \ 265 $(eval _lc_name := $(call to-lower,$(1))) \ 266 $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \ 267 $(if $(BOARD_USES_$(_uc_name)IMAGE),, \ 268 $(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)), \ 269 $(if $(BOARD_USES_$(_uc_name)IMAGE), \ 270 $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \ 271 $(eval _uc_name :=) \ 272 $(eval _lc_name :=) 273endef 274 275########################################### 276# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK 277ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 278TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT) 279endif 280 281########################################### 282# Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK 283ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 284TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk 285TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK := vendor_debug_ramdisk/first_stage_ramdisk 286TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk/first_stage_ramdisk 287endif 288 289########################################### 290# Configure whether we're building the system image 291BUILDING_SYSTEM_IMAGE := true 292ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),) 293 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE 294 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE 295 BUILDING_SYSTEM_IMAGE := 296 endif 297 endif 298else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false) 299 BUILDING_SYSTEM_IMAGE := 300endif 301.KATI_READONLY := BUILDING_SYSTEM_IMAGE 302 303# Are we building a system_other image 304BUILDING_SYSTEM_OTHER_IMAGE := 305ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),) 306 ifdef BUILDING_SYSTEM_IMAGE 307 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) 308 BUILDING_SYSTEM_OTHER_IMAGE := true 309 endif 310 endif 311else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true) 312 BUILDING_SYSTEM_OTHER_IMAGE := true 313 ifndef BUILDING_SYSTEM_IMAGE 314 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image) 315 endif 316endif 317.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE 318 319# Are we building a cache image 320BUILDING_CACHE_IMAGE := 321ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),) 322 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 323 BUILDING_CACHE_IMAGE := true 324 endif 325else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true) 326 BUILDING_CACHE_IMAGE := true 327 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE 328 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined) 329 endif 330endif 331.KATI_READONLY := BUILDING_CACHE_IMAGE 332 333# Are we building a boot image 334BUILDING_BOOT_IMAGE := 335ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 336 BUILDING_BOOT_IMAGE := 337else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),) 338 ifdef BOARD_BOOTIMAGE_PARTITION_SIZE 339 BUILDING_BOOT_IMAGE := true 340 endif 341else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true) 342 BUILDING_BOOT_IMAGE := true 343endif 344.KATI_READONLY := BUILDING_BOOT_IMAGE 345 346# Are we building a recovery image 347BUILDING_RECOVERY_IMAGE := 348ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 349 BUILDING_RECOVERY_IMAGE := true 350else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),) 351 ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE 352 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) 353 BUILDING_RECOVERY_IMAGE := true 354 endif 355 endif 356else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true) 357 BUILDING_RECOVERY_IMAGE := true 358endif 359.KATI_READONLY := BUILDING_RECOVERY_IMAGE 360 361# Are we building a vendor boot image 362BUILDING_VENDOR_BOOT_IMAGE := 363ifdef BOARD_BOOT_HEADER_VERSION 364 ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),) 365 ifneq ($(TARGET_NO_VENDOR_BOOT),true) 366 BUILDING_VENDOR_BOOT_IMAGE := true 367 endif 368 endif 369endif 370.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE 371 372# Are we building a ramdisk image 373BUILDING_RAMDISK_IMAGE := true 374ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),) 375 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true: 376 # BUILDING_BOOT_IMAGE 377 # BUILDING_RECOVERY_IMAGE 378else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false) 379 BUILDING_RAMDISK_IMAGE := 380endif 381.KATI_READONLY := BUILDING_RAMDISK_IMAGE 382 383# Are we building a userdata image 384BUILDING_USERDATA_IMAGE := 385ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),) 386 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE 387 BUILDING_USERDATA_IMAGE := true 388 endif 389else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true) 390 BUILDING_USERDATA_IMAGE := true 391endif 392.KATI_READONLY := BUILDING_USERDATA_IMAGE 393 394# Are we building a vbmeta image 395BUILDING_VBMETA_IMAGE := true 396ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false) 397 BUILDING_VBMETA_IMAGE := 398endif 399.KATI_READONLY := BUILDING_VBMETA_IMAGE 400 401########################################### 402# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR 403ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) 404 TARGET_COPY_OUT_VENDOR := system/vendor 405else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) 406 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) 407endif 408PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) 409 410BOARD_USES_VENDORIMAGE := 411ifdef BOARD_PREBUILT_VENDORIMAGE 412 BOARD_USES_VENDORIMAGE := true 413endif 414ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 415 BOARD_USES_VENDORIMAGE := true 416endif 417# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image. 418# But target's BOARD_PREBUILT_VENDORIMAGE is not filled. 419ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) 420 BOARD_USES_VENDORIMAGE := true 421else ifdef BOARD_USES_VENDORIMAGE 422 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) 423endif 424.KATI_READONLY := BOARD_USES_VENDORIMAGE 425 426BUILDING_VENDOR_IMAGE := 427ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),) 428 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 429 BUILDING_VENDOR_IMAGE := true 430 endif 431else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true) 432 BUILDING_VENDOR_IMAGE := true 433 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 434 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined) 435 endif 436endif 437ifdef BOARD_PREBUILT_VENDORIMAGE 438 BUILDING_VENDOR_IMAGE := 439endif 440.KATI_READONLY := BUILDING_VENDOR_IMAGE 441 442########################################### 443# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT 444ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) 445TARGET_COPY_OUT_PRODUCT := system/product 446else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) 447$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) 448endif 449PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) 450 451BOARD_USES_PRODUCTIMAGE := 452ifdef BOARD_PREBUILT_PRODUCTIMAGE 453 BOARD_USES_PRODUCTIMAGE := true 454endif 455ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 456 BOARD_USES_PRODUCTIMAGE := true 457endif 458$(call check_image_config,product) 459.KATI_READONLY := BOARD_USES_PRODUCTIMAGE 460 461BUILDING_PRODUCT_IMAGE := 462ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),) 463 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 464 BUILDING_PRODUCT_IMAGE := true 465 endif 466else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true) 467 BUILDING_PRODUCT_IMAGE := true 468 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 469 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined) 470 endif 471endif 472ifdef BOARD_PREBUILT_PRODUCTIMAGE 473 BUILDING_PRODUCT_IMAGE := 474endif 475.KATI_READONLY := BUILDING_PRODUCT_IMAGE 476 477########################################### 478# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to 479# TARGET_COPY_OUT_PRODUCT as a workaround. 480TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT) 481 482########################################### 483# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT 484ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder)) 485TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext 486else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),) 487$(error TARGET_COPY_OUT_SYSTEM_EXT must be either 'system_ext' or 'system/system_ext', seeing '$(TARGET_COPY_OUT_SYSTEM_EXT)'.) 488endif 489PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES)) 490 491BOARD_USES_SYSTEM_EXTIMAGE := 492ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE 493 BOARD_USES_SYSTEM_EXTIMAGE := true 494endif 495ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 496 BOARD_USES_SYSTEM_EXTIMAGE := true 497endif 498$(call check_image_config,system_ext) 499.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE 500 501BUILDING_SYSTEM_EXT_IMAGE := 502ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),) 503 ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 504 BUILDING_SYSTEM_EXT_IMAGE := true 505 endif 506else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true) 507 BUILDING_SYSTEM_EXT_IMAGE := true 508 ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE 509 $(error PRODUCT_BUILD_SYSTEM_EXT_IMAGE set to true, but BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE not defined) 510 endif 511endif 512ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE 513 BUILDING_SYSTEM_EXT_IMAGE := 514endif 515.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE 516 517########################################### 518# Now we can substitute with the real value of TARGET_COPY_OUT_ODM 519ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) 520 TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm 521else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),) 522 $(error TARGET_COPY_OUT_ODM must be either 'odm', 'system/vendor/odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.) 523endif 524PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES)) 525 526BOARD_USES_ODMIMAGE := 527ifdef BOARD_PREBUILT_ODMIMAGE 528 BOARD_USES_ODMIMAGE := true 529endif 530ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 531 BOARD_USES_ODMIMAGE := true 532endif 533$(call check_image_config,odm) 534 535BUILDING_ODM_IMAGE := 536ifeq ($(PRODUCT_BUILD_ODM_IMAGE),) 537 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 538 BUILDING_ODM_IMAGE := true 539 endif 540else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true) 541 BUILDING_ODM_IMAGE := true 542 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE 543 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined) 544 endif 545endif 546ifdef BOARD_PREBUILT_ODMIMAGE 547 BUILDING_ODM_IMAGE := 548endif 549.KATI_READONLY := BUILDING_ODM_IMAGE 550 551########################################### 552# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE. 553TARGET_RECOVERY_UPDATER_LIBS ?= 554AB_OTA_UPDATER ?= 555.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER 556 557# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true 558ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true) 559 ifneq ($(AB_OTA_UPDATER),true) 560 $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true) 561 endif 562endif 563 564# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB 565# to see if non-A/B is supported. 566TARGET_OTA_ALLOW_NON_AB := false 567ifneq ($(AB_OTA_UPDATER),true) 568 TARGET_OTA_ALLOW_NON_AB := true 569else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true) 570 TARGET_OTA_ALLOW_NON_AB := true 571endif 572.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB 573 574ifneq ($(TARGET_OTA_ALLOW_NON_AB),true) 575 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) 576 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB) 577 endif 578endif 579 580# Sanity check for building generic OTA packages. Currently it only supports A/B OTAs. 581ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) 582 ifneq ($(AB_OTA_UPDATER),true) 583 $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported) 584 endif 585endif 586 587ifdef BOARD_PREBUILT_DTBIMAGE_DIR 588 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true) 589 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported) 590 endif 591endif 592 593# Check BOARD_VNDK_VERSION 594define check_vndk_version 595 $(eval vndk_path := prebuilts/vndk/v$(1)) \ 596 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) 597endef 598 599ifdef BOARD_VNDK_VERSION 600 ifneq ($(BOARD_VNDK_VERSION),current) 601 $(call check_vndk_version,$(BOARD_VNDK_VERSION)) 602 endif 603 TARGET_VENDOR_TEST_SUFFIX := /vendor 604else 605 TARGET_VENDOR_TEST_SUFFIX := 606endif 607 608########################################### 609# APEXes are by default flattened, i.e. non-updatable. 610# It can be unflattened (and updatable) by inheriting from 611# updatable_apex.mk 612# 613# APEX flattening can also be forcibly enabled (resp. disabled) by 614# setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by 615# setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable. 616ifdef OVERRIDE_TARGET_FLATTEN_APEX 617 TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX) 618else 619 ifeq (,$(TARGET_FLATTEN_APEX)) 620 TARGET_FLATTEN_APEX := true 621 endif 622endif 623 624ifeq (,$(TARGET_BUILD_APPS)) 625ifdef PRODUCT_EXTRA_VNDK_VERSIONS 626 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) 627endif 628endif 629 630# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS 631_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) 632ifneq (,$(_unsupported_systemsdk_versions)) 633 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ 634 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) 635endif 636 637########################################### 638# Handle BUILD_BROKEN_USES_BUILD_* 639 640$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\ 641 $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\ 642 $(KATI_obsolete_var $(m),Please convert to Soong),\ 643 $(KATI_deprecated_var $(m),Please convert to Soong))) 644 645$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\ 646 $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\ 647 $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers)) 648 649$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\ 650 $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\ 651 $(KATI_deprecated_var $(m),Please convert to Soong),\ 652 $(KATI_obsolete_var $(m),Please convert to Soong))) 653