Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 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 sanity-checks the variable defined therein. |
| 20 | # ############################################################### |
| 21 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 22 | _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 \ |
Yifan Hong | 8d29737 | 2020-01-24 14:28:03 -0800 | [diff] [blame] | 29 | BOARD_USES_RECOVERY_AS_BOOT \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 30 | BOARD_VENDOR_USE_AKMD \ |
| 31 | BOARD_WPA_SUPPLICANT_DRIVER \ |
| 32 | BOARD_WLAN_DEVICE \ |
| 33 | TARGET_ARCH \ |
| 34 | TARGET_ARCH_VARIANT \ |
| 35 | TARGET_CPU_ABI \ |
| 36 | TARGET_CPU_ABI2 \ |
| 37 | TARGET_CPU_VARIANT \ |
| 38 | TARGET_CPU_VARIANT_RUNTIME \ |
| 39 | TARGET_2ND_ARCH \ |
| 40 | TARGET_2ND_ARCH_VARIANT \ |
| 41 | TARGET_2ND_CPU_ABI \ |
| 42 | TARGET_2ND_CPU_ABI2 \ |
| 43 | TARGET_2ND_CPU_VARIANT \ |
| 44 | TARGET_2ND_CPU_VARIANT_RUNTIME \ |
| 45 | TARGET_BOARD_PLATFORM \ |
| 46 | TARGET_BOARD_PLATFORM_GPU \ |
| 47 | TARGET_BOOTLOADER_BOARD_NAME \ |
Dan Willemsen | d32e6d1 | 2019-04-10 12:25:07 -0700 | [diff] [blame] | 48 | TARGET_FS_CONFIG_GEN \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 49 | TARGET_NO_BOOTLOADER \ |
| 50 | TARGET_NO_KERNEL \ |
| 51 | TARGET_NO_RECOVERY \ |
| 52 | TARGET_NO_RADIOIMAGE \ |
| 53 | TARGET_HARDWARE_3D \ |
| 54 | WITH_DEXPREOPT \ |
| 55 | |
| 56 | # File system variables |
| 57 | _board_strip_readonly_list += \ |
| 58 | BOARD_FLASH_BLOCK_SIZE \ |
| 59 | BOARD_BOOTIMAGE_PARTITION_SIZE \ |
| 60 | BOARD_RECOVERYIMAGE_PARTITION_SIZE \ |
| 61 | BOARD_SYSTEMIMAGE_PARTITION_SIZE \ |
| 62 | BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE \ |
| 63 | BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \ |
| 64 | BOARD_USERDATAIMAGE_PARTITION_SIZE \ |
| 65 | BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ |
| 66 | BOARD_CACHEIMAGE_PARTITION_SIZE \ |
| 67 | BOARD_VENDORIMAGE_PARTITION_SIZE \ |
| 68 | BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \ |
| 69 | BOARD_PRODUCTIMAGE_PARTITION_SIZE \ |
| 70 | BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \ |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 71 | BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE \ |
| 72 | BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 73 | BOARD_ODMIMAGE_PARTITION_SIZE \ |
| 74 | BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \ |
Yifan Hong | cfb917a | 2020-05-07 14:58:20 -0700 | [diff] [blame] | 75 | BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE \ |
| 76 | BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE \ |
Yifan Hong | f496f1b | 2020-07-15 16:52:59 -0700 | [diff] [blame] | 77 | BOARD_ODM_DLKMIMAGE_PARTITION_SIZE \ |
| 78 | BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 79 | |
| 80 | # Logical partitions related variables. |
| 81 | _dynamic_partitions_var_list += \ |
| 82 | BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \ |
| 83 | BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ |
| 84 | BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \ |
Yifan Hong | cfb917a | 2020-05-07 14:58:20 -0700 | [diff] [blame] | 85 | BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE \ |
Yifan Hong | f496f1b | 2020-07-15 16:52:59 -0700 | [diff] [blame] | 86 | BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 87 | BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \ |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 88 | BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 89 | BOARD_SUPER_PARTITION_SIZE \ |
| 90 | BOARD_SUPER_PARTITION_GROUPS \ |
| 91 | |
| 92 | _board_strip_readonly_list += $(_dynamic_partitions_var_list) |
| 93 | |
| 94 | _build_broken_var_list := \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 95 | BUILD_BROKEN_DUP_RULES \ |
Yo Chiang | 0b49c03 | 2020-03-17 17:49:49 +0800 | [diff] [blame] | 96 | BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \ |
Yifan Hong | 5e57a77 | 2020-01-09 16:15:11 -0800 | [diff] [blame] | 97 | BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \ |
Logan Chien | 2a88075 | 2019-09-17 09:45:09 -0700 | [diff] [blame] | 98 | BUILD_BROKEN_PREBUILT_ELF_FILES \ |
Inseob Kim | 5d60c8a | 2019-10-17 10:32:59 +0000 | [diff] [blame] | 99 | BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \ |
Dan Willemsen | 0586c65 | 2019-04-09 09:56:48 -0700 | [diff] [blame] | 100 | BUILD_BROKEN_USES_NETWORK \ |
Yifan Hong | 5e57a77 | 2020-01-09 16:15:11 -0800 | [diff] [blame] | 101 | BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \ |
Jiyong Park | 0b4fccb | 2020-06-26 17:38:00 +0900 | [diff] [blame] | 102 | BUILD_BROKEN_DUP_SYSPROP \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 103 | |
Dan Willemsen | 695849e | 2019-04-17 12:25:09 -0700 | [diff] [blame] | 104 | _build_broken_var_list += \ |
| 105 | $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \ |
| 106 | $(DEFAULT_WARNING_BUILD_MODULE_TYPES) \ |
| 107 | $(DEFAULT_ERROR_BUILD_MODULE_TYPES), \ |
| 108 | BUILD_BROKEN_USES_$(m)) |
| 109 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 110 | _board_true_false_vars := $(_build_broken_var_list) |
Dan Willemsen | 2607625 | 2020-01-02 20:08:10 -0800 | [diff] [blame] | 111 | _board_strip_readonly_list += $(_build_broken_var_list) \ |
| 112 | BUILD_BROKEN_NINJA_USES_ENV_VARS |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 113 | |
Anton Hansson | 74dc00b | 2019-02-27 14:38:27 +0000 | [diff] [blame] | 114 | # Conditional to building on linux, as dex2oat currently does not work on darwin. |
| 115 | ifeq ($(HOST_OS),linux) |
| 116 | WITH_DEXPREOPT := true |
| 117 | endif |
| 118 | |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 119 | # ############################################################### |
| 120 | # Broken build defaults |
| 121 | # ############################################################### |
Dan Willemsen | 0586c65 | 2019-04-09 09:56:48 -0700 | [diff] [blame] | 122 | $(foreach v,$(_build_broken_var_list),$(eval $(v) :=)) |
Dan Willemsen | 2607625 | 2020-01-02 20:08:10 -0800 | [diff] [blame] | 123 | BUILD_BROKEN_NINJA_USES_ENV_VARS := |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 124 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 125 | # Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) |
| 126 | # or under vendor/*/$(TARGET_DEVICE). Search in both places, but |
| 127 | # make sure only one exists. |
| 128 | # Real boards should always be associated with an OEM vendor. |
| 129 | ifdef TARGET_DEVICE_DIR |
| 130 | ifneq ($(origin TARGET_DEVICE_DIR),command line) |
| 131 | $(error TARGET_DEVICE_DIR may not be set manually) |
| 132 | endif |
| 133 | board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk |
| 134 | else |
| 135 | board_config_mk := \ |
| 136 | $(strip $(sort $(wildcard \ |
| 137 | $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ |
| 138 | $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ |
| 139 | $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ |
| 140 | ))) |
| 141 | ifeq ($(board_config_mk),) |
| 142 | $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) |
| 143 | endif |
| 144 | ifneq ($(words $(board_config_mk)),1) |
| 145 | $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) |
| 146 | endif |
| 147 | TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) |
| 148 | .KATI_READONLY := TARGET_DEVICE_DIR |
| 149 | endif |
| 150 | include $(board_config_mk) |
| 151 | ifeq ($(TARGET_ARCH),) |
| 152 | $(error TARGET_ARCH not defined by board config: $(board_config_mk)) |
| 153 | endif |
| 154 | ifneq ($(MALLOC_IMPL),) |
| 155 | $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).) |
| 156 | $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory) |
| 157 | endif |
| 158 | board_config_mk := |
| 159 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 160 | # Clean up and verify BoardConfig variables |
| 161 | $(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var))))) |
| 162 | $(foreach var,$(_board_true_false_vars), \ |
| 163 | $(if $(filter-out true false,$($(var))), \ |
| 164 | $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))"))) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 165 | |
| 166 | # Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified. |
| 167 | TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT)) |
| 168 | TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT)) |
| 169 | |
Anton Hansson | 1927985 | 2019-02-28 17:15:57 +0000 | [diff] [blame] | 170 | # The combo makefiles sanity-check and set defaults for various CPU configuration |
| 171 | combo_target := TARGET_ |
| 172 | combo_2nd_arch_prefix := |
| 173 | include $(BUILD_SYSTEM)/combo/select.mk |
| 174 | |
| 175 | ifdef TARGET_2ND_ARCH |
| 176 | combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 177 | include $(BUILD_SYSTEM)/combo/select.mk |
| 178 | endif |
| 179 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 180 | .KATI_READONLY := $(_board_strip_readonly_list) |
| 181 | |
| 182 | INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 183 | ifeq ($(TARGET_CPU_ABI),) |
| 184 | $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) |
| 185 | endif |
| 186 | ifneq ($(filter %64,$(TARGET_ARCH)),) |
| 187 | TARGET_IS_64_BIT := true |
| 188 | endif |
| 189 | |
| 190 | ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) |
| 191 | TARGET_SUPPORTS_32_BIT_APPS := true |
| 192 | endif |
| 193 | |
| 194 | # Sanity check to warn about likely cryptic errors later in the build. |
| 195 | ifeq ($(TARGET_IS_64_BIT),true) |
| 196 | ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) |
Anton Hansson | 6d25fc6 | 2019-05-10 15:29:28 +0100 | [diff] [blame] | 197 | $(error Building a 32-bit-app-only product on a 64-bit device. \ |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 198 | If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) |
| 199 | endif |
| 200 | endif |
| 201 | |
| 202 | # "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are |
| 203 | # comma separated lists of the 32 and 64 bit ABIs (in order of |
| 204 | # preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT |
| 205 | # are defined by the board config, we use them. Else, we construct |
| 206 | # these lists based on whether TARGET_IS_64_BIT is set. |
| 207 | # |
| 208 | # Note that this assumes that the 2ND_CPU_ABI for a 64 bit target |
| 209 | # is always 32 bits. If this isn't the case, these variables should |
| 210 | # be overriden in the board configuration. |
Evgeny Eltsin | 28fbe7f | 2019-07-29 16:23:19 +0200 | [diff] [blame] | 211 | # |
| 212 | # Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always |
| 213 | # 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs. |
| 214 | _target_native_bridge_abi_list_32_bit := |
| 215 | _target_native_bridge_abi_list_64_bit := |
| 216 | |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 217 | ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) |
| 218 | ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) |
| 219 | TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) |
Evgeny Eltsin | 28fbe7f | 2019-07-29 16:23:19 +0200 | [diff] [blame] | 220 | _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 221 | endif |
| 222 | endif |
| 223 | |
Peter Collingbourne | 6aea25d | 2019-05-16 14:09:35 -0700 | [diff] [blame] | 224 | # "arm64-v8a-hwasan", the ABI for libraries compiled with HWASAN, is supported |
| 225 | # in all builds with SANITIZE_TARGET=hwaddress. |
| 226 | ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),) |
| 227 | ifneq ($(filter arm64-v8a,$(TARGET_CPU_ABI_LIST_64_BIT)),) |
| 228 | TARGET_CPU_ABI_LIST_64_BIT := arm64-v8a-hwasan $(TARGET_CPU_ABI_LIST_64_BIT) |
| 229 | endif |
| 230 | endif |
| 231 | |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 232 | ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) |
| 233 | ifneq (true,$(TARGET_IS_64_BIT)) |
| 234 | TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) |
Evgeny Eltsin | 28fbe7f | 2019-07-29 16:23:19 +0200 | [diff] [blame] | 235 | _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 236 | else |
| 237 | ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) |
| 238 | # For a 64 bit target, assume that the 2ND_CPU_ABI |
| 239 | # is a 32 bit ABI. |
| 240 | TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) |
Evgeny Eltsin | 28fbe7f | 2019-07-29 16:23:19 +0200 | [diff] [blame] | 241 | _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 242 | endif |
| 243 | endif |
| 244 | endif |
| 245 | |
| 246 | # "ro.product.cpu.abilist" is a comma separated list of ABIs (in order |
| 247 | # of preference) that the target supports. If a TARGET_CPU_ABI_LIST |
| 248 | # is specified by the board configuration, we use that. If not, we |
| 249 | # build a list out of the TARGET_CPU_ABIs specified by the config. |
Evgeny Eltsin | 28fbe7f | 2019-07-29 16:23:19 +0200 | [diff] [blame] | 250 | # Add NATIVE_BRIDGE_ABIs at the end to keep order of preference. |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 251 | ifeq (,$(TARGET_CPU_ABI_LIST)) |
Elliott Hughes | 9b824d5 | 2020-04-17 15:46:55 -0700 | [diff] [blame] | 252 | TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \ |
| 253 | $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 254 | endif |
| 255 | |
Evgeny Eltsin | 28fbe7f | 2019-07-29 16:23:19 +0200 | [diff] [blame] | 256 | # Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference. |
| 257 | TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit) |
| 258 | TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit) |
| 259 | |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 260 | # Strip whitespace from the ABI list string. |
| 261 | TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) |
| 262 | TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) |
| 263 | TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) |
| 264 | |
Jeongik Cha | bb688a9 | 2019-07-12 12:51:37 +0900 | [diff] [blame] | 265 | # Check if config about image building is valid or not. |
| 266 | define check_image_config |
| 267 | $(eval _uc_name := $(call to-upper,$(1))) \ |
| 268 | $(eval _lc_name := $(call to-lower,$(1))) \ |
| 269 | $(if $(filter $(_lc_name),$(TARGET_COPY_OUT_$(_uc_name))), \ |
| 270 | $(if $(BOARD_USES_$(_uc_name)IMAGE),, \ |
| 271 | $(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)), \ |
| 272 | $(if $(BOARD_USES_$(_uc_name)IMAGE), \ |
| 273 | $(error TARGET_COPY_OUT_$(_uc_name) must be set to '$(_lc_name)' to use a $(_lc_name) image))) \ |
| 274 | $(eval _uc_name :=) \ |
| 275 | $(eval _lc_name :=) |
| 276 | endef |
| 277 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 278 | ########################################### |
| 279 | # Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK |
| 280 | ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) |
| 281 | TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT) |
| 282 | endif |
| 283 | |
| 284 | ########################################### |
Bowgo Tsai | 0013f55 | 2019-03-20 17:59:52 +0800 | [diff] [blame] | 285 | # Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK |
| 286 | ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) |
| 287 | TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk |
Bowgo Tsai | 6a68367 | 2020-02-14 19:00:15 +0800 | [diff] [blame] | 288 | TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK := vendor_debug_ramdisk/first_stage_ramdisk |
Bowgo Tsai | 5c40c71 | 2019-10-08 10:22:19 +0800 | [diff] [blame] | 289 | TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk/first_stage_ramdisk |
Bowgo Tsai | 0013f55 | 2019-03-20 17:59:52 +0800 | [diff] [blame] | 290 | endif |
| 291 | |
| 292 | ########################################### |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 293 | # Configure whether we're building the system image |
| 294 | BUILDING_SYSTEM_IMAGE := true |
| 295 | ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),) |
| 296 | ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE |
| 297 | ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE |
| 298 | BUILDING_SYSTEM_IMAGE := |
| 299 | endif |
| 300 | endif |
| 301 | else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false) |
| 302 | BUILDING_SYSTEM_IMAGE := |
| 303 | endif |
| 304 | .KATI_READONLY := BUILDING_SYSTEM_IMAGE |
| 305 | |
| 306 | # Are we building a system_other image |
| 307 | BUILDING_SYSTEM_OTHER_IMAGE := |
| 308 | ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),) |
| 309 | ifdef BUILDING_SYSTEM_IMAGE |
| 310 | ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) |
| 311 | BUILDING_SYSTEM_OTHER_IMAGE := true |
| 312 | endif |
| 313 | endif |
| 314 | else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true) |
| 315 | BUILDING_SYSTEM_OTHER_IMAGE := true |
| 316 | ifndef BUILDING_SYSTEM_IMAGE |
| 317 | $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image) |
| 318 | endif |
| 319 | endif |
| 320 | .KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE |
| 321 | |
| 322 | # Are we building a cache image |
| 323 | BUILDING_CACHE_IMAGE := |
| 324 | ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),) |
| 325 | ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE |
| 326 | BUILDING_CACHE_IMAGE := true |
| 327 | endif |
| 328 | else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true) |
| 329 | BUILDING_CACHE_IMAGE := true |
| 330 | ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE |
| 331 | $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined) |
| 332 | endif |
| 333 | endif |
| 334 | .KATI_READONLY := BUILDING_CACHE_IMAGE |
| 335 | |
Chris Gross | a784ef1 | 2019-04-22 11:09:57 -0700 | [diff] [blame] | 336 | # Are we building a boot image |
| 337 | BUILDING_BOOT_IMAGE := |
| 338 | ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) |
| 339 | BUILDING_BOOT_IMAGE := |
| 340 | else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),) |
| 341 | ifdef BOARD_BOOTIMAGE_PARTITION_SIZE |
| 342 | BUILDING_BOOT_IMAGE := true |
| 343 | endif |
| 344 | else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true) |
| 345 | BUILDING_BOOT_IMAGE := true |
| 346 | endif |
| 347 | .KATI_READONLY := BUILDING_BOOT_IMAGE |
| 348 | |
| 349 | # Are we building a recovery image |
| 350 | BUILDING_RECOVERY_IMAGE := |
| 351 | ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) |
| 352 | BUILDING_RECOVERY_IMAGE := true |
| 353 | else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),) |
| 354 | ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE |
| 355 | ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) |
| 356 | BUILDING_RECOVERY_IMAGE := true |
| 357 | endif |
| 358 | endif |
| 359 | else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true) |
| 360 | BUILDING_RECOVERY_IMAGE := true |
| 361 | endif |
| 362 | .KATI_READONLY := BUILDING_RECOVERY_IMAGE |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 363 | |
Steve Muckle | e1b1086 | 2019-07-10 10:49:37 -0700 | [diff] [blame] | 364 | # Are we building a vendor boot image |
| 365 | BUILDING_VENDOR_BOOT_IMAGE := |
| 366 | ifdef BOARD_BOOT_HEADER_VERSION |
| 367 | ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),) |
Steve Muckle | 3363a0b | 2020-02-12 13:38:28 -0800 | [diff] [blame] | 368 | ifneq ($(TARGET_NO_VENDOR_BOOT),true) |
| 369 | BUILDING_VENDOR_BOOT_IMAGE := true |
| 370 | endif |
Steve Muckle | e1b1086 | 2019-07-10 10:49:37 -0700 | [diff] [blame] | 371 | endif |
| 372 | endif |
| 373 | .KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE |
| 374 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 375 | # Are we building a ramdisk image |
| 376 | BUILDING_RAMDISK_IMAGE := true |
| 377 | ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),) |
| 378 | # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true: |
| 379 | # BUILDING_BOOT_IMAGE |
| 380 | # BUILDING_RECOVERY_IMAGE |
| 381 | else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false) |
| 382 | BUILDING_RAMDISK_IMAGE := |
| 383 | endif |
| 384 | .KATI_READONLY := BUILDING_RAMDISK_IMAGE |
| 385 | |
| 386 | # Are we building a userdata image |
| 387 | BUILDING_USERDATA_IMAGE := |
| 388 | ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),) |
| 389 | ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE |
| 390 | BUILDING_USERDATA_IMAGE := true |
| 391 | endif |
| 392 | else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true) |
| 393 | BUILDING_USERDATA_IMAGE := true |
| 394 | endif |
| 395 | .KATI_READONLY := BUILDING_USERDATA_IMAGE |
| 396 | |
Paul Trautrim | 4e14323 | 2019-08-13 16:30:57 +0900 | [diff] [blame] | 397 | # Are we building a vbmeta image |
| 398 | BUILDING_VBMETA_IMAGE := true |
| 399 | ifeq ($(PRODUCT_BUILD_VBMETA_IMAGE),false) |
| 400 | BUILDING_VBMETA_IMAGE := |
| 401 | endif |
| 402 | .KATI_READONLY := BUILDING_VBMETA_IMAGE |
| 403 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 404 | ########################################### |
| 405 | # Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR |
| 406 | ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) |
| 407 | TARGET_COPY_OUT_VENDOR := system/vendor |
| 408 | else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) |
| 409 | $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) |
| 410 | endif |
| 411 | PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) |
| 412 | |
| 413 | BOARD_USES_VENDORIMAGE := |
| 414 | ifdef BOARD_PREBUILT_VENDORIMAGE |
| 415 | BOARD_USES_VENDORIMAGE := true |
| 416 | endif |
| 417 | ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 418 | BOARD_USES_VENDORIMAGE := true |
| 419 | endif |
Jeongik Cha | bb688a9 | 2019-07-12 12:51:37 +0900 | [diff] [blame] | 420 | # TODO(b/137169253): For now, some AOSP targets build with prebuilt vendor image. |
| 421 | # But target's BOARD_PREBUILT_VENDORIMAGE is not filled. |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 422 | ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) |
| 423 | BOARD_USES_VENDORIMAGE := true |
| 424 | else ifdef BOARD_USES_VENDORIMAGE |
| 425 | $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) |
| 426 | endif |
| 427 | .KATI_READONLY := BOARD_USES_VENDORIMAGE |
| 428 | |
| 429 | BUILDING_VENDOR_IMAGE := |
| 430 | ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),) |
| 431 | ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 432 | BUILDING_VENDOR_IMAGE := true |
| 433 | endif |
| 434 | else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true) |
| 435 | BUILDING_VENDOR_IMAGE := true |
| 436 | ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 437 | $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined) |
| 438 | endif |
| 439 | endif |
| 440 | ifdef BOARD_PREBUILT_VENDORIMAGE |
| 441 | BUILDING_VENDOR_IMAGE := |
| 442 | endif |
| 443 | .KATI_READONLY := BUILDING_VENDOR_IMAGE |
| 444 | |
| 445 | ########################################### |
| 446 | # Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT |
| 447 | ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) |
| 448 | TARGET_COPY_OUT_PRODUCT := system/product |
| 449 | else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) |
| 450 | $(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) |
| 451 | endif |
| 452 | PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) |
| 453 | |
| 454 | BOARD_USES_PRODUCTIMAGE := |
| 455 | ifdef BOARD_PREBUILT_PRODUCTIMAGE |
| 456 | BOARD_USES_PRODUCTIMAGE := true |
| 457 | endif |
| 458 | ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 459 | BOARD_USES_PRODUCTIMAGE := true |
| 460 | endif |
Jeongik Cha | bb688a9 | 2019-07-12 12:51:37 +0900 | [diff] [blame] | 461 | $(call check_image_config,product) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 462 | .KATI_READONLY := BOARD_USES_PRODUCTIMAGE |
| 463 | |
| 464 | BUILDING_PRODUCT_IMAGE := |
| 465 | ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),) |
| 466 | ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 467 | BUILDING_PRODUCT_IMAGE := true |
| 468 | endif |
| 469 | else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true) |
| 470 | BUILDING_PRODUCT_IMAGE := true |
| 471 | ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 472 | $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined) |
| 473 | endif |
| 474 | endif |
| 475 | ifdef BOARD_PREBUILT_PRODUCTIMAGE |
| 476 | BUILDING_PRODUCT_IMAGE := |
| 477 | endif |
| 478 | .KATI_READONLY := BUILDING_PRODUCT_IMAGE |
| 479 | |
| 480 | ########################################### |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 481 | # TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to |
| 482 | # TARGET_COPY_OUT_PRODUCT as a workaround. |
| 483 | TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 484 | |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 485 | ########################################### |
| 486 | # Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT |
| 487 | ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder)) |
| 488 | TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext |
| 489 | else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),) |
| 490 | $(error TARGET_COPY_OUT_SYSTEM_EXT must be either 'system_ext' or 'system/system_ext', seeing '$(TARGET_COPY_OUT_SYSTEM_EXT)'.) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 491 | endif |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 492 | PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES)) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 493 | |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 494 | BOARD_USES_SYSTEM_EXTIMAGE := |
| 495 | ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE |
| 496 | BOARD_USES_SYSTEM_EXTIMAGE := true |
| 497 | endif |
| 498 | ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE |
| 499 | BOARD_USES_SYSTEM_EXTIMAGE := true |
| 500 | endif |
Jeongik Cha | bb688a9 | 2019-07-12 12:51:37 +0900 | [diff] [blame] | 501 | $(call check_image_config,system_ext) |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 502 | .KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE |
| 503 | |
| 504 | BUILDING_SYSTEM_EXT_IMAGE := |
| 505 | ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),) |
| 506 | ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE |
| 507 | BUILDING_SYSTEM_EXT_IMAGE := true |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 508 | endif |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 509 | else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true) |
| 510 | BUILDING_SYSTEM_EXT_IMAGE := true |
| 511 | ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE |
| 512 | $(error PRODUCT_BUILD_SYSTEM_EXT_IMAGE set to true, but BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE not defined) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 513 | endif |
| 514 | endif |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 515 | ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE |
| 516 | BUILDING_SYSTEM_EXT_IMAGE := |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 517 | endif |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 518 | .KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 519 | |
| 520 | ########################################### |
Yifan Hong | cfb917a | 2020-05-07 14:58:20 -0700 | [diff] [blame] | 521 | # Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM |
| 522 | ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder)) |
| 523 | TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm |
| 524 | else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),) |
| 525 | $(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)'.) |
| 526 | endif |
| 527 | PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES)) |
| 528 | |
| 529 | BOARD_USES_VENDOR_DLKMIMAGE := |
| 530 | ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE |
| 531 | BOARD_USES_VENDOR_DLKMIMAGE := true |
| 532 | endif |
| 533 | ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE |
| 534 | BOARD_USES_VENDOR_DLKMIMAGE := true |
| 535 | endif |
| 536 | $(call check_image_config,vendor_dlkm) |
| 537 | |
| 538 | BUILDING_VENDOR_DLKM_IMAGE := |
| 539 | ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),) |
| 540 | ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE |
| 541 | BUILDING_VENDOR_DLKM_IMAGE := true |
| 542 | endif |
| 543 | else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true) |
| 544 | BUILDING_VENDOR_DLKM_IMAGE := true |
| 545 | ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE |
| 546 | $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) |
| 547 | endif |
| 548 | endif |
| 549 | ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE |
| 550 | BUILDING_VENDOR_DLKM_IMAGE := |
| 551 | endif |
| 552 | .KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE |
| 553 | |
| 554 | ########################################### |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 555 | # Now we can substitute with the real value of TARGET_COPY_OUT_ODM |
| 556 | ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) |
dianlujitao | 339ef4c | 2019-10-10 09:26:00 +0800 | [diff] [blame] | 557 | TARGET_COPY_OUT_ODM := $(TARGET_COPY_OUT_VENDOR)/odm |
| 558 | else ifeq ($(filter odm system/vendor/odm vendor/odm,$(TARGET_COPY_OUT_ODM)),) |
| 559 | $(error TARGET_COPY_OUT_ODM must be either 'odm', 'system/vendor/odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 560 | endif |
| 561 | PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES)) |
| 562 | |
| 563 | BOARD_USES_ODMIMAGE := |
| 564 | ifdef BOARD_PREBUILT_ODMIMAGE |
| 565 | BOARD_USES_ODMIMAGE := true |
| 566 | endif |
| 567 | ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 568 | BOARD_USES_ODMIMAGE := true |
| 569 | endif |
Jeongik Cha | bb688a9 | 2019-07-12 12:51:37 +0900 | [diff] [blame] | 570 | $(call check_image_config,odm) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 571 | |
| 572 | BUILDING_ODM_IMAGE := |
Dan Willemsen | 25a6937 | 2019-04-19 15:00:12 -0700 | [diff] [blame] | 573 | ifeq ($(PRODUCT_BUILD_ODM_IMAGE),) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 574 | ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 575 | BUILDING_ODM_IMAGE := true |
| 576 | endif |
| 577 | else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true) |
| 578 | BUILDING_ODM_IMAGE := true |
| 579 | ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 580 | $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined) |
| 581 | endif |
| 582 | endif |
| 583 | ifdef BOARD_PREBUILT_ODMIMAGE |
| 584 | BUILDING_ODM_IMAGE := |
| 585 | endif |
| 586 | .KATI_READONLY := BUILDING_ODM_IMAGE |
| 587 | |
Yifan Hong | f496f1b | 2020-07-15 16:52:59 -0700 | [diff] [blame] | 588 | |
| 589 | ########################################### |
| 590 | # Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM |
| 591 | ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder)) |
| 592 | TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm |
| 593 | else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),) |
| 594 | $(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)'.) |
| 595 | endif |
| 596 | PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES)) |
| 597 | |
| 598 | BOARD_USES_ODM_DLKMIMAGE := |
| 599 | ifdef BOARD_PREBUILT_ODM_DLKMIMAGE |
| 600 | BOARD_USES_ODM_DLKMIMAGE := true |
| 601 | endif |
| 602 | ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE |
| 603 | BOARD_USES_ODM_DLKMIMAGE := true |
| 604 | endif |
| 605 | $(call check_image_config,odm_dlkm) |
| 606 | |
| 607 | BUILDING_ODM_DLKM_IMAGE := |
| 608 | ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),) |
| 609 | ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE |
| 610 | BUILDING_ODM_DLKM_IMAGE := true |
| 611 | endif |
| 612 | else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true) |
| 613 | BUILDING_ODM_DLKM_IMAGE := true |
| 614 | ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE |
| 615 | $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) |
| 616 | endif |
| 617 | endif |
| 618 | ifdef BOARD_PREBUILT_ODM_DLKMIMAGE |
| 619 | BUILDING_ODM_DLKM_IMAGE := |
| 620 | endif |
| 621 | .KATI_READONLY := BUILDING_ODM_DLKM_IMAGE |
| 622 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 623 | ########################################### |
Yifan Hong | 65afc07 | 2020-04-17 10:08:10 -0700 | [diff] [blame] | 624 | # Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE. |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 625 | TARGET_RECOVERY_UPDATER_LIBS ?= |
| 626 | AB_OTA_UPDATER ?= |
| 627 | .KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER |
Yifan Hong | 65afc07 | 2020-04-17 10:08:10 -0700 | [diff] [blame] | 628 | |
| 629 | # Ensure that if PRODUCT_OTA_FORCE_NON_AB_PACKAGE == true, then AB_OTA_UPDATER must be true |
| 630 | ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true) |
| 631 | ifneq ($(AB_OTA_UPDATER),true) |
| 632 | $(error AB_OTA_UPDATER must be set to true when PRODUCT_OTA_FORCE_NON_AB_PACKAGE is true) |
| 633 | endif |
| 634 | endif |
| 635 | |
| 636 | # In some configurations, A/B and non-A/B may coexist. Check TARGET_OTA_ALLOW_NON_AB |
| 637 | # to see if non-A/B is supported. |
| 638 | TARGET_OTA_ALLOW_NON_AB := false |
| 639 | ifneq ($(AB_OTA_UPDATER),true) |
| 640 | TARGET_OTA_ALLOW_NON_AB := true |
| 641 | else ifeq ($(PRODUCT_OTA_FORCE_NON_AB_PACKAGE),true) |
| 642 | TARGET_OTA_ALLOW_NON_AB := true |
| 643 | endif |
| 644 | .KATI_READONLY := TARGET_OTA_ALLOW_NON_AB |
| 645 | |
| 646 | ifneq ($(TARGET_OTA_ALLOW_NON_AB),true) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 647 | ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) |
Yifan Hong | 65afc07 | 2020-04-17 10:08:10 -0700 | [diff] [blame] | 648 | $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using TARGET_OTA_ALLOW_NON_AB) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 649 | endif |
| 650 | endif |
| 651 | |
Tao Bao | 9be20c7 | 2019-04-08 21:11:59 -0700 | [diff] [blame] | 652 | # Sanity check for building generic OTA packages. Currently it only supports A/B OTAs. |
| 653 | ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) |
| 654 | ifneq ($(AB_OTA_UPDATER),true) |
| 655 | $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported) |
| 656 | endif |
| 657 | endif |
| 658 | |
Hridya Valsaraju | 59eaef0 | 2019-05-20 11:10:24 -0700 | [diff] [blame] | 659 | ifdef BOARD_PREBUILT_DTBIMAGE_DIR |
| 660 | ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true) |
| 661 | $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported) |
| 662 | endif |
| 663 | endif |
| 664 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 665 | # Check BOARD_VNDK_VERSION |
| 666 | define check_vndk_version |
| 667 | $(eval vndk_path := prebuilts/vndk/v$(1)) \ |
| 668 | $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) |
| 669 | endef |
| 670 | |
| 671 | ifdef BOARD_VNDK_VERSION |
Inseob Kim | 2b0b3d1 | 2020-06-25 22:19:29 +0900 | [diff] [blame] | 672 | ifeq ($(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION)) |
| 673 | $(error BOARD_VNDK_VERSION is equal to PLATFORM_VNDK_VERSION; use BOARD_VNDK_VERSION := current)) |
| 674 | endif |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 675 | ifneq ($(BOARD_VNDK_VERSION),current) |
Inseob Kim | f0cec69 | 2019-12-03 15:09:44 +0900 | [diff] [blame] | 676 | $(call check_vndk_version,$(BOARD_VNDK_VERSION)) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 677 | endif |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 678 | TARGET_VENDOR_TEST_SUFFIX := /vendor |
| 679 | else |
| 680 | TARGET_VENDOR_TEST_SUFFIX := |
| 681 | endif |
| 682 | |
Jiyong Park | 02426e6 | 2019-05-08 20:23:42 +0900 | [diff] [blame] | 683 | ########################################### |
| 684 | # APEXes are by default flattened, i.e. non-updatable. |
| 685 | # It can be unflattened (and updatable) by inheriting from |
| 686 | # updatable_apex.mk |
Roland Levillain | b3a503d | 2019-10-04 14:06:26 +0100 | [diff] [blame] | 687 | # |
| 688 | # APEX flattening can also be forcibly enabled (resp. disabled) by |
| 689 | # setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by |
| 690 | # setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable. |
| 691 | ifdef OVERRIDE_TARGET_FLATTEN_APEX |
| 692 | TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX) |
| 693 | else |
| 694 | ifeq (,$(TARGET_FLATTEN_APEX)) |
| 695 | TARGET_FLATTEN_APEX := true |
| 696 | endif |
Jiyong Park | 02426e6 | 2019-05-08 20:23:42 +0900 | [diff] [blame] | 697 | endif |
| 698 | |
Martin Stjernholm | 7a430fd | 2020-06-04 15:16:39 +0100 | [diff] [blame] | 699 | ifeq (,$(TARGET_BUILD_UNBUNDLED)) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 700 | ifdef PRODUCT_EXTRA_VNDK_VERSIONS |
| 701 | $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) |
| 702 | endif |
| 703 | endif |
| 704 | |
| 705 | # Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS |
| 706 | _unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) |
| 707 | ifneq (,$(_unsupported_systemsdk_versions)) |
| 708 | $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ |
| 709 | Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) |
| 710 | endif |
Dan Willemsen | 695849e | 2019-04-17 12:25:09 -0700 | [diff] [blame] | 711 | |
| 712 | ########################################### |
| 713 | # Handle BUILD_BROKEN_USES_BUILD_* |
| 714 | |
Dan Willemsen | 97ec812 | 2020-02-19 18:06:54 -0800 | [diff] [blame] | 715 | $(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\ |
Dan Willemsen | 695849e | 2019-04-17 12:25:09 -0700 | [diff] [blame] | 716 | $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\ |
| 717 | $(KATI_obsolete_var $(m),Please convert to Soong),\ |
| 718 | $(KATI_deprecated_var $(m),Please convert to Soong))) |
| 719 | |
Dan Willemsen | 97ec812 | 2020-02-19 18:06:54 -0800 | [diff] [blame] | 720 | $(if $(filter true,$(BUILD_BROKEN_USES_BUILD_COPY_HEADERS)),\ |
| 721 | $(KATI_deprecated_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers),\ |
| 722 | $(KATI_obsolete_var BUILD_COPY_HEADERS,See $(CHANGES_URL)#copy_headers)) |
Dan Willemsen | 66d21d4 | 2020-01-27 19:26:02 -0800 | [diff] [blame] | 723 | |
Dan Willemsen | 97ec812 | 2020-02-19 18:06:54 -0800 | [diff] [blame] | 724 | $(foreach m,$(filter-out BUILD_COPY_HEADERS,$(DEFAULT_ERROR_BUILD_MODULE_TYPES)),\ |
Dan Willemsen | 695849e | 2019-04-17 12:25:09 -0700 | [diff] [blame] | 725 | $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\ |
| 726 | $(KATI_deprecated_var $(m),Please convert to Soong),\ |
| 727 | $(KATI_obsolete_var $(m),Please convert to Soong))) |