• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2019 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# ###############################################################
18# This file includes BoardConfig.mk for the device being built,
19# and checks the variable defined therein.
20# ###############################################################
21
22_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
28_board_strip_readonly_list += BOARD_BOOT_HEADER_VERSION
29_board_strip_readonly_list += BOARD_BOOTCONFIG
30_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
60# 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
64
65# File system variables
66_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
87
88# Logical partitions related variables.
89_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
98
99# Kernel related variables
100_board_strip_readonly_list += BOARD_KERNEL_BINARIES
101_board_strip_readonly_list += BOARD_KERNEL_MODULE_INTERFACE_VERSIONS
102
103# 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.
107# - BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE controls whether the recovery image
108#   contains a kernel or not.
109# - BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT controls whether ramdisk
110#   recovery resources are built to vendor_boot.
111# - BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT controls whether recovery
112#   resources are built as a standalone recovery ramdisk in vendor_boot.
113# - BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT controls whether GSI AVB keys are
114#   built to vendor_boot.
115# - BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES controls whether boot images in $OUT are added
116#   to target files package directly.
117_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
120_board_strip_readonly_list += BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT
121_board_strip_readonly_list += BOARD_MOVE_GSI_AVB_KEYS_TO_VENDOR_BOOT
122_board_strip_readonly_list += BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES
123
124# 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
127_build_broken_var_list := \
128  BUILD_BROKEN_DUP_RULES \
129  BUILD_BROKEN_DUP_SYSPROP \
130  BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
131  BUILD_BROKEN_ENFORCE_SYSPROP_OWNER \
132  BUILD_BROKEN_MISSING_REQUIRED_MODULES \
133  BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
134  BUILD_BROKEN_PREBUILT_ELF_FILES \
135  BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
136  BUILD_BROKEN_USES_NETWORK \
137  BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE \
138  BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
139
140_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
146_board_true_false_vars := $(_build_broken_var_list)
147_board_strip_readonly_list += $(_build_broken_var_list) \
148  BUILD_BROKEN_NINJA_USES_ENV_VARS
149
150# Conditional to building on linux, as dex2oat currently does not work on darwin.
151ifeq ($(HOST_OS),linux)
152  WITH_DEXPREOPT := true
153endif
154
155# ###############################################################
156# Broken build defaults
157# ###############################################################
158$(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
159BUILD_BROKEN_NINJA_USES_ENV_VARS :=
160
161# 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
186
187include $(board_config_mk)
188
189ifneq (,$(and $(TARGET_ARCH),$(TARGET_ARCH_SUITE)))
190  $(error $(board_config_mk) erroneously sets both TARGET_ARCH and TARGET_ARCH_SUITE)
191endif
192ifeq ($(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
199ifneq ($(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
205# 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))")))
210
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
215ifdef 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
221
222ifdef TARGET_2ND_ARCH
223  combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
224  include $(BUILD_SYSTEM)/combo/select.mk
225endif
226
227.KATI_READONLY := $(_board_strip_readonly_list)
228
229INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE)
230ifneq (,$(BOARD_BOOTCONFIG))
231  INTERNAL_KERNEL_CMDLINE += bootconfig
232  INTERNAL_BOOTCONFIG := $(BOARD_BOOTCONFIG)
233endif
234
235ifneq ($(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
243# Quick check to warn about likely cryptic errors later in the build.
244ifeq ($(TARGET_IS_64_BIT),true)
245  ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
246    $(error Building a 32-bit-app-only product on a 64-bit device. \
247      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.
260#
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
266ifeq (,$(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)
269    _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI)
270  endif
271endif
272
273# "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
281ifeq (,$(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)
284    _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI)
285  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)
290      _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI)
291    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.
299# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
300ifeq (,$(TARGET_CPU_ABI_LIST))
301  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)
303endif
304
305# 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
309# 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
314# 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
327###########################################
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
377# Are we building a boot image
378BUILDING_BOOT_IMAGE :=
379ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),)
380  ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
381    BUILDING_BOOT_IMAGE :=
382  else ifdef BOARD_PREBUILT_BOOTIMAGE
383    BUILDING_BOOT_IMAGE :=
384  else ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
385    BUILDING_BOOT_IMAGE := true
386  else ifneq (,$(foreach kernel,$(BOARD_KERNEL_BINARIES),$(BOARD_$(call to-upper,$(kernel))_BOOTIMAGE_PARTITION_SIZE)))
387    BUILDING_BOOT_IMAGE := true
388  endif
389else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true)
390  ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
391    $(warning *** PRODUCT_BUILD_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT.)
392    $(warning *** Skipping building boot image.)
393    BUILDING_BOOT_IMAGE :=
394  else
395    BUILDING_BOOT_IMAGE := true
396  endif
397endif
398.KATI_READONLY := BUILDING_BOOT_IMAGE
399
400# Are we building a recovery image
401BUILDING_RECOVERY_IMAGE :=
402ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),)
403  ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
404    BUILDING_RECOVERY_IMAGE := true
405  else ifeq ($(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT),true)
406    # Set to true to build recovery resources for vendor_boot
407    BUILDING_RECOVERY_IMAGE := true
408  else ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
409    ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
410      BUILDING_RECOVERY_IMAGE := true
411    endif
412  endif
413else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true)
414  BUILDING_RECOVERY_IMAGE := true
415endif
416.KATI_READONLY := BUILDING_RECOVERY_IMAGE
417
418# Are we building a vendor boot image
419BUILDING_VENDOR_BOOT_IMAGE :=
420ifdef BOARD_BOOT_HEADER_VERSION
421  ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),)
422    ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),)
423      BUILDING_VENDOR_BOOT_IMAGE := true
424    else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),true)
425      BUILDING_VENDOR_BOOT_IMAGE := true
426    endif
427  endif
428endif
429.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE
430
431# Are we building a ramdisk image
432BUILDING_RAMDISK_IMAGE := true
433ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
434  # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true:
435  #  BUILDING_BOOT_IMAGE
436  #  BUILDING_RECOVERY_IMAGE
437else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
438  BUILDING_RAMDISK_IMAGE :=
439endif
440.KATI_READONLY := BUILDING_RAMDISK_IMAGE
441
442# Are we building a userdata image
443BUILDING_USERDATA_IMAGE :=
444ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)
445  ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
446    BUILDING_USERDATA_IMAGE := true
447  endif
448else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
449  BUILDING_USERDATA_IMAGE := true
450endif
451.KATI_READONLY := BUILDING_USERDATA_IMAGE
452
453# Are we building a vbmeta image
454BUILDING_VBMETA_IMAGE := true
455ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false)
456  BUILDING_VBMETA_IMAGE :=
457endif
458.KATI_READONLY := BUILDING_VBMETA_IMAGE
459
460# Are we building a super_empty image
461BUILDING_SUPER_EMPTY_IMAGE :=
462ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),)
463  ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
464    ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
465      BUILDING_SUPER_EMPTY_IMAGE := true
466    endif
467  endif
468else ifeq ($(PRODUCT_BUILD_SUPER_EMPTY_IMAGE),true)
469  ifneq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
470    $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but PRODUCT_USE_DYNAMIC_PARTITIONS is not true)
471  endif
472  ifeq ($(BOARD_SUPER_PARTITION_SIZE),)
473    $(error PRODUCT_BUILD_SUPER_EMPTY_IMAGE set to true, but BOARD_SUPER_PARTITION_SIZE is not defined)
474  endif
475  BUILDING_SUPER_EMPTY_IMAGE := true
476endif
477.KATI_READONLY := BUILDING_SUPER_EMPTY_IMAGE
478
479###########################################
480# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
481ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
482  TARGET_COPY_OUT_VENDOR := system/vendor
483else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
484  $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
485endif
486PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
487
488BOARD_USES_VENDORIMAGE :=
489ifdef BOARD_PREBUILT_VENDORIMAGE
490  BOARD_USES_VENDORIMAGE := true
491endif
492ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
493  BOARD_USES_VENDORIMAGE := true
494endif
495# TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image.
496# But target's BOARD_PREBUILT_VENDORIMAGE is not filled.
497ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
498  BOARD_USES_VENDORIMAGE := true
499else ifdef BOARD_USES_VENDORIMAGE
500  $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
501endif
502.KATI_READONLY := BOARD_USES_VENDORIMAGE
503
504BUILDING_VENDOR_IMAGE :=
505ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),)
506  ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
507    BUILDING_VENDOR_IMAGE := true
508  endif
509else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true)
510  BUILDING_VENDOR_IMAGE := true
511  ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
512    $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined)
513  endif
514endif
515ifdef BOARD_PREBUILT_VENDORIMAGE
516  BUILDING_VENDOR_IMAGE :=
517endif
518.KATI_READONLY := BUILDING_VENDOR_IMAGE
519
520###########################################
521# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
522ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder))
523TARGET_COPY_OUT_PRODUCT := system/product
524else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),)
525$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.)
526endif
527PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES))
528
529BOARD_USES_PRODUCTIMAGE :=
530ifdef BOARD_PREBUILT_PRODUCTIMAGE
531  BOARD_USES_PRODUCTIMAGE := true
532endif
533ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
534  BOARD_USES_PRODUCTIMAGE := true
535endif
536$(call check_image_config,product)
537.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
538
539BUILDING_PRODUCT_IMAGE :=
540ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),)
541  ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
542    BUILDING_PRODUCT_IMAGE := true
543  endif
544else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true)
545  BUILDING_PRODUCT_IMAGE := true
546  ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
547    $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined)
548  endif
549endif
550ifdef BOARD_PREBUILT_PRODUCTIMAGE
551  BUILDING_PRODUCT_IMAGE :=
552endif
553.KATI_READONLY := BUILDING_PRODUCT_IMAGE
554
555###########################################
556# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to
557# TARGET_COPY_OUT_PRODUCT as a workaround.
558TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
559
560###########################################
561# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT
562ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder))
563TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
564else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),)
565$(error TARGET_COPY_OUT_SYSTEM_EXT must be either 'system_ext' or 'system/system_ext', seeing '$(TARGET_COPY_OUT_SYSTEM_EXT)'.)
566endif
567PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES))
568
569BOARD_USES_SYSTEM_EXTIMAGE :=
570ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
571  BOARD_USES_SYSTEM_EXTIMAGE := true
572endif
573ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
574  BOARD_USES_SYSTEM_EXTIMAGE := true
575endif
576$(call check_image_config,system_ext)
577.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
578
579BUILDING_SYSTEM_EXT_IMAGE :=
580ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),)
581  ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
582    BUILDING_SYSTEM_EXT_IMAGE := true
583  endif
584else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true)
585  BUILDING_SYSTEM_EXT_IMAGE := true
586  ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
587    $(error PRODUCT_BUILD_SYSTEM_EXT_IMAGE set to true, but BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE not defined)
588  endif
589endif
590ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
591  BUILDING_SYSTEM_EXT_IMAGE :=
592endif
593.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE
594
595###########################################
596# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM
597ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder))
598  TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm
599else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),)
600  $(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)'.)
601endif
602PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES))
603
604BOARD_USES_VENDOR_DLKMIMAGE :=
605ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
606  BOARD_USES_VENDOR_DLKMIMAGE := true
607endif
608ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
609  BOARD_USES_VENDOR_DLKMIMAGE := true
610endif
611$(call check_image_config,vendor_dlkm)
612
613BUILDING_VENDOR_DLKM_IMAGE :=
614ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),)
615  ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
616    BUILDING_VENDOR_DLKM_IMAGE := true
617  endif
618else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true)
619  BUILDING_VENDOR_DLKM_IMAGE := true
620  ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE
621    $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
622  endif
623endif
624ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
625  BUILDING_VENDOR_DLKM_IMAGE :=
626endif
627.KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE
628
629###########################################
630# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
631ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
632  TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm
633else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
634  $(error TARGET_COPY_OUT_ODM must be either 'odm', 'system/vendor/odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.)
635endif
636PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
637
638BOARD_USES_ODMIMAGE :=
639ifdef BOARD_PREBUILT_ODMIMAGE
640  BOARD_USES_ODMIMAGE := true
641endif
642ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
643  BOARD_USES_ODMIMAGE := true
644endif
645$(call check_image_config,odm)
646
647BUILDING_ODM_IMAGE :=
648ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
649  ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
650    BUILDING_ODM_IMAGE := true
651  endif
652else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true)
653  BUILDING_ODM_IMAGE := true
654  ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
655    $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined)
656  endif
657endif
658ifdef BOARD_PREBUILT_ODMIMAGE
659  BUILDING_ODM_IMAGE :=
660endif
661.KATI_READONLY := BUILDING_ODM_IMAGE
662
663
664###########################################
665# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM
666ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder))
667  TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm
668else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),)
669  $(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)'.)
670endif
671PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES))
672
673BOARD_USES_ODM_DLKMIMAGE :=
674ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
675  BOARD_USES_ODM_DLKMIMAGE := true
676endif
677ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
678  BOARD_USES_ODM_DLKMIMAGE := true
679endif
680$(call check_image_config,odm_dlkm)
681
682BUILDING_ODM_DLKM_IMAGE :=
683ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),)
684  ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
685    BUILDING_ODM_DLKM_IMAGE := true
686  endif
687else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true)
688  BUILDING_ODM_DLKM_IMAGE := true
689  ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE
690    $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined)
691  endif
692endif
693ifdef BOARD_PREBUILT_ODM_DLKMIMAGE
694  BUILDING_ODM_DLKM_IMAGE :=
695endif
696.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE
697
698###########################################
699# Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE.
700TARGET_RECOVERY_UPDATER_LIBS ?=
701AB_OTA_UPDATER ?=
702.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
703
704# Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true
705ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
706  ifneq ($(AB_OTA_UPDATER),true)
707    $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true)
708  endif
709endif
710
711# In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB
712# to see if non-A/B is supported.
713TARGET_OTA_ALLOW_NON_AB := false
714ifneq ($(AB_OTA_UPDATER),true)
715  TARGET_OTA_ALLOW_NON_AB := true
716else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true)
717  TARGET_OTA_ALLOW_NON_AB := true
718endif
719.KATI_READONLY := TARGET_OTA_ALLOW_NON_AB
720
721ifneq ($(TARGET_OTA_ALLOW_NON_AB),true)
722  ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
723    $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB)
724  endif
725endif
726
727# Quick check for building generic OTA packages. Currently it only supports A/B OTAs.
728ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
729  ifneq ($(AB_OTA_UPDATER),true)
730    $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported)
731  endif
732endif
733
734ifdef BOARD_PREBUILT_DTBIMAGE_DIR
735  ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
736    $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported)
737  endif
738endif
739
740# Check BOARD_VNDK_VERSION
741define check_vndk_version
742  $(eval vndk_path := prebuilts/vndk/v$(1)) \
743  $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
744endef
745
746ifdef BOARD_VNDK_VERSION
747  ifeq ($(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
748    $(error BOARD_VNDK_VERSION is equal to PLATFORM_VNDK_VERSION; use BOARD_VNDK_VERSION := current))
749  endif
750  ifneq ($(BOARD_VNDK_VERSION),current)
751    $(call check_vndk_version,$(BOARD_VNDK_VERSION))
752  endif
753  TARGET_VENDOR_TEST_SUFFIX := /vendor
754else
755  TARGET_VENDOR_TEST_SUFFIX :=
756endif
757
758# If PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is set,
759# BOARD_VNDK_VERSION must be set because PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY
760# is a enforcement of inter-partition dependency, and it doesn't have any meaning
761# when BOARD_VNDK_VERSION isn't set.
762ifeq ($(PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY),true)
763  ifeq ($(BOARD_VNDK_VERSION),)
764    $(error BOARD_VNDK_VERSION must be set when PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is true)
765  endif
766endif
767
768###########################################
769# APEXes are by default flattened, i.e. non-updatable.
770# It can be unflattened (and updatable) by inheriting from
771# updatable_apex.mk
772#
773# APEX flattening can also be forcibly enabled (resp. disabled) by
774# setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by
775# setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable.
776ifdef OVERRIDE_TARGET_FLATTEN_APEX
777  TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX)
778else
779  ifeq (,$(TARGET_FLATTEN_APEX))
780    TARGET_FLATTEN_APEX := true
781  endif
782endif
783
784ifeq (,$(TARGET_BUILD_UNBUNDLED))
785ifdef PRODUCT_EXTRA_VNDK_VERSIONS
786  $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
787endif
788endif
789
790# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS
791_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS))
792ifneq (,$(_unsupported_systemsdk_versions))
793  $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
794          Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
795endif
796
797###########################################
798# Handle BUILD_BROKEN_USES_BUILD_*
799
800$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
801  $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
802    $(KATI_obsolete_var $(m),Please convert to Soong),\
803    $(KATI_deprecated_var $(m),Please convert to Soong)))
804
805$(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\
806  $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\
807  $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers))
808
809$(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\
810  $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
811    $(KATI_deprecated_var $(m),Please convert to Soong),\
812    $(KATI_obsolete_var $(m),Please convert to Soong)))
813
814ifndef BUILDING_RECOVERY_IMAGE
815  ifeq (true,$(BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE))
816    $(error Should not set BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE if not building recovery image)
817  endif
818endif
819
820ifndef BUILDING_VENDOR_BOOT_IMAGE
821  ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
822    $(error Should not set BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT if not building vendor_boot image)
823  endif
824  ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
825    $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if not building vendor_boot image)
826  endif
827else # BUILDING_VENDOR_BOOT_IMAGE
828  ifneq (,$(call math_lt,$(BOARD_BOOT_HEADER_VERSION),4))
829    ifdef BOARD_VENDOR_RAMDISK_FRAGMENTS
830      $(error Should not set BOARD_VENDOR_RAMDISK_FRAGMENTS if \
831        BOARD_BOOT_HEADER_VERSION is less than 4)
832    endif
833    ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
834      $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
835        BOARD_BOOT_HEADER_VERSION is less than 4)
836    endif
837  endif
838endif # BUILDING_VENDOR_BOOT_IMAGE
839
840ifneq ($(words $(BOARD_VENDOR_RAMDISK_FRAGMENTS)),$(words $(sort $(BOARD_VENDOR_RAMDISK_FRAGMENTS))))
841  $(error BOARD_VENDOR_RAMDISK_FRAGMENTS has duplicate entries: $(BOARD_VENDOR_RAMDISK_FRAGMENTS))
842endif
843
844ifeq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT))
845  ifneq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
846    $(error Should not set BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT if \
847      BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set)
848  endif
849endif
850
851# If BOARD_USES_GENERIC_KERNEL_IMAGE is set, BOARD_USES_RECOVERY_AS_BOOT must not be set.
852# Devices without a dedicated recovery partition uses BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT to
853# build recovery into vendor_boot.
854ifeq (true,$(BOARD_USES_GENERIC_KERNEL_IMAGE))
855  ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
856    $(error BOARD_USES_RECOVERY_AS_BOOT cannot be true if BOARD_USES_GENERIC_KERNEL_IMAGE is true. \
857      Use BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT instead)
858  endif
859endif
860
861ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT))
862  ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT))
863    $(error BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT and BOARD_USES_RECOVERY_AS_BOOT cannot be \
864      both true. Recovery resources should be installed to either boot or vendor_boot, but not both)
865  endif
866endif
867