blob: 9061342b87cff592251dc80a82aa82170904135b [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
68_board_strip_readonly_list += BOARD_RECOVERYIMAGE_PARTITION_SIZE
69_board_strip_readonly_list += BOARD_SYSTEMIMAGE_PARTITION_SIZE
70_board_strip_readonly_list += BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE
71_board_strip_readonly_list += BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE
72_board_strip_readonly_list += BOARD_USERDATAIMAGE_PARTITION_SIZE
73_board_strip_readonly_list += BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
74_board_strip_readonly_list += BOARD_CACHEIMAGE_PARTITION_SIZE
75_board_strip_readonly_list += BOARD_VENDORIMAGE_PARTITION_SIZE
76_board_strip_readonly_list += BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
77_board_strip_readonly_list += BOARD_PRODUCTIMAGE_PARTITION_SIZE
78_board_strip_readonly_list += BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
79_board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE
80_board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
81_board_strip_readonly_list += BOARD_ODMIMAGE_PARTITION_SIZE
82_board_strip_readonly_list += BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
83_board_strip_readonly_list += BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE
84_board_strip_readonly_list += BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
85_board_strip_readonly_list += BOARD_ODM_DLKMIMAGE_PARTITION_SIZE
86_board_strip_readonly_list += BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
Anton Hanssond488d2d2019-02-26 15:49:25 +000087
88# Logical partitions related variables.
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +000089_board_strip_readonly_list += BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE
90_board_strip_readonly_list += BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE
91_board_strip_readonly_list += BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE
92_board_strip_readonly_list += BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE
93_board_strip_readonly_list += BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE
94_board_strip_readonly_list += BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE
95_board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE
96_board_strip_readonly_list += BOARD_SUPER_PARTITION_SIZE
97_board_strip_readonly_list += BOARD_SUPER_PARTITION_GROUPS
Anton Hanssond488d2d2019-02-26 15:49:25 +000098
Yifan Hong6040cad2020-08-05 14:30:32 -070099# Kernel related variables
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +0000100_board_strip_readonly_list += BOARD_KERNEL_BINARIES
101_board_strip_readonly_list += BOARD_KERNEL_MODULE_INTERFACE_VERSIONS
Yifan Hong6040cad2020-08-05 14:30:32 -0700102
Yifan Hongd381f732020-10-08 11:08:20 -0700103# Variables related to generic kernel image (GKI) and generic boot image
104# - BOARD_USES_GENERIC_KERNEL_IMAGE is the global variable that defines if the
105# board uses GKI and generic boot image.
106# Update mechanism of the boot image is not enforced by this variable.
Yifan Hong63c5ca12020-10-08 11:54:02 -0700107# - BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE controls whether the recovery image
108# contains a kernel or not.
Yifan Hong881df392020-10-09 14:29:39 -0700109# - BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT controls whether ramdisk
110# recovery resources are built to vendor_boot.
Yi-Yo Chiang12f92442021-04-04 16:12:25 +0800111# - BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT controls whether recovery
112# resources are built as a standalone recovery ramdisk in vendor_boot.
Yifan Hong82b113d2020-10-12 12:42:12 -0700113# - BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT controls whether GSI AVB keys are
114# built to vendor_boot.
Yifan Hong49968aa2020-11-09 11:52:52 -0800115# - BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES controls whether boot images in $OUT are added
116# to target files package directly.
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +0000117_board_strip_readonly_list += BOARD_USES_GENERIC_KERNEL_IMAGE
118_board_strip_readonly_list += BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE
119_board_strip_readonly_list += BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT
Yi-Yo Chiang12f92442021-04-04 16:12:25 +0800120_board_strip_readonly_list += BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT
Anton Hanssonb7b3d8e2020-12-14 15:17:13 +0000121_board_strip_readonly_list += BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT
122_board_strip_readonly_list += BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES
Yifan Hongd381f732020-10-08 11:08:20 -0700123
Yo Chiangd21e7dc2020-12-10 18:42:47 +0800124# Defines the list of logical vendor ramdisk names to build or include in vendor_boot.
125_board_strip_readonly_list += BOARD_VENDOR_RAMDISK_FRAGMENTS
126
Anton Hanssond488d2d2019-02-26 15:49:25 +0000127_build_broken_var_list := \
Anton Hanssond488d2d2019-02-26 15:49:25 +0000128 BUILD_BROKEN_DUP_RULES \
Yo Chiang64faf882020-07-15 18:35:12 +0800129 BUILD_BROKEN_DUP_SYSPROP \
Yo Chiang0b49c032020-03-17 17:49:49 +0800130 BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
Inseob Kim9d281d92020-10-19 13:31:58 +0900131 BUILD_BROKEN_ENFORCE_SYSPROP_OWNER \
Yo Chiang64faf882020-07-15 18:35:12 +0800132 BUILD_BROKEN_MISSING_REQUIRED_MODULES \
Yifan Hong5e57a772020-01-09 16:15:11 -0800133 BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
Logan Chien2a880752019-09-17 09:45:09 -0700134 BUILD_BROKEN_PREBUILT_ELF_FILES \
Inseob Kim5d60c8a2019-10-17 10:32:59 +0000135 BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
Dan Willemsen0586c652019-04-09 09:56:48 -0700136 BUILD_BROKEN_USES_NETWORK \
Inseob Kim43f4ef02021-02-03 18:17:49 +0900137 BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE \
Yifan Hong5e57a772020-01-09 16:15:11 -0800138 BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
Anton Hanssond488d2d2019-02-26 15:49:25 +0000139
Dan Willemsen695849e2019-04-17 12:25:09 -0700140_build_broken_var_list += \
141 $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
142 $(DEFAULT_WARNING_BUILD_MODULE_TYPES) \
143 $(DEFAULT_ERROR_BUILD_MODULE_TYPES), \
144 BUILD_BROKEN_USES_$(m))
145
Anton Hanssond488d2d2019-02-26 15:49:25 +0000146_board_true_false_vars := $(_build_broken_var_list)
Dan Willemsen26076252020-01-02 20:08:10 -0800147_board_strip_readonly_list += $(_build_broken_var_list) \
148 BUILD_BROKEN_NINJA_USES_ENV_VARS
Anton Hanssond488d2d2019-02-26 15:49:25 +0000149
Anton Hansson74dc00b2019-02-27 14:38:27 +0000150# Conditional to building on linux, as dex2oat currently does not work on darwin.
151ifeq ($(HOST_OS),linux)
152 WITH_DEXPREOPT := true
153endif
154
Anton Hanssonb9544692019-02-26 13:37:28 +0000155# ###############################################################
156# Broken build defaults
157# ###############################################################
Dan Willemsen0586c652019-04-09 09:56:48 -0700158$(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
Dan Willemsen26076252020-01-02 20:08:10 -0800159BUILD_BROKEN_NINJA_USES_ENV_VARS :=
Anton Hanssonb9544692019-02-26 13:37:28 +0000160
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000161# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
162# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
163# make sure only one exists.
164# Real boards should always be associated with an OEM vendor.
165ifdef TARGET_DEVICE_DIR
166 ifneq ($(origin TARGET_DEVICE_DIR),command line)
167 $(error TARGET_DEVICE_DIR may not be set manually)
168 endif
169 board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk
170else
171 board_config_mk := \
172 $(strip $(sort $(wildcard \
173 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
174 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
175 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
176 )))
177 ifeq ($(board_config_mk),)
178 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
179 endif
180 ifneq ($(words $(board_config_mk)),1)
181 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
182 endif
183 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
184 .KATI_READONLY := TARGET_DEVICE_DIR
185endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000186
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000187include $(board_config_mk)
Anton Hansson41f9cc22020-11-27 11:00:38 +0000188
189ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE)))
190 $(error $(board_config_mk) erroneously sets both TARGET_ARCH and TARGET_ARCH_SUITE)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000191endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000192ifeq ($(TARGET_ARCH)$(TARGET_ARCH_SUITE),)
193 $(error Target architectures not defined by board config: $(board_config_mk))
194endif
195ifeq ($(TARGET_CPU_ABI)$(TARGET_ARCH_SUITE),)
196 $(error TARGET_CPU_ABI not defined by board config: $(board_config_mk))
197endif
198
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000199ifneq ($(MALLOC_IMPL),)
200 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).)
201 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
202endif
203board_config_mk :=
204
Anton Hanssond488d2d2019-02-26 15:49:25 +0000205# Clean up and verify BoardConfig variables
206$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var)))))
207$(foreach var,$(_board_true_false_vars), \
208 $(if $(filter-out true false,$($(var))), \
209 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))")))
Anton Hanssonb9544692019-02-26 13:37:28 +0000210
211# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified.
212TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT))
213TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT))
214
Anton Hansson41f9cc22020-11-27 11:00:38 +0000215ifdef TARGET_ARCH
216 # The combo makefiles check and set defaults for various CPU configuration
217 combo_target := TARGET_
218 combo_2nd_arch_prefix :=
219 include $(BUILD_SYSTEM)/combo/select.mk
220endif
Anton Hansson19279852019-02-28 17:15:57 +0000221
222ifdef TARGET_2ND_ARCH
223 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
224 include $(BUILD_SYSTEM)/combo/select.mk
225endif
226
Anton Hanssond488d2d2019-02-26 15:49:25 +0000227.KATI_READONLY := $(_board_strip_readonly_list)
228
229INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE)
Devin Moored6eab6f2021-03-10 16:28:49 -0800230ifneq (,$(BOARD_BOOTCONFIG))
231 INTERNAL_KERNEL_CMDLINE += bootconfig
232 INTERNAL_BOOTCONFIG := $(BOARD_BOOTCONFIG)
233endif
Anton Hansson41f9cc22020-11-27 11:00:38 +0000234
Anton Hanssonb9544692019-02-26 13:37:28 +0000235ifneq ($(filter %64,$(TARGET_ARCH)),)
236 TARGET_IS_64_BIT := true
237endif
238
239ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS)))
240 TARGET_SUPPORTS_32_BIT_APPS := true
241endif
242
Joel Galenson154ac1d2020-07-30 14:23:31 -0700243# Quick check to warn about likely cryptic errors later in the build.
Anton Hanssonb9544692019-02-26 13:37:28 +0000244ifeq ($(TARGET_IS_64_BIT),true)
245 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
Anton Hansson6d25fc62019-05-10 15:29:28 +0100246 $(error Building a 32-bit-app-only product on a 64-bit device. \
Anton Hanssonb9544692019-02-26 13:37:28 +0000247 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false)
248 endif
249endif
250
251# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
252# comma separated lists of the 32 and 64 bit ABIs (in order of
253# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT
254# are defined by the board config, we use them. Else, we construct
255# these lists based on whether TARGET_IS_64_BIT is set.
256#
257# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target
258# is always 32 bits. If this isn't the case, these variables should
259# be overriden in the board configuration.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200260#
261# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always
262# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs.
263_target_native_bridge_abi_list_32_bit :=
264_target_native_bridge_abi_list_64_bit :=
265
Anton Hanssonb9544692019-02-26 13:37:28 +0000266ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
267 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
268 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200269 _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000270 endif
271endif
272
Peter Collingbourne6aea25d2019-05-16 14:09:35 -0700273# "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported
274# in all builds with SANITIZE_TARGET=hwaddress.
275ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),)
276 ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),)
277 TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT)
278 endif
279endif
280
Anton Hanssonb9544692019-02-26 13:37:28 +0000281ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT))
282 ifneq (true,$(TARGET_IS_64_BIT))
283 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200284 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000285 else
286 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
287 # For a 64 bit target, assume that the 2ND_CPU_ABI
288 # is a 32 bit ABI.
289 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200290 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000291 endif
292 endif
293endif
294
295# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
296# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
297# is specified by the board configuration, we use that. If not, we
298# build a list out of the TARGET_CPU_ABIs specified by the config.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200299# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
Anton Hanssonb9544692019-02-26 13:37:28 +0000300ifeq (,$(TARGET_CPU_ABI_LIST))
Elliott Hughes9b824d52020-04-17 15:46:55 -0700301 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
302 $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
Anton Hanssonb9544692019-02-26 13:37:28 +0000303endif
304
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200305# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference.
306TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit)
307TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit)
308
Anton Hanssonb9544692019-02-26 13:37:28 +0000309# Strip whitespace from the ABI list string.
310TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST)))
311TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
312TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
313
Jeongik Chabb688a92019-07-12 12:51:37 +0900314# Check if config about image building is valid or not.
315define check_image_config
316 $(eval _uc_name := $(call to-upper,$(1))) \
317 $(eval _lc_name := $(call to-lower,$(1))) \
318 $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \
319 $(if $(BOARD_USES_$(_uc_name)IMAGE),, \
320 $(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)), \
321 $(if $(BOARD_USES_$(_uc_name)IMAGE), \
322 $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \
323 $(eval _uc_name :=) \
324 $(eval _lc_name :=)
325endef
326
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000327###########################################
328# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK
329ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
330TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT)
331endif
332
333###########################################
334# Configure whether we're building the system image
335BUILDING_SYSTEM_IMAGE := true
336ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),)
337 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE
338 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
339 BUILDING_SYSTEM_IMAGE :=
340 endif
341 endif
342else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false)
343 BUILDING_SYSTEM_IMAGE :=
344endif
345.KATI_READONLY := BUILDING_SYSTEM_IMAGE
346
347# Are we building a system_other image
348BUILDING_SYSTEM_OTHER_IMAGE :=
349ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),)
350 ifdef BUILDING_SYSTEM_IMAGE
351 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
352 BUILDING_SYSTEM_OTHER_IMAGE := true
353 endif
354 endif
355else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true)
356 BUILDING_SYSTEM_OTHER_IMAGE := true
357 ifndef BUILDING_SYSTEM_IMAGE
358 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image)
359 endif
360endif
361.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE
362
363# Are we building a cache image
364BUILDING_CACHE_IMAGE :=
365ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),)
366 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
367 BUILDING_CACHE_IMAGE := true
368 endif
369else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true)
370 BUILDING_CACHE_IMAGE := true
371 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
372 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined)
373 endif
374endif
375.KATI_READONLY := BUILDING_CACHE_IMAGE
376
Chris Grossa784ef12019-04-22 11:09:57 -0700377# Are we building a boot image
378BUILDING_BOOT_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700379ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),)
380 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
381 BUILDING_BOOT_IMAGE :=
382 else ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Chris Grossa784ef12019-04-22 11:09:57 -0700383 BUILDING_BOOT_IMAGE := true
Yifan Hongebe65f82020-10-15 14:48:07 -0700384 else ifneq (,$(foreach kernel,$(BOARD_KERNEL_BINARIES),$(BOARD_$(call to-upper,$(kernel))_BOOTIMAGE_PARTITION_SIZE)))
385 BUILDING_BOOT_IMAGE := true
Chris Grossa784ef12019-04-22 11:09:57 -0700386 endif
387else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true)
Daniel Norman42879ff2020-10-06 11:09:56 -0700388 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
389 $(warning *** PRODUCT_BUILD_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT.)
390 $(warning *** Skipping building boot image.)
391 BUILDING_BOOT_IMAGE :=
392 else
393 BUILDING_BOOT_IMAGE := true
394 endif
Chris Grossa784ef12019-04-22 11:09:57 -0700395endif
396.KATI_READONLY := BUILDING_BOOT_IMAGE
397
398# Are we building a recovery image
399BUILDING_RECOVERY_IMAGE :=
Daniel Norman42879ff2020-10-06 11:09:56 -0700400ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),)
401 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
402 BUILDING_RECOVERY_IMAGE := true
Yifan Hong881df392020-10-09 14:29:39 -0700403 else ifeq ($(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT),true)
404 # Set to true to build recovery resources for vendor_boot
405 BUILDING_RECOVERY_IMAGE := true
Daniel Norman42879ff2020-10-06 11:09:56 -0700406 else ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Chris Grossa784ef12019-04-22 11:09:57 -0700407 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
408 BUILDING_RECOVERY_IMAGE := true
409 endif
410 endif
411else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true)
412 BUILDING_RECOVERY_IMAGE := true
413endif
414.KATI_READONLY := BUILDING_RECOVERY_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000415
Steve Mucklee1b10862019-07-10 10:49:37 -0700416# Are we building a vendor boot image
417BUILDING_VENDOR_BOOT_IMAGE :=
418ifdef BOARD_BOOT_HEADER_VERSION
419 ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),)
Daniel Normanad6293c2020-10-16 15:10:21 -0700420 ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),)
Daniel Norman42879ff2020-10-06 11:09:56 -0700421 BUILDING_VENDOR_BOOT_IMAGE := true
422 else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),true)
Steve Muckle3363a0b2020-02-12 13:38:28 -0800423 BUILDING_VENDOR_BOOT_IMAGE := true
424 endif
Steve Mucklee1b10862019-07-10 10:49:37 -0700425 endif
426endif
427.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE
428
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000429# Are we building a ramdisk image
430BUILDING_RAMDISK_IMAGE := true
431ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
432 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true:
433 # BUILDING_BOOT_IMAGE
434 # BUILDING_RECOVERY_IMAGE
435else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
436 BUILDING_RAMDISK_IMAGE :=
437endif
438.KATI_READONLY := BUILDING_RAMDISK_IMAGE
439
440# Are we building a userdata image
441BUILDING_USERDATA_IMAGE :=
442ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)
443 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
444 BUILDING_USERDATA_IMAGE := true
445 endif
446else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
447 BUILDING_USERDATA_IMAGE := true
448endif
449.KATI_READONLY := BUILDING_USERDATA_IMAGE
450
Paul Trautrim4e143232019-08-13 16:30:57 +0900451# Are we building a vbmeta image
452BUILDING_VBMETA_IMAGE := true
453ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false)
454 BUILDING_VBMETA_IMAGE :=
455endif
456.KATI_READONLY := BUILDING_VBMETA_IMAGE
457
Yo Chiange86bab42021-03-25 10:12:28 +0000458# Are we building a super_empty image
459BUILDING_SUPER_EMPTY_IMAGE :=
460ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),)
461 ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
462 ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
463 BUILDING_SUPER_EMPTY_IMAGE := true
464 endif
465 endif
466else ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),true)
467 ifneq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
468 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but PRODUCT_USE_DYNAMIC_PARTITIONS is not true)
469 endif
470 ifeq ($(BOARD_SUPER_PARTITION_SIZE),)
471 $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but BOARD_SUPER_PARTITION_SIZE is not defined)
472 endif
473 BUILDING_SUPER_EMPTY_IMAGE := true
474endif
475.KATI_READONLY := BUILDING_SUPER_EMPTY_IMAGE
476
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000477###########################################
478# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
479ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
480 TARGET_COPY_OUT_VENDOR := system/vendor
481else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
482 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
483endif
484PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
485
486BOARD_USES_VENDORIMAGE :=
487ifdef BOARD_PREBUILT_VENDORIMAGE
488 BOARD_USES_VENDORIMAGE := true
489endif
490ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
491 BOARD_USES_VENDORIMAGE := true
492endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900493# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image.
494# But target's BOARD_PREBUILT_VENDORIMAGE is not filled.
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000495ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
496 BOARD_USES_VENDORIMAGE := true
497else ifdef BOARD_USES_VENDORIMAGE
498 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
499endif
500.KATI_READONLY := BOARD_USES_VENDORIMAGE
501
502BUILDING_VENDOR_IMAGE :=
503ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),)
504 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
505 BUILDING_VENDOR_IMAGE := true
506 endif
507else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true)
508 BUILDING_VENDOR_IMAGE := true
509 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
510 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined)
511 endif
512endif
513ifdef BOARD_PREBUILT_VENDORIMAGE
514 BUILDING_VENDOR_IMAGE :=
515endif
516.KATI_READONLY := BUILDING_VENDOR_IMAGE
517
518###########################################
519# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
520ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder))
521TARGET_COPY_OUT_PRODUCT := system/product
522else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),)
523$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.)
524endif
525PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES))
526
527BOARD_USES_PRODUCTIMAGE :=
528ifdef BOARD_PREBUILT_PRODUCTIMAGE
529 BOARD_USES_PRODUCTIMAGE := true
530endif
531ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
532 BOARD_USES_PRODUCTIMAGE := true
533endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900534$(call check_image_config,product)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000535.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
536
537BUILDING_PRODUCT_IMAGE :=
538ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),)
539 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
540 BUILDING_PRODUCT_IMAGE := true
541 endif
542else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true)
543 BUILDING_PRODUCT_IMAGE := true
544 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
545 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined)
546 endif
547endif
548ifdef BOARD_PREBUILT_PRODUCTIMAGE
549 BUILDING_PRODUCT_IMAGE :=
550endif
551.KATI_READONLY := BUILDING_PRODUCT_IMAGE
552
553###########################################
Justin Yun6151e3f2019-06-25 15:58:13 +0900554# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to
555# TARGET_COPY_OUT_PRODUCT as a workaround.
556TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000557
Justin Yun6151e3f2019-06-25 15:58:13 +0900558###########################################
559# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT
560ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder))
561TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
562else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),)
563$(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 +0000564endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900565PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000566
Justin Yun6151e3f2019-06-25 15:58:13 +0900567BOARD_USES_SYSTEM_EXTIMAGE :=
568ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
569 BOARD_USES_SYSTEM_EXTIMAGE := true
570endif
571ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
572 BOARD_USES_SYSTEM_EXTIMAGE := true
573endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900574$(call check_image_config,system_ext)
Justin Yun6151e3f2019-06-25 15:58:13 +0900575.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
576
577BUILDING_SYSTEM_EXT_IMAGE :=
578ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),)
579 ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
580 BUILDING_SYSTEM_EXT_IMAGE := true
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000581 endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900582else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true)
583 BUILDING_SYSTEM_EXT_IMAGE := true
584 ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
585 $(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 +0000586 endif
587endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900588ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
589 BUILDING_SYSTEM_EXT_IMAGE :=
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000590endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900591.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000592
593###########################################
Yifan Hongcfb917a2020-05-07 14:58:20 -0700594# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM
595ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder))
596 TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm
597else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),)
598 $(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)'.)
599endif
600PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES))
601
602BOARD_USES_VENDOR_DLKMIMAGE :=
603ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
604 BOARD_USES_VENDOR_DLKMIMAGE := true
605endif
606ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
607 BOARD_USES_VENDOR_DLKMIMAGE := true
608endif
609$(call check_image_config,vendor_dlkm)
610
611BUILDING_VENDOR_DLKM_IMAGE :=
612ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),)
613 ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
614 BUILDING_VENDOR_DLKM_IMAGE := true
615 endif
616else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true)
617 BUILDING_VENDOR_DLKM_IMAGE := true
618 ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
619 $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
620 endif
621endif
622ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
623 BUILDING_VENDOR_DLKM_IMAGE :=
624endif
625.KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE
626
627###########################################
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000628# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
629ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
dianlujitao339ef4c2019-10-10 09:26:00 +0800630 TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm
631else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
632 $(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 +0000633endif
634PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
635
636BOARD_USES_ODMIMAGE :=
637ifdef BOARD_PREBUILT_ODMIMAGE
638 BOARD_USES_ODMIMAGE := true
639endif
640ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
641 BOARD_USES_ODMIMAGE := true
642endif
Jeongik Chabb688a92019-07-12 12:51:37 +0900643$(call check_image_config,odm)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000644
645BUILDING_ODM_IMAGE :=
Dan Willemsen25a69372019-04-19 15:00:12 -0700646ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000647 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
648 BUILDING_ODM_IMAGE := true
649 endif
650else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true)
651 BUILDING_ODM_IMAGE := true
652 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
653 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined)
654 endif
655endif
656ifdef BOARD_PREBUILT_ODMIMAGE
657 BUILDING_ODM_IMAGE :=
658endif
659.KATI_READONLY := BUILDING_ODM_IMAGE
660
Yifan Hongf496f1b2020-07-15 16:52:59 -0700661
662###########################################
663# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM
664ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder))
665 TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm
666else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),)
667 $(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)'.)
668endif
669PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES))
670
671BOARD_USES_ODM_DLKMIMAGE :=
672ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
673 BOARD_USES_ODM_DLKMIMAGE := true
674endif
675ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
676 BOARD_USES_ODM_DLKMIMAGE := true
677endif
678$(call check_image_config,odm_dlkm)
679
680BUILDING_ODM_DLKM_IMAGE :=
681ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),)
682 ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
683 BUILDING_ODM_DLKM_IMAGE := true
684 endif
685else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true)
686 BUILDING_ODM_DLKM_IMAGE := true
687 ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
688 $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
689 endif
690endif
691ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
692 BUILDING_ODM_DLKM_IMAGE :=
693endif
694.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE
695
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000696###########################################
Yifan Hong65afc072020-04-17 10:08:10 -0700697# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000698TARGET_RECOVERY_UPDATER_LIBS ?=
699AB_OTA_UPDATER ?=
700.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
Yifan Hong65afc072020-04-17 10:08:10 -0700701
702# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true
703ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
704 ifneq ($(AB_OTA_UPDATER),true)
705 $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true)
706 endif
707endif
708
709# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB
710# to see if non-A/B is supported.
711TARGET_OTA_ALLOW_NON_AB := false
712ifneq ($(AB_OTA_UPDATER),true)
713 TARGET_OTA_ALLOW_NON_AB := true
714else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
715 TARGET_OTA_ALLOW_NON_AB := true
716endif
717.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB
718
719ifneq ($(TARGET_OTA_ALLOW_NON_AB),true)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000720 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
Yifan Hong65afc072020-04-17 10:08:10 -0700721 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000722 endif
723endif
724
Joel Galenson154ac1d2020-07-30 14:23:31 -0700725# Quick check for building generic OTA packages. Currently it only supports A/B OTAs.
Tao Bao9be20c72019-04-08 21:11:59 -0700726ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
727 ifneq ($(AB_OTA_UPDATER),true)
728 $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported)
729 endif
730endif
731
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700732ifdef BOARD_PREBUILT_DTBIMAGE_DIR
733 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
734 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported)
735 endif
736endif
737
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000738# Check BOARD_VNDK_VERSION
739define check_vndk_version
740 $(eval vndk_path := prebuilts/vndk/v$(1)) \
741 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
742endef
743
744ifdef BOARD_VNDK_VERSION
Inseob Kim2b0b3d12020-06-25 22:19:29 +0900745 ifeq ($(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
746 $(error BOARD_VNDK_VERSION is equal to PLATFORM_VNDK_VERSION; use BOARD_VNDK_VERSION := current))
747 endif
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000748 ifneq ($(BOARD_VNDK_VERSION),current)
Inseob Kimf0cec692019-12-03 15:09:44 +0900749 $(call check_vndk_version,$(BOARD_VNDK_VERSION))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000750 endif
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000751 TARGET_VENDOR_TEST_SUFFIX := /vendor
752else
753 TARGET_VENDOR_TEST_SUFFIX :=
754endif
755
JaeMan Parkaa7b03b2020-12-07 16:00:50 +0900756# If PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is set,
757# BOARD_VNDK_VERSION must be set because PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY
758# is a enforcement of inter-partition dependency, and it doesn't have any meaning
759# when BOARD_VNDK_VERSION isn't set.
760ifeq ($(PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY),true)
761 ifeq ($(BOARD_VNDK_VERSION),)
762 $(error BOARD_VNDK_VERSION must be set when PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is true)
763 endif
764endif
765
Jiyong Park02426e62019-05-08 20:23:42 +0900766###########################################
767# APEXes are by default flattened, i.e. non-updatable.
768# It can be unflattened (and updatable) by inheriting from
769# updatable_apex.mk
Roland Levillainb3a503d2019-10-04 14:06:26 +0100770#
771# APEX flattening can also be forcibly enabled (resp. disabled) by
772# setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by
773# setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable.
774ifdef OVERRIDE_TARGET_FLATTEN_APEX
775 TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX)
776else
777 ifeq (,$(TARGET_FLATTEN_APEX))
778 TARGET_FLATTEN_APEX := true
779 endif
Jiyong Park02426e62019-05-08 20:23:42 +0900780endif
781
Martin Stjernholm7a430fd2020-06-04 15:16:39 +0100782ifeq (,$(TARGET_BUILD_UNBUNDLED))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000783ifdef PRODUCT_EXTRA_VNDK_VERSIONS
784 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
785endif
786endif
787
788# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS
789_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS))
790ifneq (,$(_unsupported_systemsdk_versions))
791 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
792 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
793endif
Dan Willemsen695849e2019-04-17 12:25:09 -0700794
795###########################################
796# Handle BUILD_BROKEN_USES_BUILD_*
797
Dan Willemsen97ec8122020-02-19 18:06:54 -0800798$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
Dan Willemsen695849e2019-04-17 12:25:09 -0700799 $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
800 $(KATI_obsolete_var $(m),Please convert to Soong),\
801 $(KATI_deprecated_var $(m),Please convert to Soong)))
802
Dan Willemsen97ec8122020-02-19 18:06:54 -0800803$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
804 $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\
805 $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers))
Dan Willemsen66d21d42020-01-27 19:26:02 -0800806
Dan Willemsen97ec8122020-02-19 18:06:54 -0800807$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\
Dan Willemsen695849e2019-04-17 12:25:09 -0700808 $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
809 $(KATI_deprecated_var $(m),Please convert to Soong),\
810 $(KATI_obsolete_var $(m),Please convert to Soong)))
Yifan Hong63c5ca12020-10-08 11:54:02 -0700811
812ifndef BUILDING_RECOVERY_IMAGE
813 ifeq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE))
814 $(error Should not set BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE if not building recovery image)
815 endif
816endif
Yifan Hong881df392020-10-09 14:29:39 -0700817
818ifndef BUILDING_VENDOR_BOOT_IMAGE
819 ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
820 $(error Should not set BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT if not building vendor_boot image)
821 endif
Yo Chiangd21e7dc2020-12-10 18:42:47 +0800822 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
823 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if not building vendor_boot image)
824 endif
Yi-Yo Chiang1519d432021-04-04 16:03:10 +0800825else # BUILDING_VENDOR_BOOT_IMAGE
826 ifneq (,$(call math_lt,$(BOARD_BOOT_HEADER_VERSION),4))
827 ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
828 $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if \
829 BOARD_BOOT_HEADER_VERSION is less than 4)
830 endif
Yi-Yo Chiang12f92442021-04-04 16:12:25 +0800831 ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
832 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
833 BOARD_BOOT_HEADER_VERSION is less than 4)
834 endif
Yi-Yo Chiang1519d432021-04-04 16:03:10 +0800835 endif
836endif # BUILDING_VENDOR_BOOT_IMAGE
Yo Chiangd21e7dc2020-12-10 18:42:47 +0800837
838ifneq ($(words $(BOARD_VENDOR_RAMDISK_FRAGMENTS)),$(words $(sort $(BOARD_VENDOR_RAMDISK_FRAGMENTS))))
839 $(error BOARD_VENDOR_RAMDISK_FRAGMENTS has duplicate entries: $(BOARD_VENDOR_RAMDISK_FRAGMENTS))
Yifan Hong881df392020-10-09 14:29:39 -0700840endif
841
Yi-Yo Chiang12f92442021-04-04 16:12:25 +0800842ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
843 ifneq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
844 $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
845 BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set)
846 endif
847endif
848
Yifan Hong881df392020-10-09 14:29:39 -0700849# If BOARD_USES_GENERIC_KERNEL_IMAGE is set, BOARD_USES_RECOVERY_AS_BOOT must not be set.
850# Devices without a dedicated recovery partition uses BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT to
851# build recovery into vendor_boot.
852ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE))
853 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
854 $(error BOARD_USES_RECOVERY_AS_BOOT cannot be true if BOARD_USES_GENERIC_KERNEL_IMAGE is true. \
855 Use BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT instead)
856 endif
857endif
Yifan Hongcc6c2022020-11-13 19:12:06 -0800858
859ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
860 ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
861 $(error BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT and BOARD_USES_RECOVERY_AS_BOOT cannot be \
862 both true. Recovery resources should be installed to either boot or vendor_boot, but not both)
863 endif
864endif