blob: 4c128f11884abf83e2aa4ead2ad7d82ebe7f2463 [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,
19# and sanity-checks the variable defined therein.
20# ###############################################################
21
Anton Hanssond488d2d2019-02-26 15:49:25 +000022_board_strip_readonly_list := \
23 BOARD_EGL_CFG \
24 BOARD_HAVE_BLUETOOTH \
25 BOARD_INSTALLER_CMDLINE \
26 BOARD_KERNEL_CMDLINE \
27 BOARD_KERNEL_BASE \
28 BOARD_USES_GENERIC_AUDIO \
29 BOARD_VENDOR_USE_AKMD \
30 BOARD_WPA_SUPPLICANT_DRIVER \
31 BOARD_WLAN_DEVICE \
32 TARGET_ARCH \
33 TARGET_ARCH_VARIANT \
34 TARGET_CPU_ABI \
35 TARGET_CPU_ABI2 \
36 TARGET_CPU_VARIANT \
37 TARGET_CPU_VARIANT_RUNTIME \
38 TARGET_2ND_ARCH \
39 TARGET_2ND_ARCH_VARIANT \
40 TARGET_2ND_CPU_ABI \
41 TARGET_2ND_CPU_ABI2 \
42 TARGET_2ND_CPU_VARIANT \
43 TARGET_2ND_CPU_VARIANT_RUNTIME \
44 TARGET_BOARD_PLATFORM \
45 TARGET_BOARD_PLATFORM_GPU \
46 TARGET_BOOTLOADER_BOARD_NAME \
Dan Willemsend32e6d12019-04-10 12:25:07 -070047 TARGET_FS_CONFIG_GEN \
Anton Hanssond488d2d2019-02-26 15:49:25 +000048 TARGET_NO_BOOTLOADER \
49 TARGET_NO_KERNEL \
50 TARGET_NO_RECOVERY \
51 TARGET_NO_RADIOIMAGE \
52 TARGET_HARDWARE_3D \
53 WITH_DEXPREOPT \
54
55# File system variables
56_board_strip_readonly_list += \
57 BOARD_FLASH_BLOCK_SIZE \
58 BOARD_BOOTIMAGE_PARTITION_SIZE \
59 BOARD_RECOVERYIMAGE_PARTITION_SIZE \
60 BOARD_SYSTEMIMAGE_PARTITION_SIZE \
61 BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE \
62 BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \
63 BOARD_USERDATAIMAGE_PARTITION_SIZE \
64 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \
65 BOARD_CACHEIMAGE_PARTITION_SIZE \
66 BOARD_VENDORIMAGE_PARTITION_SIZE \
67 BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \
68 BOARD_PRODUCTIMAGE_PARTITION_SIZE \
69 BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \
Justin Yun6151e3f2019-06-25 15:58:13 +090070 BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE \
71 BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE \
Anton Hanssond488d2d2019-02-26 15:49:25 +000072 BOARD_ODMIMAGE_PARTITION_SIZE \
73 BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \
74
75# Logical partitions related variables.
76_dynamic_partitions_var_list += \
77 BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \
78 BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
79 BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \
80 BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \
Justin Yun6151e3f2019-06-25 15:58:13 +090081 BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \
Anton Hanssond488d2d2019-02-26 15:49:25 +000082 BOARD_SUPER_PARTITION_SIZE \
83 BOARD_SUPER_PARTITION_GROUPS \
84
85_board_strip_readonly_list += $(_dynamic_partitions_var_list)
86
87_build_broken_var_list := \
Anton Hanssond488d2d2019-02-26 15:49:25 +000088 BUILD_BROKEN_DUP_RULES \
Logan Chien2a880752019-09-17 09:45:09 -070089 BUILD_BROKEN_PREBUILT_ELF_FILES \
Inseob Kim5d60c8a2019-10-17 10:32:59 +000090 BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
Dan Willemsen0586c652019-04-09 09:56:48 -070091 BUILD_BROKEN_USES_NETWORK \
Anton Hanssond488d2d2019-02-26 15:49:25 +000092
Dan Willemsen695849e2019-04-17 12:25:09 -070093_build_broken_var_list += \
94 $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
95 $(DEFAULT_WARNING_BUILD_MODULE_TYPES) \
96 $(DEFAULT_ERROR_BUILD_MODULE_TYPES), \
97 BUILD_BROKEN_USES_$(m))
98
Anton Hanssond488d2d2019-02-26 15:49:25 +000099_board_true_false_vars := $(_build_broken_var_list)
100_board_strip_readonly_list += $(_build_broken_var_list)
101
Anton Hansson74dc00b2019-02-27 14:38:27 +0000102# Conditional to building on linux, as dex2oat currently does not work on darwin.
103ifeq ($(HOST_OS),linux)
104 WITH_DEXPREOPT := true
105endif
106
Anton Hanssonb9544692019-02-26 13:37:28 +0000107# ###############################################################
108# Broken build defaults
109# ###############################################################
Dan Willemsen0586c652019-04-09 09:56:48 -0700110$(foreach v,$(_build_broken_var_list),$(eval $(v) :=))
Anton Hanssonb9544692019-02-26 13:37:28 +0000111
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000112# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
113# or under vendor/*/$(TARGET_DEVICE). Search in both places, but
114# make sure only one exists.
115# Real boards should always be associated with an OEM vendor.
116ifdef TARGET_DEVICE_DIR
117 ifneq ($(origin TARGET_DEVICE_DIR),command line)
118 $(error TARGET_DEVICE_DIR may not be set manually)
119 endif
120 board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk
121else
122 board_config_mk := \
123 $(strip $(sort $(wildcard \
124 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
125 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
126 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
127 )))
128 ifeq ($(board_config_mk),)
129 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
130 endif
131 ifneq ($(words $(board_config_mk)),1)
132 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
133 endif
134 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
135 .KATI_READONLY := TARGET_DEVICE_DIR
136endif
137include $(board_config_mk)
138ifeq ($(TARGET_ARCH),)
139 $(error TARGET_ARCH not defined by board config: $(board_config_mk))
140endif
141ifneq ($(MALLOC_IMPL),)
142 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).)
143 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory)
144endif
145board_config_mk :=
146
Anton Hanssond488d2d2019-02-26 15:49:25 +0000147# Clean up and verify BoardConfig variables
148$(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var)))))
149$(foreach var,$(_board_true_false_vars), \
150 $(if $(filter-out true false,$($(var))), \
151 $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))")))
Anton Hanssonb9544692019-02-26 13:37:28 +0000152
153# Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified.
154TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT))
155TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT))
156
Anton Hansson19279852019-02-28 17:15:57 +0000157# The combo makefiles sanity-check and set defaults for various CPU configuration
158combo_target := TARGET_
159combo_2nd_arch_prefix :=
160include $(BUILD_SYSTEM)/combo/select.mk
161
162ifdef TARGET_2ND_ARCH
163 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
164 include $(BUILD_SYSTEM)/combo/select.mk
165endif
166
Anton Hanssond488d2d2019-02-26 15:49:25 +0000167.KATI_READONLY := $(_board_strip_readonly_list)
168
169INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE)
Anton Hanssonb9544692019-02-26 13:37:28 +0000170ifeq ($(TARGET_CPU_ABI),)
171 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
172endif
173ifneq ($(filter %64,$(TARGET_ARCH)),)
174 TARGET_IS_64_BIT := true
175endif
176
177ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS)))
178 TARGET_SUPPORTS_32_BIT_APPS := true
179endif
180
181# Sanity check to warn about likely cryptic errors later in the build.
182ifeq ($(TARGET_IS_64_BIT),true)
183 ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS)))
Anton Hansson6d25fc62019-05-10 15:29:28 +0100184 $(error Building a 32-bit-app-only product on a 64-bit device. \
Anton Hanssonb9544692019-02-26 13:37:28 +0000185 If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false)
186 endif
187endif
188
189# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
190# comma separated lists of the 32 and 64 bit ABIs (in order of
191# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT
192# are defined by the board config, we use them. Else, we construct
193# these lists based on whether TARGET_IS_64_BIT is set.
194#
195# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target
196# is always 32 bits. If this isn't the case, these variables should
197# be overriden in the board configuration.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200198#
199# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always
200# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs.
201_target_native_bridge_abi_list_32_bit :=
202_target_native_bridge_abi_list_64_bit :=
203
Anton Hanssonb9544692019-02-26 13:37:28 +0000204ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
205 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
206 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200207 _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000208 endif
209endif
210
Peter Collingbourne6aea25d2019-05-16 14:09:35 -0700211# "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported
212# in all builds with SANITIZE_TARGET=hwaddress.
213ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),)
214 ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),)
215 TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT)
216 endif
217endif
218
Anton Hanssonb9544692019-02-26 13:37:28 +0000219ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT))
220 ifneq (true,$(TARGET_IS_64_BIT))
221 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200222 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000223 else
224 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
225 # For a 64 bit target, assume that the 2ND_CPU_ABI
226 # is a 32 bit ABI.
227 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200228 _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI)
Anton Hanssonb9544692019-02-26 13:37:28 +0000229 endif
230 endif
231endif
232
233# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
234# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
235# is specified by the board configuration, we use that. If not, we
236# build a list out of the TARGET_CPU_ABIs specified by the config.
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200237# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
Anton Hanssonb9544692019-02-26 13:37:28 +0000238ifeq (,$(TARGET_CPU_ABI_LIST))
239 ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true)
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200240 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) \
241 $(_target_native_bridge_abi_list_32_bit) $(_target_native_bridge_abi_list_64_bit)
Anton Hanssonb9544692019-02-26 13:37:28 +0000242 else
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200243 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
244 $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
Anton Hanssonb9544692019-02-26 13:37:28 +0000245 endif
246endif
247
Evgeny Eltsin28fbe7f2019-07-29 16:23:19 +0200248# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference.
249TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit)
250TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit)
251
Anton Hanssonb9544692019-02-26 13:37:28 +0000252# Strip whitespace from the ABI list string.
253TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST)))
254TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
255TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
256
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000257###########################################
258# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK
259ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
260TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT)
261endif
262
263###########################################
Bowgo Tsai0013f552019-03-20 17:59:52 +0800264# Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK
265ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
266TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk
Bowgo Tsai5c40c712019-10-08 10:22:19 +0800267TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk/first_stage_ramdisk
Bowgo Tsai0013f552019-03-20 17:59:52 +0800268endif
269
270###########################################
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000271# Configure whether we're building the system image
272BUILDING_SYSTEM_IMAGE := true
273ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),)
274 ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE
275 ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
276 BUILDING_SYSTEM_IMAGE :=
277 endif
278 endif
279else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false)
280 BUILDING_SYSTEM_IMAGE :=
281endif
282.KATI_READONLY := BUILDING_SYSTEM_IMAGE
283
284# Are we building a system_other image
285BUILDING_SYSTEM_OTHER_IMAGE :=
286ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),)
287 ifdef BUILDING_SYSTEM_IMAGE
288 ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
289 BUILDING_SYSTEM_OTHER_IMAGE := true
290 endif
291 endif
292else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true)
293 BUILDING_SYSTEM_OTHER_IMAGE := true
294 ifndef BUILDING_SYSTEM_IMAGE
295 $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image)
296 endif
297endif
298.KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE
299
300# Are we building a cache image
301BUILDING_CACHE_IMAGE :=
302ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),)
303 ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
304 BUILDING_CACHE_IMAGE := true
305 endif
306else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true)
307 BUILDING_CACHE_IMAGE := true
308 ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
309 $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined)
310 endif
311endif
312.KATI_READONLY := BUILDING_CACHE_IMAGE
313
Chris Grossa784ef12019-04-22 11:09:57 -0700314# Are we building a boot image
315BUILDING_BOOT_IMAGE :=
316ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
317 BUILDING_BOOT_IMAGE :=
318else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),)
319 ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
320 BUILDING_BOOT_IMAGE := true
321 endif
322else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true)
323 BUILDING_BOOT_IMAGE := true
324endif
325.KATI_READONLY := BUILDING_BOOT_IMAGE
326
327# Are we building a recovery image
328BUILDING_RECOVERY_IMAGE :=
329ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
330 BUILDING_RECOVERY_IMAGE := true
331else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),)
332 ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
333 ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
334 BUILDING_RECOVERY_IMAGE := true
335 endif
336 endif
337else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true)
338 BUILDING_RECOVERY_IMAGE := true
339endif
340.KATI_READONLY := BUILDING_RECOVERY_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000341
Steve Mucklee1b10862019-07-10 10:49:37 -0700342# Are we building a vendor boot image
343BUILDING_VENDOR_BOOT_IMAGE :=
344ifdef BOARD_BOOT_HEADER_VERSION
345 ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),)
346 BUILDING_VENDOR_BOOT_IMAGE := true
347 ifdef BUILDING_RECOVERY_IMAGE
348 ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
349 $(error Boot header version >=3 requires recovery as boot)
350 endif
351 endif
352 endif
353endif
354.KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE
355
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000356# Are we building a ramdisk image
357BUILDING_RAMDISK_IMAGE := true
358ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),)
359 # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true:
360 # BUILDING_BOOT_IMAGE
361 # BUILDING_RECOVERY_IMAGE
362else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
363 BUILDING_RAMDISK_IMAGE :=
364endif
365.KATI_READONLY := BUILDING_RAMDISK_IMAGE
366
367# Are we building a userdata image
368BUILDING_USERDATA_IMAGE :=
369ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)
370 ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE
371 BUILDING_USERDATA_IMAGE := true
372 endif
373else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
374 BUILDING_USERDATA_IMAGE := true
375endif
376.KATI_READONLY := BUILDING_USERDATA_IMAGE
377
Paul Trautrim4e143232019-08-13 16:30:57 +0900378# Are we building a vbmeta image
379BUILDING_VBMETA_IMAGE := true
380ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false)
381 BUILDING_VBMETA_IMAGE :=
382endif
383.KATI_READONLY := BUILDING_VBMETA_IMAGE
384
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000385###########################################
386# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
387ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
388 TARGET_COPY_OUT_VENDOR := system/vendor
389else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
390 $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
391endif
392PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
393
394BOARD_USES_VENDORIMAGE :=
395ifdef BOARD_PREBUILT_VENDORIMAGE
396 BOARD_USES_VENDORIMAGE := true
397endif
398ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
399 BOARD_USES_VENDORIMAGE := true
400endif
401ifeq ($(TARGET_COPY_OUT_VENDOR),vendor)
402 BOARD_USES_VENDORIMAGE := true
403else ifdef BOARD_USES_VENDORIMAGE
404 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
405endif
406.KATI_READONLY := BOARD_USES_VENDORIMAGE
407
408BUILDING_VENDOR_IMAGE :=
409ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),)
410 ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
411 BUILDING_VENDOR_IMAGE := true
412 endif
413else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true)
414 BUILDING_VENDOR_IMAGE := true
415 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
416 $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined)
417 endif
418endif
419ifdef BOARD_PREBUILT_VENDORIMAGE
420 BUILDING_VENDOR_IMAGE :=
421endif
422.KATI_READONLY := BUILDING_VENDOR_IMAGE
423
424###########################################
425# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT
426ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder))
427TARGET_COPY_OUT_PRODUCT := system/product
428else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),)
429$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.)
430endif
431PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES))
432
433BOARD_USES_PRODUCTIMAGE :=
434ifdef BOARD_PREBUILT_PRODUCTIMAGE
435 BOARD_USES_PRODUCTIMAGE := true
436endif
437ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
438 BOARD_USES_PRODUCTIMAGE := true
439endif
440ifeq ($(TARGET_COPY_OUT_PRODUCT),product)
441 BOARD_USES_PRODUCTIMAGE := true
442else ifdef BOARD_USES_PRODUCTIMAGE
443 $(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image)
444endif
445.KATI_READONLY := BOARD_USES_PRODUCTIMAGE
446
447BUILDING_PRODUCT_IMAGE :=
448ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),)
449 ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
450 BUILDING_PRODUCT_IMAGE := true
451 endif
452else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true)
453 BUILDING_PRODUCT_IMAGE := true
454 ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
455 $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined)
456 endif
457endif
458ifdef BOARD_PREBUILT_PRODUCTIMAGE
459 BUILDING_PRODUCT_IMAGE :=
460endif
461.KATI_READONLY := BUILDING_PRODUCT_IMAGE
462
463###########################################
Justin Yun6151e3f2019-06-25 15:58:13 +0900464# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to
465# TARGET_COPY_OUT_PRODUCT as a workaround.
466TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000467
Justin Yun6151e3f2019-06-25 15:58:13 +0900468###########################################
469# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT
470ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder))
471TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
472else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),)
473$(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 +0000474endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900475PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES))
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000476
Justin Yun6151e3f2019-06-25 15:58:13 +0900477BOARD_USES_SYSTEM_EXTIMAGE :=
478ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
479 BOARD_USES_SYSTEM_EXTIMAGE := true
480endif
481ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
482 BOARD_USES_SYSTEM_EXTIMAGE := true
483endif
484ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),system_ext)
485 BOARD_USES_SYSTEM_EXTIMAGE := true
486else ifdef BOARD_USES_SYSTEM_EXTIMAGE
487 $(error TARGET_COPY_OUT_SYSTEM_EXT must be set to 'system_ext' to use a system_ext image)
488endif
489.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
490
491BUILDING_SYSTEM_EXT_IMAGE :=
492ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),)
493 ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
494 BUILDING_SYSTEM_EXT_IMAGE := true
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000495 endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900496else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true)
497 BUILDING_SYSTEM_EXT_IMAGE := true
498 ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
499 $(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 +0000500 endif
501endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900502ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
503 BUILDING_SYSTEM_EXT_IMAGE :=
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000504endif
Justin Yun6151e3f2019-06-25 15:58:13 +0900505.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000506
507###########################################
508# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
509ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder))
dianlujitao339ef4c2019-10-10 09:26:00 +0800510 TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm
511else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),)
512 $(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 +0000513endif
514PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES))
515
516BOARD_USES_ODMIMAGE :=
517ifdef BOARD_PREBUILT_ODMIMAGE
518 BOARD_USES_ODMIMAGE := true
519endif
520ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
521 BOARD_USES_ODMIMAGE := true
522endif
523ifeq ($(TARGET_COPY_OUT_ODM),odm)
524 BOARD_USES_ODMIMAGE := true
525else ifdef BOARD_USES_ODMIMAGE
526 $(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image)
527endif
528
529BUILDING_ODM_IMAGE :=
Dan Willemsen25a69372019-04-19 15:00:12 -0700530ifeq ($(PRODUCT_BUILD_ODM_IMAGE),)
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000531 ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
532 BUILDING_ODM_IMAGE := true
533 endif
534else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true)
535 BUILDING_ODM_IMAGE := true
536 ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
537 $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined)
538 endif
539endif
540ifdef BOARD_PREBUILT_ODMIMAGE
541 BUILDING_ODM_IMAGE :=
542endif
543.KATI_READONLY := BUILDING_ODM_IMAGE
544
545###########################################
546# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set.
547TARGET_RECOVERY_UPDATER_LIBS ?=
548AB_OTA_UPDATER ?=
549.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
550ifeq ($(AB_OTA_UPDATER),true)
551 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
552 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER)
553 endif
554endif
555
Tao Bao9be20c72019-04-08 21:11:59 -0700556# Sanity check for building generic OTA packages. Currently it only supports A/B OTAs.
557ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
558 ifneq ($(AB_OTA_UPDATER),true)
559 $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported)
560 endif
561endif
562
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700563ifdef BOARD_PREBUILT_DTBIMAGE_DIR
564 ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
565 $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported)
566 endif
567endif
568
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000569# Check BOARD_VNDK_VERSION
570define check_vndk_version
571 $(eval vndk_path := prebuilts/vndk/v$(1)) \
572 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found))
573endef
574
575ifdef BOARD_VNDK_VERSION
576 ifneq ($(BOARD_VNDK_VERSION),current)
577 $(error BOARD_VNDK_VERSION: Only "current" is implemented)
578 endif
579
580 TARGET_VENDOR_TEST_SUFFIX := /vendor
581else
582 TARGET_VENDOR_TEST_SUFFIX :=
583endif
584
Jiyong Park02426e62019-05-08 20:23:42 +0900585###########################################
586# APEXes are by default flattened, i.e. non-updatable.
587# It can be unflattened (and updatable) by inheriting from
588# updatable_apex.mk
Roland Levillainb3a503d2019-10-04 14:06:26 +0100589#
590# APEX flattening can also be forcibly enabled (resp. disabled) by
591# setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by
592# setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable.
593ifdef OVERRIDE_TARGET_FLATTEN_APEX
594 TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX)
595else
596 ifeq (,$(TARGET_FLATTEN_APEX))
597 TARGET_FLATTEN_APEX := true
598 endif
Jiyong Park02426e62019-05-08 20:23:42 +0900599endif
600
Anton Hanssonbb76ce82019-02-26 12:34:03 +0000601ifeq (,$(TARGET_BUILD_APPS))
602ifdef PRODUCT_EXTRA_VNDK_VERSIONS
603 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v)))
604endif
605endif
606
607# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS
608_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS))
609ifneq (,$(_unsupported_systemsdk_versions))
610 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\
611 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS))
612endif
Dan Willemsen695849e2019-04-17 12:25:09 -0700613
614###########################################
615# Handle BUILD_BROKEN_USES_BUILD_*
616
617$(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\
618 $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\
619 $(KATI_obsolete_var $(m),Please convert to Soong),\
620 $(KATI_deprecated_var $(m),Please convert to Soong)))
621
622$(foreach m,$(DEFAULT_ERROR_BUILD_MODULE_TYPES),\
623 $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\
624 $(KATI_deprecated_var $(m),Please convert to Soong),\
625 $(KATI_obsolete_var $(m),Please convert to Soong)))