blob: 5a1a781fc64735be073ccc22fb29ff12b7515de4 [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_MKBOOTIMG_ARGS
165_board_strip_list += BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE
Lucas Weif57333f2022-02-24 10:30:15 +0800166_board_strip_list += BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE
Cole Faustc8c516a2021-12-09 10:30:19 -0800167_board_strip_list += ODM_MANIFEST_SKUS
Cole Faust29bb6132021-11-29 17:26:03 -0800168
169
Anton Hanssond488d2d2019-02-26 15:49:25 +0000170_build_broken_var_list := \
Alix7a4d5392022-08-25 14:17:18 +0000171 BUILD_BROKEN_CLANG_PROPERTY \
Alix Espino38e07f12022-09-14 19:10:51 +0000172 BUILD_BROKEN_CLANG_ASFLAGS \
173 BUILD_BROKEN_CLANG_CFLAGS \
Vinh Tran3fae6fe2022-06-21 12:00:02 -0400174 BUILD_BROKEN_DEPFILE \
Anton Hanssond488d2d2019-02-26 15:49:25 +0000175 BUILD_BROKEN_DUP_RULES \
Yo Chiang64faf882020-07-15 18:35:12 +0800176 BUILD_BROKEN_DUP_SYSPROP \
Yo Chiang0b49c032020-03-17 17:49:49 +0800177 BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
Inseob Kim9d281d92020-10-19 13:31:58 +0900178 BUILD_BROKEN_ENFORCE_SYSPROP_OWNER \
Liz Kammer4065e5b2022-01-31 16:16:06 -0500179 BUILD_BROKEN_INPUT_DIR_MODULES \
Yo Chiang64faf882020-07-15 18:35:12 +0800180 BUILD_BROKEN_MISSING_REQUIRED_MODULES \
Yifan Hong5e57a772020-01-09 16:15:11 -0800181 BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
Logan Chien2a880752019-09-17 09:45:09 -0700182 BUILD_BROKEN_PREBUILT_ELF_FILES \
Inseob Kim5d60c8a2019-10-17 10:32:59 +0000183 BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
Dan Willemsen0586c652019-04-09 09:56:48 -0700184 BUILD_BROKEN_USES_NETWORK \
Inseob Kim43f4ef02021-02-03 18:17:49 +0900185 BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE \
Yifan Hong5e57a772020-01-09 16:15:11 -0800186 BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
Cole Faust152cdfa2023-07-26 14:33:51 -0700187 BUILD_BROKEN_INCORRECT_PARTITION_IMAGES \
Cole Faustb0990302023-10-18 22:50:26 +0000188 BUILD_BROKEN_GENRULE_SANDBOXING \
Jiyong Park885b0042024-01-04 23:21:26 +0000189 BUILD_BROKEN_DONT_CHECK_SYSTEMSDK \
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)
Jiakai Zhangbf0c0e62023-11-06 17:55:59 +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 \
Roman Kiryanov8cc6b112023-10-20 11:56:05 -0700225 device/generic/goldfish/board/$(TARGET_DEVICE)/BoardConfig.mk \
226 device/google/cuttlefish/board/$(TARGET_DEVICE)/BoardConfig.mk \
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000227 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
228 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
229 )))
230 ifeq ($(board_config_mk),)
231 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
232 endif
233 ifneq ($(words $(board_config_mk)),1)
234 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
235 endif
236 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
237 .KATI_READONLY := TARGET_DEVICE_DIR
238endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000239
Cole Faust12711512022-05-02 14:16:04 -0700240ifndef RBC_PRODUCT_CONFIG
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000241include $(board_config_mk)
Cole Fauste5e7a2d2021-09-30 17:14:29 -0700242else
Cole Faust985fa482021-10-07 17:14:23 -0700243 $(shell mkdir -p $(OUT_DIR)/rbc)
Cole Faustf1f49bb2021-12-01 13:49:12 -0800244 $(call dump-variables-rbc, $(OUT_DIR)/rbc/make_vars_pre_board_config.mk)
Cole Faust985fa482021-10-07 17:14:23 -0700245
Cole Faust08e78b92022-03-24 17:32:39 -0700246 $(shell $(OUT_DIR)/mk2rbc \
Cole Faust985fa482021-10-07 17:14:23 -0700247 --mode=write -r --outdir $(OUT_DIR)/rbc \
248 --boardlauncher=$(OUT_DIR)/rbc/boardlauncher.rbc \
249 --input_variables=$(OUT_DIR)/rbc/make_vars_pre_board_config.mk \
Cole Faust1bcdd242022-02-07 15:17:55 -0800250 --makefile_list=$(OUT_DIR)/.module_paths/configuration.list \
Cole Faust985fa482021-10-07 17:14:23 -0700251 $(board_config_mk))
252 ifneq ($(.SHELLSTATUS),0)
253 $(error board configuration converter failed: $(.SHELLSTATUS))
Cole Fauste5e7a2d2021-09-30 17:14:29 -0700254 endif
255
Sasha Smundak7dc8f482021-11-17 17:19:12 -0800256 $(shell build/soong/scripts/update_out $(OUT_DIR)/rbc/rbc_board_config_results.mk \
Cole Faustc63ce1a2023-05-09 14:56:36 -0700257 $(OUT_DIR)/rbcrun --mode=rbc $(OUT_DIR)/rbc/boardlauncher.rbc)
Cole Faust985fa482021-10-07 17:14:23 -0700258 ifneq ($(.SHELLSTATUS),0)
259 $(error board configuration runner failed: $(.SHELLSTATUS))
260 endif
261
262 include $(OUT_DIR)/rbc/rbc_board_config_results.mk
Cole Fauste5e7a2d2021-09-30 17:14:29 -0700263endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000264
265ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE)))
266 $(error $(board_config_mk) erroneously sets both TARGET_ARCH and TARGET_ARCH_SUITE)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000267endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000268ifeq ($(TARGET_ARCH)$(TARGET_ARCH_SUITE),)
269 $(error Target architectures not defined by board config: $(board_config_mk))
270endif
271ifeq ($(TARGET_CPU_ABI)$(TARGET_ARCH_SUITE),)
272 $(error TARGET_CPU_ABI not defined by board config: $(board_config_mk))
273endif
274
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000275ifneq ($(MALLOC_IMPL),)
276 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).)
277 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
278endif
279board_config_mk :=
280
Anton Hanssond488d2d2019-02-26 15:49:25 +0000281# Clean up and verify BoardConfig variables
282$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var)))))
Cole Faust29bb6132021-11-29 17:26:03 -0800283$(foreach var,$(_board_strip_list),$(eval $(var) := $$(strip $$($(var)))))
Anton Hanssond488d2d2019-02-26 15:49:25 +0000284$(foreach var,$(_board_true_false_vars), \
285 $(if $(filter-out true false,$($(var))), \
286 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))")))
Anton Hanssonb9544692019-02-26 13:37:28 +0000287
Jooyung Han0140dfa2022-07-25 14:10:19 +0900288include $(BUILD_SYSTEM)/board_config_wifi.mk
289
Anton Hanssonb9544692019-02-26 13:37:28 +0000290# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified.
291TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT))
292TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT))
293
Anton Hansson41f9cc22020-11-27 11:00:38 +0000294ifdef TARGET_ARCH
295 # The combo makefiles check and set defaults for various CPU configuration
296 combo_target := TARGET_
297 combo_2nd_arch_prefix :=
298 include $(BUILD_SYSTEM)/combo/select.mk
299endif
Anton Hansson19279852019-02-28 17:15:57 +0000300
301ifdef TARGET_2ND_ARCH
302 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
303 include $(BUILD_SYSTEM)/combo/select.mk
304endif
305
Anton Hanssond488d2d2019-02-26 15:49:25 +0000306.KATI_READONLY := $(_board_strip_readonly_list)
307
308INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE)
Devin Moored6eab6f2021-03-10 16:28:49 -0800309ifneq (,$(BOARD_BOOTCONFIG))
310 INTERNAL_KERNEL_CMDLINE += bootconfig
311 INTERNAL_BOOTCONFIG := $(BOARD_BOOTCONFIG)
312endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000313
Anton Hanssonb9544692019-02-26 13:37:28 +0000314ifneq ($(filter %64,$(TARGET_ARCH)),)
315 TARGET_IS_64_BIT := true
316endif
317
318ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS)))
319 TARGET_SUPPORTS_32_BIT_APPS := true
320endif
321
Joel Galenson154ac1d2020-07-30 14:23:31 -0700322# Quick check to warn about likely cryptic errors later in the build.
Anton Hanssonb9544692019-02-26 13:37:28 +0000323ifeq ($(TARGET_IS_64_BIT),true)
324 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
Anton Hansson6d25fc62019-05-10 15:29:28 +0100325 $(error Building a 32-bit-app-only product on a 64-bit device. \
Anton Hanssonb9544692019-02-26 13:37:28 +0000326 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false)
327 endif
328endif
329
330# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
331# comma separated lists of the 32 and 64 bit ABIs (in order of
332# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT
333# are defined by the board config, we use them. Else, we construct
334# these lists based on whether TARGET_IS_64_BIT is set.
335#
336# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target
337# is always 32 bits. If this isn't the case, these variables should
338# be overriden in the board configuration.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200339#
340# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always
341# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs.
342_target_native_bridge_abi_list_32_bit :=
343_target_native_bridge_abi_list_64_bit :=
344
Anton Hanssonb9544692019-02-26 13:37:28 +0000345ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
346 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
347 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200348 _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000349 endif
350endif
351
Peter Collingbourne6aea25d2019-05-16 14:09:35 -0700352# "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported
353# in all builds with SANITIZE_TARGET=hwaddress.
354ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),)
355 ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),)
356 TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT)
357 endif
358endif
359
Anton Hanssonb9544692019-02-26 13:37:28 +0000360ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT))
361 ifneq (true,$(TARGET_IS_64_BIT))
362 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200363 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000364 else
365 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
366 # For a 64 bit target, assume that the 2ND_CPU_ABI
367 # is a 32 bit ABI.
368 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200369 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000370 endif
371 endif
372endif
373
374# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
375# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
376# is specified by the board configuration, we use that. If not, we
377# build a list out of the TARGET_CPU_ABIs specified by the config.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200378# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
Anton Hanssonb9544692019-02-26 13:37:28 +0000379ifeq (,$(TARGET_CPU_ABI_LIST))
Elliott Hughes9b824d52020-04-17 15:46:55 -0700380 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
381 $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
Anton Hanssonb9544692019-02-26 13:37:28 +0000382endif
383
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200384# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference.
385TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit)
386TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit)
387
Anton Hanssonb9544692019-02-26 13:37:28 +0000388# Strip whitespace from the ABI list string.
389TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST)))
390TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
391TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
392
Jeongik Chabb688a92019-07-12 12:51:37 +0900393# Check if config about image building is valid or not.
394define check_image_config
395 $(eval _uc_name := $(call to-upper,$(1))) \
396 $(eval _lc_name := $(call to-lower,$(1))) \
397 $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \
398 $(if $(BOARD_USES_$(_uc_name)IMAGE),, \
399 $(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)), \
400 $(if $(BOARD_USES_$(_uc_name)IMAGE), \
401 $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \
402 $(eval _uc_name :=) \
403 $(eval _lc_name :=)
404endef
405
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000406###########################################
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000407# Configure whether we're building the system image
408BUILDING_SYSTEM_IMAGE := true
409ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),)
410 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE
411 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
412 BUILDING_SYSTEM_IMAGE :=
413 endif
414 endif
415else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false)
416 BUILDING_SYSTEM_IMAGE :=
417endif
418.KATI_READONLY := BUILDING_SYSTEM_IMAGE
419
420# Are we building a system_other image
421BUILDING_SYSTEM_OTHER_IMAGE :=
422ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),)
423 ifdef BUILDING_SYSTEM_IMAGE
424 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
425 BUILDING_SYSTEM_OTHER_IMAGE := true
426 endif
427 endif
428else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true)
429 BUILDING_SYSTEM_OTHER_IMAGE := true
430 ifndef BUILDING_SYSTEM_IMAGE
431 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image)
432 endif
433endif
434.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE
435
436# Are we building a cache image
437BUILDING_CACHE_IMAGE :=
438ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),)
439 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
440 BUILDING_CACHE_IMAGE := true
441 endif
442else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true)
443 BUILDING_CACHE_IMAGE := true
444 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
445 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined)
446 endif
447endif
448.KATI_READONLY := BUILDING_CACHE_IMAGE
449
Chris Grossa784ef12019-04-22 11:09:57 -0700450# Are we building a boot image
451BUILDING_BOOT_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700452ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),)
453 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
454 BUILDING_BOOT_IMAGE :=
Bowgo Tsaicf9ead82021-05-20 00:14:42 +0800455 else ifdef BOARD_PREBUILT_BOOTIMAGE
456 BUILDING_BOOT_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700457 else ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Chris Grossa784ef12019-04-22 11:09:57 -0700458 BUILDING_BOOT_IMAGE := true
Yifan Hongebe65f82020-10-15 14:48:07 -0700459 else ifneq (,$(foreach kernel,$(BOARD_KERNEL_BINARIES),$(BOARD_$(call to-upper,$(kernel))_BOOTIMAGE_PARTITION_SIZE)))
460 BUILDING_BOOT_IMAGE := true
Chris Grossa784ef12019-04-22 11:09:57 -0700461 endif
462else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true)
Daniel Norman42879ff2020-10-06 11:09:56 -0700463 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
464 $(warning *** PRODUCT_BUILD_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT.)
465 $(warning *** Skipping building boot image.)
466 BUILDING_BOOT_IMAGE :=
467 else
468 BUILDING_BOOT_IMAGE := true
469 endif
Chris Grossa784ef12019-04-22 11:09:57 -0700470endif
471.KATI_READONLY := BUILDING_BOOT_IMAGE
472
Devin Moore380d9e42021-11-04 19:01:19 +0000473# Are we building an init boot image
474BUILDING_INIT_BOOT_IMAGE :=
475ifeq ($(PRODUCT_BUILD_INIT_BOOT_IMAGE),)
476 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
477 BUILDING_INIT_BOOT_IMAGE :=
478 else ifdef BOARD_PREBUILT_INIT_BOOT_IMAGE
479 BUILDING_INIT_BOOT_IMAGE :=
480 else ifdef BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE
481 BUILDING_INIT_BOOT_IMAGE := true
482 endif
483else ifeq ($(PRODUCT_BUILD_INIT_BOOT_IMAGE),true)
484 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
485 $(error PRODUCT_BUILD_INIT_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT. Use only one option.)
486 else
487 BUILDING_INIT_BOOT_IMAGE := true
488 endif
489endif
490.KATI_READONLY := BUILDING_INIT_BOOT_IMAGE
491
Chris Grossa784ef12019-04-22 11:09:57 -0700492# Are we building a recovery image
493BUILDING_RECOVERY_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700494ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),)
495 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
496 BUILDING_RECOVERY_IMAGE := true
Yifan Hong881df392020-10-09 14:29:39 -0700497 else ifeq ($(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT),true)
498 # Set to true to build recovery resources for vendor_boot
499 BUILDING_RECOVERY_IMAGE := true
Daniel Norman42879ff2020-10-06 11:09:56 -0700500 else ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Chris Grossa784ef12019-04-22 11:09:57 -0700501 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
502 BUILDING_RECOVERY_IMAGE := true
503 endif
504 endif
505else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true)
506 BUILDING_RECOVERY_IMAGE := true
507endif
508.KATI_READONLY := BUILDING_RECOVERY_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000509
Steve Mucklee1b10862019-07-10 10:49:37 -0700510# Are we building a vendor boot image
511BUILDING_VENDOR_BOOT_IMAGE :=
512ifdef BOARD_BOOT_HEADER_VERSION
513 ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),)
Daniel Normanad6293c2020-10-16 15:10:21 -0700514 ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),)
Daniel Norman42879ff2020-10-06 11:09:56 -0700515 BUILDING_VENDOR_BOOT_IMAGE := true
516 else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),true)
Steve Muckle3363a0b2020-02-12 13:38:28 -0800517 BUILDING_VENDOR_BOOT_IMAGE := true
518 endif
Steve Mucklee1b10862019-07-10 10:49:37 -0700519 endif
520endif
521.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE
522
Lucas Weif57333f2022-02-24 10:30:15 +0800523# Are we building a vendor kernel boot image
524BUILDING_VENDOR_KERNEL_BOOT_IMAGE :=
525ifeq ($(PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE),true)
526 ifneq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
527 $(error BUILDING_VENDOR_BOOT_IMAGE is required, but BUILDING_VENDOR_BOOT_IMAGE is not true)
528 endif
529 ifndef BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE
530 $(error BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE is required when PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE is true)
531 endif
532 BUILDING_VENDOR_KERNEL_BOOT_IMAGE := true
533else ifeq ($(PRODUCT_BUILD_VENDOR_KERNEL),)
534 ifdef BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE
535 ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
536 BUILDING_VENDOR_KERNEL_BOOT_IMAGE := true
537 endif
538 endif
539endif # end of PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE
540.KATI_READONLY := BUILDING_VENDOR_KERNEL_BOOT_IMAGE
541
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000542# Are we building a ramdisk image
543BUILDING_RAMDISK_IMAGE := true
544ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
545 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true:
546 # BUILDING_BOOT_IMAGE
547 # BUILDING_RECOVERY_IMAGE
548else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
549 BUILDING_RAMDISK_IMAGE :=
550endif
551.KATI_READONLY := BUILDING_RAMDISK_IMAGE
552
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800553# Are we building a debug vendor_boot image
554BUILDING_DEBUG_VENDOR_BOOT_IMAGE :=
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800555# Can't build vendor_boot-debug.img if we're not building a ramdisk.
Yi-Yo Chiang06c62732022-10-07 21:18:45 +0800556ifndef BUILDING_RAMDISK_IMAGE
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800557 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
558 $(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a ramdisk image. \
559 Skip building the debug vendor_boot image.)
560 endif
561# Can't build vendor_boot-debug.img if we're not building a vendor_boot.img.
562else ifndef BUILDING_VENDOR_BOOT_IMAGE
563 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
564 $(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a vendor_boot image. \
565 Skip building the debug vendor_boot image.)
566 endif
567else
568 ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),)
569 BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true
570 else ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
571 BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true
572 endif
573endif
574.KATI_READONLY := BUILDING_DEBUG_VENDOR_BOOT_IMAGE
575
576_has_boot_img_artifact :=
577ifneq ($(strip $(TARGET_NO_KERNEL)),true)
578 ifdef BUILDING_BOOT_IMAGE
579 _has_boot_img_artifact := true
580 endif
581 # BUILDING_RECOVERY_IMAGE && BOARD_USES_RECOVERY_AS_BOOT implies that
582 # recovery is being built with the file name *boot.img*, which still counts
583 # as "building boot.img".
584 ifdef BUILDING_RECOVERY_IMAGE
585 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
586 _has_boot_img_artifact := true
587 endif
588 endif
589endif
590
591# Are we building a debug boot image
592BUILDING_DEBUG_BOOT_IMAGE :=
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800593# Can't build boot-debug.img if we're not building a ramdisk.
Yi-Yo Chiang06c62732022-10-07 21:18:45 +0800594ifndef BUILDING_RAMDISK_IMAGE
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800595 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
596 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a ramdisk image. \
597 Skip building the debug boot image.)
598 endif
599# Can't build boot-debug.img if we're not building a boot.img.
600else ifndef _has_boot_img_artifact
601 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
602 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a boot image. \
603 Skip building the debug boot image.)
604 endif
Devin Moore380d9e42021-11-04 19:01:19 +0000605else ifdef BUILDING_INIT_BOOT_IMAGE
606 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
607 $(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we don't have a ramdisk in the boot image. \
608 Skip building the debug boot image.)
609 endif
Yi-Yo Chiang4d7c6132021-09-29 19:41:11 +0800610else
611 ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),)
612 BUILDING_DEBUG_BOOT_IMAGE := true
613 # Don't build boot-debug.img if we're already building vendor_boot-debug.img.
614 ifdef BUILDING_DEBUG_VENDOR_BOOT_IMAGE
615 BUILDING_DEBUG_BOOT_IMAGE :=
616 endif
617 else ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
618 BUILDING_DEBUG_BOOT_IMAGE := true
619 endif
620endif
621.KATI_READONLY := BUILDING_DEBUG_BOOT_IMAGE
622_has_boot_img_artifact :=
623
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000624# Are we building a userdata image
625BUILDING_USERDATA_IMAGE :=
626ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)
627 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
628 BUILDING_USERDATA_IMAGE := true
629 endif
630else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
631 BUILDING_USERDATA_IMAGE := true
632endif
633.KATI_READONLY := BUILDING_USERDATA_IMAGE
634
Paul Trautrim4e143232019-08-13 16:30:57 +0900635# Are we building a vbmeta image
636BUILDING_VBMETA_IMAGE := true
637ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false)
638 BUILDING_VBMETA_IMAGE :=
639endif
640.KATI_READONLY := BUILDING_VBMETA_IMAGE
641
Yo Chiange86bab42021-03-25 10:12:28 +0000642# Are we building a super_empty image
643BUILDING_SUPER_EMPTY_IMAGE :=
644ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),)
645 ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
646 ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
647 BUILDING_SUPER_EMPTY_IMAGE := true
648 endif
649 endif
650else ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),true)
651 ifneq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
652 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but PRODUCT_USE_DYNAMIC_PARTITIONS is not true)
653 endif
654 ifeq ($(BOARD_SUPER_PARTITION_SIZE),)
655 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but BOARD_SUPER_PARTITION_SIZE is not defined)
656 endif
657 BUILDING_SUPER_EMPTY_IMAGE := true
658endif
659.KATI_READONLY := BUILDING_SUPER_EMPTY_IMAGE
660
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000661###########################################
662# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
663ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
664 TARGET_COPY_OUT_VENDOR := system/vendor
665else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
666 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
667endif
668PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
669
670BOARD_USES_VENDORIMAGE :=
671ifdef BOARD_PREBUILT_VENDORIMAGE
672 BOARD_USES_VENDORIMAGE := true
673endif
674ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
675 BOARD_USES_VENDORIMAGE := true
676endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900677# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image.
678# But target's BOARD_PREBUILT_VENDORIMAGE is not filled.
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000679ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
680 BOARD_USES_VENDORIMAGE := true
681else ifdef BOARD_USES_VENDORIMAGE
682 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
683endif
684.KATI_READONLY := BOARD_USES_VENDORIMAGE
685
686BUILDING_VENDOR_IMAGE :=
687ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),)
688 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
689 BUILDING_VENDOR_IMAGE := true
690 endif
691else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true)
692 BUILDING_VENDOR_IMAGE := true
693 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
694 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined)
695 endif
696endif
697ifdef BOARD_PREBUILT_VENDORIMAGE
698 BUILDING_VENDOR_IMAGE :=
699endif
700.KATI_READONLY := BUILDING_VENDOR_IMAGE
701
702###########################################
703# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
704ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder))
705TARGET_COPY_OUT_PRODUCT := system/product
706else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),)
707$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.)
708endif
709PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES))
710
711BOARD_USES_PRODUCTIMAGE :=
712ifdef BOARD_PREBUILT_PRODUCTIMAGE
713 BOARD_USES_PRODUCTIMAGE := true
714endif
715ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
716 BOARD_USES_PRODUCTIMAGE := true
717endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900718$(call check_image_config,product)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000719.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
720
721BUILDING_PRODUCT_IMAGE :=
722ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),)
723 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
724 BUILDING_PRODUCT_IMAGE := true
725 endif
726else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true)
727 BUILDING_PRODUCT_IMAGE := true
728 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
729 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined)
730 endif
731endif
732ifdef BOARD_PREBUILT_PRODUCTIMAGE
733 BUILDING_PRODUCT_IMAGE :=
734endif
735.KATI_READONLY := BUILDING_PRODUCT_IMAGE
736
737###########################################
Justin Yun6151e3f2019-06-25 15:58:13 +0900738# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to
739# TARGET_COPY_OUT_PRODUCT as a workaround.
740TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000741
Justin Yun6151e3f2019-06-25 15:58:13 +0900742###########################################
743# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT
744ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder))
745TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
746else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),)
747$(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 +0000748endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900749PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000750
Justin Yun6151e3f2019-06-25 15:58:13 +0900751BOARD_USES_SYSTEM_EXTIMAGE :=
752ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
753 BOARD_USES_SYSTEM_EXTIMAGE := true
754endif
755ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
756 BOARD_USES_SYSTEM_EXTIMAGE := true
757endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900758$(call check_image_config,system_ext)
Justin Yun6151e3f2019-06-25 15:58:13 +0900759.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
760
761BUILDING_SYSTEM_EXT_IMAGE :=
762ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),)
763 ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
764 BUILDING_SYSTEM_EXT_IMAGE := true
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000765 endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900766else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true)
767 BUILDING_SYSTEM_EXT_IMAGE := true
768 ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
769 $(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 +0000770 endif
771endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900772ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
773 BUILDING_SYSTEM_EXT_IMAGE :=
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000774endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900775.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000776
777###########################################
Yifan Hongcfb917a2020-05-07 14:58:20 -0700778# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM
779ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder))
780 TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm
781else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),)
782 $(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)'.)
783endif
784PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES))
785
786BOARD_USES_VENDOR_DLKMIMAGE :=
787ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
788 BOARD_USES_VENDOR_DLKMIMAGE := true
789endif
790ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
791 BOARD_USES_VENDOR_DLKMIMAGE := true
792endif
793$(call check_image_config,vendor_dlkm)
794
795BUILDING_VENDOR_DLKM_IMAGE :=
796ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),)
797 ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
798 BUILDING_VENDOR_DLKM_IMAGE := true
799 endif
800else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true)
801 BUILDING_VENDOR_DLKM_IMAGE := true
802 ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
803 $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
804 endif
805endif
806ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
807 BUILDING_VENDOR_DLKM_IMAGE :=
808endif
809.KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE
810
811###########################################
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000812# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
813ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
dianlujitao339ef4c2019-10-10 09:26:00 +0800814 TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm
815else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
816 $(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 +0000817endif
818PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
819
820BOARD_USES_ODMIMAGE :=
821ifdef BOARD_PREBUILT_ODMIMAGE
822 BOARD_USES_ODMIMAGE := true
823endif
824ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
825 BOARD_USES_ODMIMAGE := true
826endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900827$(call check_image_config,odm)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000828
829BUILDING_ODM_IMAGE :=
Dan Willemsen25a69372019-04-19 15:00:12 -0700830ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000831 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
832 BUILDING_ODM_IMAGE := true
833 endif
834else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true)
835 BUILDING_ODM_IMAGE := true
836 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
837 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined)
838 endif
839endif
840ifdef BOARD_PREBUILT_ODMIMAGE
841 BUILDING_ODM_IMAGE :=
842endif
843.KATI_READONLY := BUILDING_ODM_IMAGE
844
Yifan Hongf496f1b2020-07-15 16:52:59 -0700845
846###########################################
847# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM
848ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder))
849 TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm
850else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),)
851 $(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)'.)
852endif
853PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES))
854
855BOARD_USES_ODM_DLKMIMAGE :=
856ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
857 BOARD_USES_ODM_DLKMIMAGE := true
858endif
859ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
860 BOARD_USES_ODM_DLKMIMAGE := true
861endif
862$(call check_image_config,odm_dlkm)
863
864BUILDING_ODM_DLKM_IMAGE :=
865ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),)
866 ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
867 BUILDING_ODM_DLKM_IMAGE := true
868 endif
869else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true)
870 BUILDING_ODM_DLKM_IMAGE := true
871 ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
872 $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
873 endif
874endif
875ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
876 BUILDING_ODM_DLKM_IMAGE :=
877endif
878.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE
879
Ramji Jiyani13a41372022-01-27 07:05:08 +0000880###########################################
881# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_DLKM
882ifeq ($(TARGET_COPY_OUT_SYSTEM_DLKM),$(_system_dlkm_path_placeholder))
883 TARGET_COPY_OUT_SYSTEM_DLKM := $(TARGET_COPY_OUT_SYSTEM)/system_dlkm
884else ifeq ($(filter system_dlkm system/system_dlkm,$(TARGET_COPY_OUT_SYSTEM_DLKM)),)
885 $(error TARGET_COPY_OUT_SYSTEM_DLKM must be either 'system_dlkm' or 'system/system_dlkm', seeing '$(TARGET_COPY_OUT_ODM_DLKM)'.)
886endif
887PRODUCT_COPY_FILES := $(subst $(_system_dlkm_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_DLKM),$(PRODUCT_COPY_FILES))
888
889BOARD_USES_SYSTEM_DLKMIMAGE :=
890ifdef BOARD_PREBUILT_SYSTEM_DLKMIMAGE
891 BOARD_USES_SYSTEM_DLKMIMAGE := true
892endif
893ifdef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
894 BOARD_USES_SYSTEM_DLKMIMAGE := true
895endif
896$(call check_image_config,system_dlkm)
897
898BUILDING_SYSTEM_DLKM_IMAGE :=
899ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),)
900 ifdef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
901 BUILDING_SYSTEM_DLKM_IMAGE := true
902 endif
903else ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),true)
904 BUILDING_SYSTEM_DLKM_IMAGE := true
905 ifndef BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE
906 $(error PRODUCT_BUILD_SYSTEM_DLKM_IMAGE set to true, but BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
907 endif
908endif
909ifdef BOARD_PREBUILT_SYSTEM_DLKMIMAGE
910 BUILDING_SYSTEM_DLKM_IMAGE :=
911endif
912.KATI_READONLY := BUILDING_SYSTEM_DLKM_IMAGE
913
Pierre-Clément Tosi88648d32021-09-24 15:41:13 +0200914BOARD_USES_PVMFWIMAGE :=
Pierre-Clément Tosifa8193c2021-09-24 15:49:00 +0200915ifeq ($(PRODUCT_BUILD_PVMFW_IMAGE),true)
916 BOARD_USES_PVMFWIMAGE := true
917endif
Pierre-Clément Tosi88648d32021-09-24 15:41:13 +0200918.KATI_READONLY := BOARD_USES_PVMFWIMAGE
919
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000920###########################################
Yifan Hong65afc072020-04-17 10:08:10 -0700921# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000922TARGET_RECOVERY_UPDATER_LIBS ?=
923AB_OTA_UPDATER ?=
924.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
Yifan Hong65afc072020-04-17 10:08:10 -0700925
926# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true
927ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
928 ifneq ($(AB_OTA_UPDATER),true)
929 $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true)
930 endif
931endif
932
933# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB
934# to see if non-A/B is supported.
935TARGET_OTA_ALLOW_NON_AB := false
936ifneq ($(AB_OTA_UPDATER),true)
937 TARGET_OTA_ALLOW_NON_AB := true
938else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
939 TARGET_OTA_ALLOW_NON_AB := true
940endif
941.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB
942
943ifneq ($(TARGET_OTA_ALLOW_NON_AB),true)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000944 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
Yifan Hong65afc072020-04-17 10:08:10 -0700945 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000946 endif
947endif
948
Joel Galenson154ac1d2020-07-30 14:23:31 -0700949# Quick check for building generic OTA packages. Currently it only supports A/B OTAs.
Tao Bao9be20c72019-04-08 21:11:59 -0700950ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
951 ifneq ($(AB_OTA_UPDATER),true)
952 $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported)
953 endif
954endif
955
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700956ifdef BOARD_PREBUILT_DTBIMAGE_DIR
957 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
958 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported)
959 endif
960endif
961
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000962# Check BOARD_VNDK_VERSION
963define check_vndk_version
964 $(eval vndk_path := prebuilts/vndk/v$(1)) \
965 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
966endef
967
Steven Moreland78549ac2023-06-02 22:53:03 +0000968ifeq ($(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
969 $(error BOARD_VNDK_VERSION is equal to PLATFORM_VNDK_VERSION; use BOARD_VNDK_VERSION := current)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000970endif
Steven Moreland78549ac2023-06-02 22:53:03 +0000971ifneq ($(BOARD_VNDK_VERSION),current)
972 $(call check_vndk_version,$(BOARD_VNDK_VERSION))
JaeMan Parkaa7b03b2020-12-07 16:00:50 +0900973endif
Steven Moreland78549ac2023-06-02 22:53:03 +0000974TARGET_VENDOR_TEST_SUFFIX := /vendor
JaeMan Parkaa7b03b2020-12-07 16:00:50 +0900975
Martin Stjernholm7a430fd2020-06-04 15:16:39 +0100976ifeq (,$(TARGET_BUILD_UNBUNDLED))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000977ifdef PRODUCT_EXTRA_VNDK_VERSIONS
978 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
979endif
980endif
981
982# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS
983_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS))
984ifneq (,$(_unsupported_systemsdk_versions))
985 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
986 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
987endif
Dan Willemsen695849e2019-04-17 12:25:09 -0700988
989###########################################
Justin Yun23d52432023-11-10 16:31:04 +0900990# BOARD_API_LEVEL for vendor API surface
991ifdef RELEASE_BOARD_API_LEVEL
992 ifdef BOARD_API_LEVEL
993 $(error BOARD_API_LEVEL must not set manully. The build system automatically sets this value.)
994 endif
995 BOARD_API_LEVEL := $(RELEASE_BOARD_API_LEVEL)
996 .KATI_READONLY := BOARD_API_LEVEL
997
998 ifdef RELEASE_BOARD_API_LEVEL_FROZEN
999 BOARD_API_LEVEL_FROZEN := true
1000 .KATI_READONLY := BOARD_API_LEVEL_FROZEN
1001 endif
1002endif
1003
1004###########################################
Dan Willemsen695849e2019-04-17 12:25:09 -07001005# Handle BUILD_BROKEN_USES_BUILD_*
1006
Dan Willemsen97ec8122020-02-19 18:06:54 -08001007$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
Dan Willemsen695849e2019-04-17 12:25:09 -07001008 $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
1009 $(KATI_obsolete_var $(m),Please convert to Soong),\
1010 $(KATI_deprecated_var $(m),Please convert to Soong)))
1011
Dan Willemsen97ec8122020-02-19 18:06:54 -08001012$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
Cole Fauste96edc32021-09-28 12:43:04 -07001013 $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)\#copy_headers),\
1014 $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)\#copy_headers))
Dan Willemsen66d21d42020-01-27 19:26:02 -08001015
Dan Willemsen97ec8122020-02-19 18:06:54 -08001016$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\
Dan Willemsen695849e2019-04-17 12:25:09 -07001017 $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
1018 $(KATI_deprecated_var $(m),Please convert to Soong),\
1019 $(KATI_obsolete_var $(m),Please convert to Soong)))
Yifan Hong63c5ca12020-10-08 11:54:02 -07001020
1021ifndef BUILDING_RECOVERY_IMAGE
1022 ifeq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE))
1023 $(error Should not set BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE if not building recovery image)
1024 endif
1025endif
Yifan Hong881df392020-10-09 14:29:39 -07001026
1027ifndef BUILDING_VENDOR_BOOT_IMAGE
1028 ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
1029 $(error Should not set BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT if not building vendor_boot image)
1030 endif
Yo Chiangd21e7dc2020-12-10 18:42:47 +08001031 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
1032 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if not building vendor_boot image)
1033 endif
Yi-Yo Chiang1519d432021-04-04 16:03:10 +08001034else # BUILDING_VENDOR_BOOT_IMAGE
1035 ifneq (,$(call math_lt,$(BOARD_BOOT_HEADER_VERSION),4))
1036 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
1037 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if \
1038 BOARD_BOOT_HEADER_VERSION is less than 4)
1039 endif
Yi-Yo Chiang12f92442021-04-04 16:12:25 +08001040 ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
1041 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
1042 BOARD_BOOT_HEADER_VERSION is less than 4)
1043 endif
Yi-Yo Chiang1519d432021-04-04 16:03:10 +08001044 endif
1045endif # BUILDING_VENDOR_BOOT_IMAGE
Yo Chiangd21e7dc2020-12-10 18:42:47 +08001046
1047ifneq ($(words $(BOARD_VENDOR_RAMDISK_FRAGMENTS)),$(words $(sort $(BOARD_VENDOR_RAMDISK_FRAGMENTS))))
1048 $(error BOARD_VENDOR_RAMDISK_FRAGMENTS has duplicate entries: $(BOARD_VENDOR_RAMDISK_FRAGMENTS))
Yifan Hong881df392020-10-09 14:29:39 -07001049endif
1050
Yi-Yo Chiang12f92442021-04-04 16:12:25 +08001051ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
1052 ifneq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
1053 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
1054 BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set)
1055 endif
1056endif
1057
Yifan Hong881df392020-10-09 14:29:39 -07001058# If BOARD_USES_GENERIC_KERNEL_IMAGE is set, BOARD_USES_RECOVERY_AS_BOOT must not be set.
1059# Devices without a dedicated recovery partition uses BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT to
1060# build recovery into vendor_boot.
1061ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE))
1062 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
1063 $(error BOARD_USES_RECOVERY_AS_BOOT cannot be true if BOARD_USES_GENERIC_KERNEL_IMAGE is true. \
1064 Use BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT instead)
1065 endif
1066endif
Yifan Hongcc6c2022020-11-13 19:12:06 -08001067
1068ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
1069 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
1070 $(error BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT and BOARD_USES_RECOVERY_AS_BOOT cannot be \
1071 both true. Recovery resources should be installed to either boot or vendor_boot, but not both)
1072 endif
1073endif