blob: 269951222e10ce823d043c1a8c03296ccee32b34 [file] [log] [blame]
Anton Hanssonbb76ce82019-02-26 12:34:03 +00001#
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,
Joel Galenson154ac1d2020-07-30 14:23:31 -070019# and checks the variable defined therein.
Anton Hanssonbb76ce82019-02-26 12:34:03 +000020# ###############################################################
21
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000022_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
Yi-Yo Chiang1519d432021-04-04 16:03:10 +080028_board_strip_readonly_list += BOARD_BOOT_HEADER_VERSION
Devin Moore50509012021-01-13 10:45:04 -080029_board_strip_readonly_list += BOARD_BOOTCONFIG
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000030_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
Anton Hansson5e05b8e2020-11-27 10:35:17 +000060# 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
Anton Hanssond488d2d2019-02-26 15:49:25 +000064
65# File system variables
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000066_board_strip_readonly_list += BOARD_FLASH_BLOCK_SIZE
67_board_strip_readonly_list += BOARD_BOOTIMAGE_PARTITION_SIZE
Devin Moore380d9e42021-11-04 19:01:19 +000068_board_strip_readonly_list += BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000069_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
Ramji Jiyani13a41372022-01-27 07:05:08 +000088_board_strip_readonly_list += BOARD_SYSTEM_DLKMIMAGE_PARTITION_SIZE
89_board_strip_readonly_list += BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
Pierre-Clément Tosi592a3ca2021-10-04 11:34:11 +020090_board_strip_readonly_list += BOARD_PVMFWIMAGE_PARTITION_SIZE
Anton Hanssond488d2d2019-02-26 15:49:25 +000091
92# Logical partitions related variables.
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000093_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
Ramji Jiyani13a41372022-01-27 07:05:08 +000098_board_strip_readonly_list += BOARD_SYSTEM_DLKMIMAGE_PARTITION_RESERVED_SIZE
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000099_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
Anton Hanssond488d2d2019-02-26 15:49:25 +0000103
Yifan Hong6040cad2020-08-05 14:30:32 -0700104# Kernel related variables
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +0000105_board_strip_readonly_list += BOARD_KERNEL_BINARIES
106_board_strip_readonly_list += BOARD_KERNEL_MODULE_INTERFACE_VERSIONS
Yifan Hong6040cad2020-08-05 14:30:32 -0700107
Yifan Hongd381f732020-10-08 11:08:20 -0700108# 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.
Yifan Hong63c5ca12020-10-08 11:54:02 -0700112# - BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE controls whether the recovery image
113# contains a kernel or not.
Yifan Hong881df392020-10-09 14:29:39 -0700114# - BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT controls whether ramdisk
115# recovery resources are built to vendor_boot.
Yi-Yo Chiang12f92442021-04-04 16:12:25 +0800116# - BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT controls whether recovery
117# resources are built as a standalone recovery ramdisk in vendor_boot.
Yifan Hong82b113d2020-10-12 12:42:12 -0700118# - BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT controls whether GSI AVB keys are
119# built to vendor_boot.
Yifan Hong49968aa2020-11-09 11:52:52 -0800120# - BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES controls whether boot images in $OUT are added
121# to target files package directly.
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +0000122_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
Yi-Yo Chiang12f92442021-04-04 16:12:25 +0800125_board_strip_readonly_list += BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +0000126_board_strip_readonly_list += BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT
127_board_strip_readonly_list += BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES
Yifan Hongd381f732020-10-08 11:08:20 -0700128
Devin Moore380d9e42021-11-04 19:01:19 +0000129# Prebuilt image variables
130_board_strip_readonly_list += BOARD_PREBUILT_INIT_BOOT_IMAGE
131
Yo Chiangd21e7dc2020-12-10 18:42:47 +0800132# 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
Cole Faust29bb6132021-11-29 17:26:03 -0800135# 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
Cole Faust29bb6132021-11-29 17:26:03 -0800147_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
Lucas Weif57333f2022-02-24 10:30:15 +0800161_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
Cole Faust29bb6132021-11-29 17:26:03 -0800164_board_strip_list += BOARD_GKI_SIGNING_SIGNATURE_ARGS
165_board_strip_list += BOARD_GKI_SIGNING_ALGORITHM
166_board_strip_list += BOARD_GKI_SIGNING_KEY_PATH
167_board_strip_list += BOARD_MKBOOTIMG_ARGS
168_board_strip_list += BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE
Lucas Weif57333f2022-02-24 10:30:15 +0800169_board_strip_list += BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE
Cole Faustc8c516a2021-12-09 10:30:19 -0800170_board_strip_list += ODM_MANIFEST_SKUS
Cole Faust29bb6132021-11-29 17:26:03 -0800171
172
Anton Hanssond488d2d2019-02-26 15:49:25 +0000173_build_broken_var_list := \
Alix7a4d5392022-08-25 14:17:18 +0000174 BUILD_BROKEN_CLANG_PROPERTY \
Alix Espino38e07f12022-09-14 19:10:51 +0000175 BUILD_BROKEN_CLANG_ASFLAGS \
176 BUILD_BROKEN_CLANG_CFLAGS \
Vinh Tran3fae6fe2022-06-21 12:00:02 -0400177 BUILD_BROKEN_DEPFILE \
Anton Hanssond488d2d2019-02-26 15:49:25 +0000178 BUILD_BROKEN_DUP_RULES \
Yo Chiang64faf882020-07-15 18:35:12 +0800179 BUILD_BROKEN_DUP_SYSPROP \
Yo Chiang0b49c032020-03-17 17:49:49 +0800180 BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
Inseob Kim9d281d92020-10-19 13:31:58 +0900181 BUILD_BROKEN_ENFORCE_SYSPROP_OWNER \
Liz Kammer4065e5b2022-01-31 16:16:06 -0500182 BUILD_BROKEN_INPUT_DIR_MODULES \
Yo Chiang64faf882020-07-15 18:35:12 +0800183 BUILD_BROKEN_MISSING_REQUIRED_MODULES \
Yifan Hong5e57a772020-01-09 16:15:11 -0800184 BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
Logan Chien2a880752019-09-17 09:45:09 -0700185 BUILD_BROKEN_PREBUILT_ELF_FILES \
Inseob Kim5d60c8a2019-10-17 10:32:59 +0000186 BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
Dan Willemsen0586c652019-04-09 09:56:48 -0700187 BUILD_BROKEN_USES_NETWORK \
Inseob Kim43f4ef02021-02-03 18:17:49 +0900188 BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE \
Yifan Hong5e57a772020-01-09 16:15:11 -0800189 BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
Anton Hanssond488d2d2019-02-26 15:49:25 +0000190
Dan Willemsen695849e2019-04-17 12:25:09 -0700191_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
Anton Hanssond488d2d2019-02-26 15:49:25 +0000197_board_true_false_vars := $(_build_broken_var_list)
Dan Willemsen26076252020-01-02 20:08:10 -0800198_board_strip_readonly_list += $(_build_broken_var_list) \
199 BUILD_BROKEN_NINJA_USES_ENV_VARS
Anton Hanssond488d2d2019-02-26 15:49:25 +0000200
Anton Hansson74dc00b2019-02-27 14:38:27 +0000201# Conditional to building on linux, as dex2oat currently does not work on darwin.
202ifeq ($(HOST_OS),linux)
Ulya Trofimovichcc5c6a72023-03-28 13:15:35 +0000203 WITH_DEXPREOPT := true
Anton Hansson74dc00b2019-02-27 14:38:27 +0000204endif
205
Anton Hanssonb9544692019-02-26 13:37:28 +0000206# ###############################################################
207# Broken build defaults
208# ###############################################################
Dan Willemsen0586c652019-04-09 09:56:48 -0700209$(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
Dan Willemsen26076252020-01-02 20:08:10 -0800210BUILD_BROKEN_NINJA_USES_ENV_VARS :=
Anton Hanssonb9544692019-02-26 13:37:28 +0000211
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000212# 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 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
226 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
227 )))
228 ifeq ($(board_config_mk),)
229 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
230 endif
231 ifneq ($(words $(board_config_mk)),1)
232 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
233 endif
234 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
235 .KATI_READONLY := TARGET_DEVICE_DIR
236endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000237
Cole Faust12711512022-05-02 14:16:04 -0700238ifndef RBC_PRODUCT_CONFIG
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000239include $(board_config_mk)
Cole Fauste5e7a2d2021-09-30 17:14:29 -0700240else
Cole Faust985fa482021-10-07 17:14:23 -0700241 $(shell mkdir -p $(OUT_DIR)/rbc)
Cole Faustf1f49bb2021-12-01 13:49:12 -0800242 $(call dump-variables-rbc, $(OUT_DIR)/rbc/make_vars_pre_board_config.mk)
Cole Faust985fa482021-10-07 17:14:23 -0700243
Cole Faust08e78b92022-03-24 17:32:39 -0700244 $(shell $(OUT_DIR)/mk2rbc \
Cole Faust985fa482021-10-07 17:14:23 -0700245 --mode=write -r --outdir $(OUT_DIR)/rbc \
246 --boardlauncher=$(OUT_DIR)/rbc/boardlauncher.rbc \
247 --input_variables=$(OUT_DIR)/rbc/make_vars_pre_board_config.mk \
Cole Faust1bcdd242022-02-07 15:17:55 -0800248 --makefile_list=$(OUT_DIR)/.module_paths/configuration.list \
Cole Faust985fa482021-10-07 17:14:23 -0700249 $(board_config_mk))
250 ifneq ($(.SHELLSTATUS),0)
251 $(error board configuration converter failed: $(.SHELLSTATUS))
Cole Fauste5e7a2d2021-09-30 17:14:29 -0700252 endif
253
Sasha Smundak7dc8f482021-11-17 17:19:12 -0800254 $(shell build/soong/scripts/update_out $(OUT_DIR)/rbc/rbc_board_config_results.mk \
Cole Faustc63ce1a2023-05-09 14:56:36 -0700255 $(OUT_DIR)/rbcrun --mode=rbc $(OUT_DIR)/rbc/boardlauncher.rbc)
Cole Faust985fa482021-10-07 17:14:23 -0700256 ifneq ($(.SHELLSTATUS),0)
257 $(error board configuration runner failed: $(.SHELLSTATUS))
258 endif
259
260 include $(OUT_DIR)/rbc/rbc_board_config_results.mk
Cole Fauste5e7a2d2021-09-30 17:14:29 -0700261endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000262
263ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE)))
264 $(error $(board_config_mk) erroneously sets both TARGET_ARCH and TARGET_ARCH_SUITE)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000265endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000266ifeq ($(TARGET_ARCH)$(TARGET_ARCH_SUITE),)
267 $(error Target architectures not defined by board config: $(board_config_mk))
268endif
269ifeq ($(TARGET_CPU_ABI)$(TARGET_ARCH_SUITE),)
270 $(error TARGET_CPU_ABI not defined by board config: $(board_config_mk))
271endif
272
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000273ifneq ($(MALLOC_IMPL),)
274 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).)
275 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
276endif
277board_config_mk :=
278
Anton Hanssond488d2d2019-02-26 15:49:25 +0000279# Clean up and verify BoardConfig variables
280$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var)))))
Cole Faust29bb6132021-11-29 17:26:03 -0800281$(foreach var,$(_board_strip_list),$(eval $(var) := $$(strip $$($(var)))))
Anton Hanssond488d2d2019-02-26 15:49:25 +0000282$(foreach var,$(_board_true_false_vars), \
283 $(if $(filter-out true false,$($(var))), \
284 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))")))
Anton Hanssonb9544692019-02-26 13:37:28 +0000285
Jooyung Han0140dfa2022-07-25 14:10:19 +0900286include $(BUILD_SYSTEM)/board_config_wifi.mk
287
Anton Hanssonb9544692019-02-26 13:37:28 +0000288# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified.
289TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT))
290TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT))
291
Anton Hansson41f9cc22020-11-27 11:00:38 +0000292ifdef TARGET_ARCH
293 # The combo makefiles check and set defaults for various CPU configuration
294 combo_target := TARGET_
295 combo_2nd_arch_prefix :=
296 include $(BUILD_SYSTEM)/combo/select.mk
297endif
Anton Hansson19279852019-02-28 17:15:57 +0000298
299ifdef TARGET_2ND_ARCH
300 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
301 include $(BUILD_SYSTEM)/combo/select.mk
302endif
303
Anton Hanssond488d2d2019-02-26 15:49:25 +0000304.KATI_READONLY := $(_board_strip_readonly_list)
305
306INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE)
Devin Moored6eab6f2021-03-10 16:28:49 -0800307ifneq (,$(BOARD_BOOTCONFIG))
308 INTERNAL_KERNEL_CMDLINE += bootconfig
309 INTERNAL_BOOTCONFIG := $(BOARD_BOOTCONFIG)
310endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000311
Anton Hanssonb9544692019-02-26 13:37:28 +0000312ifneq ($(filter %64,$(TARGET_ARCH)),)
313 TARGET_IS_64_BIT := true
314endif
315
316ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS)))
317 TARGET_SUPPORTS_32_BIT_APPS := true
318endif
319
Joel Galenson154ac1d2020-07-30 14:23:31 -0700320# Quick check to warn about likely cryptic errors later in the build.
Anton Hanssonb9544692019-02-26 13:37:28 +0000321ifeq ($(TARGET_IS_64_BIT),true)
322 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
Anton Hansson6d25fc62019-05-10 15:29:28 +0100323 $(error Building a 32-bit-app-only product on a 64-bit device. \
Anton Hanssonb9544692019-02-26 13:37:28 +0000324 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false)
325 endif
326endif
327
328# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
329# comma separated lists of the 32 and 64 bit ABIs (in order of
330# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT
331# are defined by the board config, we use them. Else, we construct
332# these lists based on whether TARGET_IS_64_BIT is set.
333#
334# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target
335# is always 32 bits. If this isn't the case, these variables should
336# be overriden in the board configuration.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200337#
338# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always
339# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs.
340_target_native_bridge_abi_list_32_bit :=
341_target_native_bridge_abi_list_64_bit :=
342
Anton Hanssonb9544692019-02-26 13:37:28 +0000343ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
344 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
345 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200346 _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000347 endif
348endif
349
Peter Collingbourne6aea25d2019-05-16 14:09:35 -0700350# "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported
351# in all builds with SANITIZE_TARGET=hwaddress.
352ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),)
353 ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),)
354 TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT)
355 endif
356endif
357
Anton Hanssonb9544692019-02-26 13:37:28 +0000358ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT))
359 ifneq (true,$(TARGET_IS_64_BIT))
360 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200361 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000362 else
363 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
364 # For a 64 bit target, assume that the 2ND_CPU_ABI
365 # is a 32 bit ABI.
366 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200367 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000368 endif
369 endif
370endif
371
372# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
373# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
374# is specified by the board configuration, we use that. If not, we
375# build a list out of the TARGET_CPU_ABIs specified by the config.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200376# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
Anton Hanssonb9544692019-02-26 13:37:28 +0000377ifeq (,$(TARGET_CPU_ABI_LIST))
Elliott Hughes9b824d52020-04-17 15:46:55 -0700378 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
379 $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
Anton Hanssonb9544692019-02-26 13:37:28 +0000380endif
381
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200382# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference.
383TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit)
384TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit)
385
Anton Hanssonb9544692019-02-26 13:37:28 +0000386# Strip whitespace from the ABI list string.
387TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST)))
388TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
389TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
390
Jeongik Chabb688a92019-07-12 12:51:37 +0900391# Check if config about image building is valid or not.
392define check_image_config
393 $(eval _uc_name := $(call to-upper,$(1))) \
394 $(eval _lc_name := $(call to-lower,$(1))) \
395 $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \
396 $(if $(BOARD_USES_$(_uc_name)IMAGE),, \
397 $(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)), \
398 $(if $(BOARD_USES_$(_uc_name)IMAGE), \
399 $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \
400 $(eval _uc_name :=) \
401 $(eval _lc_name :=)
402endef
403
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000404###########################################
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000405# Configure whether we're building the system image
406BUILDING_SYSTEM_IMAGE := true
407ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),)
408 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE
409 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
410 BUILDING_SYSTEM_IMAGE :=
411 endif
412 endif
413else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false)
414 BUILDING_SYSTEM_IMAGE :=
415endif
416.KATI_READONLY := BUILDING_SYSTEM_IMAGE
417
418# Are we building a system_other image
419BUILDING_SYSTEM_OTHER_IMAGE :=
420ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),)
421 ifdef BUILDING_SYSTEM_IMAGE
422 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
423 BUILDING_SYSTEM_OTHER_IMAGE := true
424 endif
425 endif
426else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true)
427 BUILDING_SYSTEM_OTHER_IMAGE := true
428 ifndef BUILDING_SYSTEM_IMAGE
429 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image)
430 endif
431endif
432.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE
433
434# Are we building a cache image
435BUILDING_CACHE_IMAGE :=
436ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),)
437 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
438 BUILDING_CACHE_IMAGE := true
439 endif
440else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true)
441 BUILDING_CACHE_IMAGE := true
442 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
443 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined)
444 endif
445endif
446.KATI_READONLY := BUILDING_CACHE_IMAGE
447
Chris Grossa784ef12019-04-22 11:09:57 -0700448# Are we building a boot image
449BUILDING_BOOT_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700450ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),)
451 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
452 BUILDING_BOOT_IMAGE :=
Bowgo Tsaicf9ead82021-05-20 00:14:42 +0800453 else ifdef BOARD_PREBUILT_BOOTIMAGE
454 BUILDING_BOOT_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700455 else ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Chris Grossa784ef12019-04-22 11:09:57 -0700456 BUILDING_BOOT_IMAGE := true
Yifan Hongebe65f82020-10-15 14:48:07 -0700457 else ifneq (,$(foreach kernel,$(BOARD_KERNEL_BINARIES),$(BOARD_$(call to-upper,$(kernel))_BOOTIMAGE_PARTITION_SIZE)))
458 BUILDING_BOOT_IMAGE := true
Chris Grossa784ef12019-04-22 11:09:57 -0700459 endif
460else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true)
Daniel Norman42879ff2020-10-06 11:09:56 -0700461 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
462 $(warning *** PRODUCT_BUILD_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT.)
463 $(warning *** Skipping building boot image.)
464 BUILDING_BOOT_IMAGE :=
465 else
466 BUILDING_BOOT_IMAGE := true
467 endif
Chris Grossa784ef12019-04-22 11:09:57 -0700468endif
469.KATI_READONLY := BUILDING_BOOT_IMAGE
470
Devin Moore380d9e42021-11-04 19:01:19 +0000471# Are we building an init boot image
472BUILDING_INIT_BOOT_IMAGE :=
473ifeq ($(PRODUCT_BUILD_INIT_BOOT_IMAGE),)
474 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
475 BUILDING_INIT_BOOT_IMAGE :=
476 else ifdef BOARD_PREBUILT_INIT_BOOT_IMAGE
477 BUILDING_INIT_BOOT_IMAGE :=
478 else ifdef BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE
479 BUILDING_INIT_BOOT_IMAGE := true
480 endif
481else ifeq ($(PRODUCT_BUILD_INIT_BOOT_IMAGE),true)
482 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
483 $(error PRODUCT_BUILD_INIT_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT. Use only one option.)
484 else
485 BUILDING_INIT_BOOT_IMAGE := true
486 endif
487endif
488.KATI_READONLY := BUILDING_INIT_BOOT_IMAGE
489
Chris Grossa784ef12019-04-22 11:09:57 -0700490# Are we building a recovery image
491BUILDING_RECOVERY_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700492ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),)
493 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
494 BUILDING_RECOVERY_IMAGE := true
Yifan Hong881df392020-10-09 14:29:39 -0700495 else ifeq ($(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT),true)
496 # Set to true to build recovery resources for vendor_boot
497 BUILDING_RECOVERY_IMAGE := true
Daniel Norman42879ff2020-10-06 11:09:56 -0700498 else ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Chris Grossa784ef12019-04-22 11:09:57 -0700499 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
500 BUILDING_RECOVERY_IMAGE := true
501 endif
502 endif
503else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true)
504 BUILDING_RECOVERY_IMAGE := true
505endif
506.KATI_READONLY := BUILDING_RECOVERY_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000507
Steve Mucklee1b10862019-07-10 10:49:37 -0700508# Are we building a vendor boot image
509BUILDING_VENDOR_BOOT_IMAGE :=
510ifdef BOARD_BOOT_HEADER_VERSION
511 ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),)
Daniel Normanad6293c2020-10-16 15:10:21 -0700512 ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),)
Daniel Norman42879ff2020-10-06 11:09:56 -0700513 BUILDING_VENDOR_BOOT_IMAGE := true
514 else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),true)
Steve Muckle3363a0b2020-02-12 13:38:28 -0800515 BUILDING_VENDOR_BOOT_IMAGE := true
516 endif
Steve Mucklee1b10862019-07-10 10:49:37 -0700517 endif
518endif
519.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE
520
Lucas Weif57333f2022-02-24 10:30:15 +0800521# Are we building a vendor kernel boot image
522BUILDING_VENDOR_KERNEL_BOOT_IMAGE :=
523ifeq ($(PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE),true)
524 ifneq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
525 $(error BUILDING_VENDOR_BOOT_IMAGE is required, but BUILDING_VENDOR_BOOT_IMAGE is not true)
526 endif
527 ifndef BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE
528 $(error BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE is required when PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE is true)
529 endif
530 BUILDING_VENDOR_KERNEL_BOOT_IMAGE := true
531else ifeq ($(PRODUCT_BUILD_VENDOR_KERNEL),)
532 ifdef BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE
533 ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
534 BUILDING_VENDOR_KERNEL_BOOT_IMAGE := true
535 endif
536 endif
537endif # end of PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE
538.KATI_READONLY := BUILDING_VENDOR_KERNEL_BOOT_IMAGE
539
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000540# Are we building a ramdisk image
541BUILDING_RAMDISK_IMAGE := true
542ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
543 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true:
544 # BUILDING_BOOT_IMAGE
545 # BUILDING_RECOVERY_IMAGE
546else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
547 BUILDING_RAMDISK_IMAGE :=
548endif
549.KATI_READONLY := BUILDING_RAMDISK_IMAGE
550
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800551# Are we building a debug vendor_boot image
552BUILDING_DEBUG_VENDOR_BOOT_IMAGE :=
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800553# Can't build vendor_boot-debug.img if we're not building a ramdisk.
Yi-Yo Chiang06c62732022-10-07 21:18:45 +0800554ifndef BUILDING_RAMDISK_IMAGE
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800555 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
556 $(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a ramdisk image. \
557 Skip building the debug vendor_boot image.)
558 endif
559# Can't build vendor_boot-debug.img if we're not building a vendor_boot.img.
560else ifndef BUILDING_VENDOR_BOOT_IMAGE
561 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
562 $(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a vendor_boot image. \
563 Skip building the debug vendor_boot image.)
564 endif
565else
566 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),)
567 BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true
568 else ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
569 BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true
570 endif
571endif
572.KATI_READONLY := BUILDING_DEBUG_VENDOR_BOOT_IMAGE
573
574_has_boot_img_artifact :=
575ifneq ($(strip $(TARGET_NO_KERNEL)),true)
576 ifdef BUILDING_BOOT_IMAGE
577 _has_boot_img_artifact := true
578 endif
579 # BUILDING_RECOVERY_IMAGE && BOARD_USES_RECOVERY_AS_BOOT implies that
580 # recovery is being built with the file name *boot.img*, which still counts
581 # as "building boot.img".
582 ifdef BUILDING_RECOVERY_IMAGE
583 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
584 _has_boot_img_artifact := true
585 endif
586 endif
587endif
588
589# Are we building a debug boot image
590BUILDING_DEBUG_BOOT_IMAGE :=
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800591# Can't build boot-debug.img if we're not building a ramdisk.
Yi-Yo Chiang06c62732022-10-07 21:18:45 +0800592ifndef BUILDING_RAMDISK_IMAGE
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800593 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
594 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a ramdisk image. \
595 Skip building the debug boot image.)
596 endif
597# Can't build boot-debug.img if we're not building a boot.img.
598else ifndef _has_boot_img_artifact
599 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
600 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a boot image. \
601 Skip building the debug boot image.)
602 endif
Devin Moore380d9e42021-11-04 19:01:19 +0000603else ifdef BUILDING_INIT_BOOT_IMAGE
604 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
605 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we don't have a ramdisk in the boot image. \
606 Skip building the debug boot image.)
607 endif
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800608else
609 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),)
610 BUILDING_DEBUG_BOOT_IMAGE := true
611 # Don't build boot-debug.img if we're already building vendor_boot-debug.img.
612 ifdef BUILDING_DEBUG_VENDOR_BOOT_IMAGE
613 BUILDING_DEBUG_BOOT_IMAGE :=
614 endif
615 else ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
616 BUILDING_DEBUG_BOOT_IMAGE := true
617 endif
618endif
619.KATI_READONLY := BUILDING_DEBUG_BOOT_IMAGE
620_has_boot_img_artifact :=
621
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000622# Are we building a userdata image
623BUILDING_USERDATA_IMAGE :=
624ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)
625 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
626 BUILDING_USERDATA_IMAGE := true
627 endif
628else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
629 BUILDING_USERDATA_IMAGE := true
630endif
631.KATI_READONLY := BUILDING_USERDATA_IMAGE
632
Paul Trautrim4e143232019-08-13 16:30:57 +0900633# Are we building a vbmeta image
634BUILDING_VBMETA_IMAGE := true
635ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false)
636 BUILDING_VBMETA_IMAGE :=
637endif
638.KATI_READONLY := BUILDING_VBMETA_IMAGE
639
Yo Chiange86bab42021-03-25 10:12:28 +0000640# Are we building a super_empty image
641BUILDING_SUPER_EMPTY_IMAGE :=
642ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),)
643 ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
644 ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
645 BUILDING_SUPER_EMPTY_IMAGE := true
646 endif
647 endif
648else ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),true)
649 ifneq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
650 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but PRODUCT_USE_DYNAMIC_PARTITIONS is not true)
651 endif
652 ifeq ($(BOARD_SUPER_PARTITION_SIZE),)
653 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but BOARD_SUPER_PARTITION_SIZE is not defined)
654 endif
655 BUILDING_SUPER_EMPTY_IMAGE := true
656endif
657.KATI_READONLY := BUILDING_SUPER_EMPTY_IMAGE
658
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000659###########################################
660# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
661ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
662 TARGET_COPY_OUT_VENDOR := system/vendor
663else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
664 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
665endif
666PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
667
668BOARD_USES_VENDORIMAGE :=
669ifdef BOARD_PREBUILT_VENDORIMAGE
670 BOARD_USES_VENDORIMAGE := true
671endif
672ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
673 BOARD_USES_VENDORIMAGE := true
674endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900675# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image.
676# But target's BOARD_PREBUILT_VENDORIMAGE is not filled.
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000677ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
678 BOARD_USES_VENDORIMAGE := true
679else ifdef BOARD_USES_VENDORIMAGE
680 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
681endif
682.KATI_READONLY := BOARD_USES_VENDORIMAGE
683
684BUILDING_VENDOR_IMAGE :=
685ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),)
686 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
687 BUILDING_VENDOR_IMAGE := true
688 endif
689else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true)
690 BUILDING_VENDOR_IMAGE := true
691 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
692 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined)
693 endif
694endif
695ifdef BOARD_PREBUILT_VENDORIMAGE
696 BUILDING_VENDOR_IMAGE :=
697endif
698.KATI_READONLY := BUILDING_VENDOR_IMAGE
699
700###########################################
701# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
702ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder))
703TARGET_COPY_OUT_PRODUCT := system/product
704else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),)
705$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.)
706endif
707PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES))
708
709BOARD_USES_PRODUCTIMAGE :=
710ifdef BOARD_PREBUILT_PRODUCTIMAGE
711 BOARD_USES_PRODUCTIMAGE := true
712endif
713ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
714 BOARD_USES_PRODUCTIMAGE := true
715endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900716$(call check_image_config,product)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000717.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
718
719BUILDING_PRODUCT_IMAGE :=
720ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),)
721 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
722 BUILDING_PRODUCT_IMAGE := true
723 endif
724else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true)
725 BUILDING_PRODUCT_IMAGE := true
726 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
727 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined)
728 endif
729endif
730ifdef BOARD_PREBUILT_PRODUCTIMAGE
731 BUILDING_PRODUCT_IMAGE :=
732endif
733.KATI_READONLY := BUILDING_PRODUCT_IMAGE
734
735###########################################
Justin Yun6151e3f2019-06-25 15:58:13 +0900736# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to
737# TARGET_COPY_OUT_PRODUCT as a workaround.
738TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000739
Justin Yun6151e3f2019-06-25 15:58:13 +0900740###########################################
741# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT
742ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder))
743TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
744else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),)
745$(error TARGET_COPY_OUT_SYSTEM_EXT must be either 'system_ext' or 'system/system_ext', seeing '$(TARGET_COPY_OUT_SYSTEM_EXT)'.)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000746endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900747PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000748
Justin Yun6151e3f2019-06-25 15:58:13 +0900749BOARD_USES_SYSTEM_EXTIMAGE :=
750ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
751 BOARD_USES_SYSTEM_EXTIMAGE := true
752endif
753ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
754 BOARD_USES_SYSTEM_EXTIMAGE := true
755endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900756$(call check_image_config,system_ext)
Justin Yun6151e3f2019-06-25 15:58:13 +0900757.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
758
759BUILDING_SYSTEM_EXT_IMAGE :=
760ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),)
761 ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
762 BUILDING_SYSTEM_EXT_IMAGE := true
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000763 endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900764else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true)
765 BUILDING_SYSTEM_EXT_IMAGE := true
766 ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
767 $(error PRODUCT_BUILD_SYSTEM_EXT_IMAGE set to true, but BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE not defined)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000768 endif
769endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900770ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
771 BUILDING_SYSTEM_EXT_IMAGE :=
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000772endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900773.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000774
775###########################################
Yifan Hongcfb917a2020-05-07 14:58:20 -0700776# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM
777ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder))
778 TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm
779else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),)
780 $(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)'.)
781endif
782PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES))
783
784BOARD_USES_VENDOR_DLKMIMAGE :=
785ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
786 BOARD_USES_VENDOR_DLKMIMAGE := true
787endif
788ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
789 BOARD_USES_VENDOR_DLKMIMAGE := true
790endif
791$(call check_image_config,vendor_dlkm)
792
793BUILDING_VENDOR_DLKM_IMAGE :=
794ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),)
795 ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
796 BUILDING_VENDOR_DLKM_IMAGE := true
797 endif
798else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true)
799 BUILDING_VENDOR_DLKM_IMAGE := true
800 ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
801 $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
802 endif
803endif
804ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
805 BUILDING_VENDOR_DLKM_IMAGE :=
806endif
807.KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE
808
809###########################################
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000810# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
811ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
dianlujitao339ef4c2019-10-10 09:26:00 +0800812 TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm
813else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
814 $(error TARGET_COPY_OUT_ODM must be either 'odm', 'system/vendor/odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000815endif
816PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
817
818BOARD_USES_ODMIMAGE :=
819ifdef BOARD_PREBUILT_ODMIMAGE
820 BOARD_USES_ODMIMAGE := true
821endif
822ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
823 BOARD_USES_ODMIMAGE := true
824endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900825$(call check_image_config,odm)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000826
827BUILDING_ODM_IMAGE :=
Dan Willemsen25a69372019-04-19 15:00:12 -0700828ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000829 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
830 BUILDING_ODM_IMAGE := true
831 endif
832else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true)
833 BUILDING_ODM_IMAGE := true
834 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
835 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined)
836 endif
837endif
838ifdef BOARD_PREBUILT_ODMIMAGE
839 BUILDING_ODM_IMAGE :=
840endif
841.KATI_READONLY := BUILDING_ODM_IMAGE
842
Yifan Hongf496f1b2020-07-15 16:52:59 -0700843
844###########################################
845# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM
846ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder))
847 TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm
848else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),)
849 $(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)'.)
850endif
851PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES))
852
853BOARD_USES_ODM_DLKMIMAGE :=
854ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
855 BOARD_USES_ODM_DLKMIMAGE := true
856endif
857ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
858 BOARD_USES_ODM_DLKMIMAGE := true
859endif
860$(call check_image_config,odm_dlkm)
861
862BUILDING_ODM_DLKM_IMAGE :=
863ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),)
864 ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
865 BUILDING_ODM_DLKM_IMAGE := true
866 endif
867else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true)
868 BUILDING_ODM_DLKM_IMAGE := true
869 ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
870 $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
871 endif
872endif
873ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
874 BUILDING_ODM_DLKM_IMAGE :=
875endif
876.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE
877
Ramji Jiyani13a41372022-01-27 07:05:08 +0000878###########################################
879# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_DLKM
880ifeq ($(TARGET_COPY_OUT_SYSTEM_DLKM),$(_system_dlkm_path_placeholder))
881 TARGET_COPY_OUT_SYSTEM_DLKM := $(TARGET_COPY_OUT_SYSTEM)/system_dlkm
882else ifeq ($(filter system_dlkm system/system_dlkm,$(TARGET_COPY_OUT_SYSTEM_DLKM)),)
883 $(error TARGET_COPY_OUT_SYSTEM_DLKM must be either 'system_dlkm' or 'system/system_dlkm', seeing '$(TARGET_COPY_OUT_ODM_DLKM)'.)
884endif
885PRODUCT_COPY_FILES := $(subst $(_system_dlkm_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_DLKM),$(PRODUCT_COPY_FILES))
886
887BOARD_USES_SYSTEM_DLKMIMAGE :=
888ifdef BOARD_PREBUILT_SYSTEM_DLKMIMAGE
889 BOARD_USES_SYSTEM_DLKMIMAGE := true
890endif
891ifdef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
892 BOARD_USES_SYSTEM_DLKMIMAGE := true
893endif
894$(call check_image_config,system_dlkm)
895
896BUILDING_SYSTEM_DLKM_IMAGE :=
897ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),)
898 ifdef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
899 BUILDING_SYSTEM_DLKM_IMAGE := true
900 endif
901else ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),true)
902 BUILDING_SYSTEM_DLKM_IMAGE := true
903 ifndef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
904 $(error PRODUCT_BUILD_SYSTEM_DLKM_IMAGE set to true, but BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
905 endif
906endif
907ifdef BOARD_PREBUILT_SYSTEM_DLKMIMAGE
908 BUILDING_SYSTEM_DLKM_IMAGE :=
909endif
910.KATI_READONLY := BUILDING_SYSTEM_DLKM_IMAGE
911
Pierre-Clément Tosi88648d32021-09-24 15:41:13 +0200912BOARD_USES_PVMFWIMAGE :=
Pierre-Clément Tosifa8193c2021-09-24 15:49:00 +0200913ifeq ($(PRODUCT_BUILD_PVMFW_IMAGE),true)
914 BOARD_USES_PVMFWIMAGE := true
915endif
Pierre-Clément Tosi88648d32021-09-24 15:41:13 +0200916.KATI_READONLY := BOARD_USES_PVMFWIMAGE
917
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000918###########################################
Yifan Hong65afc072020-04-17 10:08:10 -0700919# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000920TARGET_RECOVERY_UPDATER_LIBS ?=
921AB_OTA_UPDATER ?=
922.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
Yifan Hong65afc072020-04-17 10:08:10 -0700923
924# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true
925ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
926 ifneq ($(AB_OTA_UPDATER),true)
927 $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true)
928 endif
929endif
930
931# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB
932# to see if non-A/B is supported.
933TARGET_OTA_ALLOW_NON_AB := false
934ifneq ($(AB_OTA_UPDATER),true)
935 TARGET_OTA_ALLOW_NON_AB := true
936else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
937 TARGET_OTA_ALLOW_NON_AB := true
938endif
939.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB
940
941ifneq ($(TARGET_OTA_ALLOW_NON_AB),true)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000942 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
Yifan Hong65afc072020-04-17 10:08:10 -0700943 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000944 endif
945endif
946
Joel Galenson154ac1d2020-07-30 14:23:31 -0700947# Quick check for building generic OTA packages. Currently it only supports A/B OTAs.
Tao Bao9be20c72019-04-08 21:11:59 -0700948ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
949 ifneq ($(AB_OTA_UPDATER),true)
950 $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported)
951 endif
952endif
953
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700954ifdef BOARD_PREBUILT_DTBIMAGE_DIR
955 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
956 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported)
957 endif
958endif
959
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000960# Check BOARD_VNDK_VERSION
961define check_vndk_version
962 $(eval vndk_path := prebuilts/vndk/v$(1)) \
963 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
964endef
965
Steven Moreland78549ac2023-06-02 22:53:03 +0000966ifeq ($(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
967 $(error BOARD_VNDK_VERSION is equal to PLATFORM_VNDK_VERSION; use BOARD_VNDK_VERSION := current)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000968endif
Steven Moreland78549ac2023-06-02 22:53:03 +0000969ifneq ($(BOARD_VNDK_VERSION),current)
970 $(call check_vndk_version,$(BOARD_VNDK_VERSION))
JaeMan Parkaa7b03b2020-12-07 16:00:50 +0900971endif
Steven Moreland78549ac2023-06-02 22:53:03 +0000972TARGET_VENDOR_TEST_SUFFIX := /vendor
JaeMan Parkaa7b03b2020-12-07 16:00:50 +0900973
Martin Stjernholm7a430fd2020-06-04 15:16:39 +0100974ifeq (,$(TARGET_BUILD_UNBUNDLED))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000975ifdef PRODUCT_EXTRA_VNDK_VERSIONS
976 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
977endif
978endif
979
980# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS
981_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS))
982ifneq (,$(_unsupported_systemsdk_versions))
983 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
984 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
985endif
Dan Willemsen695849e2019-04-17 12:25:09 -0700986
987###########################################
988# Handle BUILD_BROKEN_USES_BUILD_*
989
Dan Willemsen97ec8122020-02-19 18:06:54 -0800990$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
Dan Willemsen695849e2019-04-17 12:25:09 -0700991 $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
992 $(KATI_obsolete_var $(m),Please convert to Soong),\
993 $(KATI_deprecated_var $(m),Please convert to Soong)))
994
Dan Willemsen97ec8122020-02-19 18:06:54 -0800995$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
Cole Fauste96edc32021-09-28 12:43:04 -0700996 $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)\#copy_headers),\
997 $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)\#copy_headers))
Dan Willemsen66d21d42020-01-27 19:26:02 -0800998
Dan Willemsen97ec8122020-02-19 18:06:54 -0800999$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\
Dan Willemsen695849e2019-04-17 12:25:09 -07001000 $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
1001 $(KATI_deprecated_var $(m),Please convert to Soong),\
1002 $(KATI_obsolete_var $(m),Please convert to Soong)))
Yifan Hong63c5ca12020-10-08 11:54:02 -07001003
1004ifndef BUILDING_RECOVERY_IMAGE
1005 ifeq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE))
1006 $(error Should not set BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE if not building recovery image)
1007 endif
1008endif
Yifan Hong881df392020-10-09 14:29:39 -07001009
1010ifndef BUILDING_VENDOR_BOOT_IMAGE
1011 ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
1012 $(error Should not set BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT if not building vendor_boot image)
1013 endif
Yo Chiangd21e7dc2020-12-10 18:42:47 +08001014 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
1015 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if not building vendor_boot image)
1016 endif
Yi-Yo Chiang1519d432021-04-04 16:03:10 +08001017else # BUILDING_VENDOR_BOOT_IMAGE
1018 ifneq (,$(call math_lt,$(BOARD_BOOT_HEADER_VERSION),4))
1019 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
1020 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if \
1021 BOARD_BOOT_HEADER_VERSION is less than 4)
1022 endif
Yi-Yo Chiang12f92442021-04-04 16:12:25 +08001023 ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
1024 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
1025 BOARD_BOOT_HEADER_VERSION is less than 4)
1026 endif
Yi-Yo Chiang1519d432021-04-04 16:03:10 +08001027 endif
1028endif # BUILDING_VENDOR_BOOT_IMAGE
Yo Chiangd21e7dc2020-12-10 18:42:47 +08001029
1030ifneq ($(words $(BOARD_VENDOR_RAMDISK_FRAGMENTS)),$(words $(sort $(BOARD_VENDOR_RAMDISK_FRAGMENTS))))
1031 $(error BOARD_VENDOR_RAMDISK_FRAGMENTS has duplicate entries: $(BOARD_VENDOR_RAMDISK_FRAGMENTS))
Yifan Hong881df392020-10-09 14:29:39 -07001032endif
1033
Yi-Yo Chiang12f92442021-04-04 16:12:25 +08001034ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
1035 ifneq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
1036 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
1037 BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set)
1038 endif
1039endif
1040
Yifan Hong881df392020-10-09 14:29:39 -07001041# If BOARD_USES_GENERIC_KERNEL_IMAGE is set, BOARD_USES_RECOVERY_AS_BOOT must not be set.
1042# Devices without a dedicated recovery partition uses BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT to
1043# build recovery into vendor_boot.
1044ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE))
1045 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
1046 $(error BOARD_USES_RECOVERY_AS_BOOT cannot be true if BOARD_USES_GENERIC_KERNEL_IMAGE is true. \
1047 Use BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT instead)
1048 endif
1049endif
Yifan Hongcc6c2022020-11-13 19:12:06 -08001050
1051ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
1052 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
1053 $(error BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT and BOARD_USES_RECOVERY_AS_BOOT cannot be \
1054 both true. Recovery resources should be installed to either boot or vendor_boot, but not both)
1055 endif
1056endif