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 \ |
| 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 \ |
| 47 | TARGET_NO_BOOTLOADER \ |
| 48 | TARGET_NO_KERNEL \ |
| 49 | TARGET_NO_RECOVERY \ |
| 50 | TARGET_NO_RADIOIMAGE \ |
| 51 | TARGET_HARDWARE_3D \ |
| 52 | WITH_DEXPREOPT \ |
| 53 | |
| 54 | # File system variables |
| 55 | _board_strip_readonly_list += \ |
| 56 | BOARD_FLASH_BLOCK_SIZE \ |
| 57 | BOARD_BOOTIMAGE_PARTITION_SIZE \ |
| 58 | BOARD_RECOVERYIMAGE_PARTITION_SIZE \ |
| 59 | BOARD_SYSTEMIMAGE_PARTITION_SIZE \ |
| 60 | BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE \ |
| 61 | BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \ |
| 62 | BOARD_USERDATAIMAGE_PARTITION_SIZE \ |
| 63 | BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ |
| 64 | BOARD_CACHEIMAGE_PARTITION_SIZE \ |
| 65 | BOARD_VENDORIMAGE_PARTITION_SIZE \ |
| 66 | BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \ |
| 67 | BOARD_PRODUCTIMAGE_PARTITION_SIZE \ |
| 68 | BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \ |
| 69 | BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE \ |
| 70 | BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE \ |
| 71 | BOARD_ODMIMAGE_PARTITION_SIZE \ |
| 72 | BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \ |
| 73 | |
| 74 | # Logical partitions related variables. |
| 75 | _dynamic_partitions_var_list += \ |
| 76 | BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \ |
| 77 | BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ |
| 78 | BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \ |
| 79 | BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \ |
| 80 | BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE \ |
| 81 | BOARD_SUPER_PARTITION_SIZE \ |
| 82 | BOARD_SUPER_PARTITION_GROUPS \ |
| 83 | |
| 84 | _board_strip_readonly_list += $(_dynamic_partitions_var_list) |
| 85 | |
| 86 | _build_broken_var_list := \ |
| 87 | BUILD_BROKEN_ANDROIDMK_EXPORTS \ |
| 88 | BUILD_BROKEN_DUP_COPY_HEADERS \ |
| 89 | BUILD_BROKEN_DUP_RULES \ |
| 90 | BUILD_BROKEN_PHONY_TARGETS \ |
| 91 | BUILD_BROKEN_ENG_DEBUG_TAGS \ |
Dan Willemsen | 0586c65 | 2019-04-09 09:56:48 -0700 | [diff] [blame^] | 92 | BUILD_BROKEN_USES_NETWORK \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 93 | |
| 94 | _board_true_false_vars := $(_build_broken_var_list) |
| 95 | _board_strip_readonly_list += $(_build_broken_var_list) |
| 96 | |
Anton Hansson | 74dc00b | 2019-02-27 14:38:27 +0000 | [diff] [blame] | 97 | # Conditional to building on linux, as dex2oat currently does not work on darwin. |
| 98 | ifeq ($(HOST_OS),linux) |
| 99 | WITH_DEXPREOPT := true |
| 100 | endif |
| 101 | |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 102 | # ############################################################### |
| 103 | # Broken build defaults |
| 104 | # ############################################################### |
Dan Willemsen | 0586c65 | 2019-04-09 09:56:48 -0700 | [diff] [blame^] | 105 | $(foreach v,$(_build_broken_var_list),$(eval $(v) :=)) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 106 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 107 | # Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) |
| 108 | # or under vendor/*/$(TARGET_DEVICE). Search in both places, but |
| 109 | # make sure only one exists. |
| 110 | # Real boards should always be associated with an OEM vendor. |
| 111 | ifdef TARGET_DEVICE_DIR |
| 112 | ifneq ($(origin TARGET_DEVICE_DIR),command line) |
| 113 | $(error TARGET_DEVICE_DIR may not be set manually) |
| 114 | endif |
| 115 | board_config_mk := $(TARGET_DEVICE_DIR)/BoardConfig.mk |
| 116 | else |
| 117 | board_config_mk := \ |
| 118 | $(strip $(sort $(wildcard \ |
| 119 | $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ |
| 120 | $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ |
| 121 | $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ |
| 122 | ))) |
| 123 | ifeq ($(board_config_mk),) |
| 124 | $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) |
| 125 | endif |
| 126 | ifneq ($(words $(board_config_mk)),1) |
| 127 | $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) |
| 128 | endif |
| 129 | TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) |
| 130 | .KATI_READONLY := TARGET_DEVICE_DIR |
| 131 | endif |
| 132 | include $(board_config_mk) |
| 133 | ifeq ($(TARGET_ARCH),) |
| 134 | $(error TARGET_ARCH not defined by board config: $(board_config_mk)) |
| 135 | endif |
| 136 | ifneq ($(MALLOC_IMPL),) |
| 137 | $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).) |
| 138 | $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory) |
| 139 | endif |
| 140 | board_config_mk := |
| 141 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 142 | # Clean up and verify BoardConfig variables |
| 143 | $(foreach var,$(_board_strip_readonly_list),$(eval $(var) := $$(strip $$($(var))))) |
| 144 | $(foreach var,$(_board_true_false_vars), \ |
| 145 | $(if $(filter-out true false,$($(var))), \ |
| 146 | $(error Valid values of $(var) are "true", "false", and "". Not "$($(var))"))) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 147 | |
| 148 | # Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified. |
| 149 | TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT)) |
| 150 | TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT)) |
| 151 | |
Anton Hansson | 1927985 | 2019-02-28 17:15:57 +0000 | [diff] [blame] | 152 | # The combo makefiles sanity-check and set defaults for various CPU configuration |
| 153 | combo_target := TARGET_ |
| 154 | combo_2nd_arch_prefix := |
| 155 | include $(BUILD_SYSTEM)/combo/select.mk |
| 156 | |
| 157 | ifdef TARGET_2ND_ARCH |
| 158 | combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 159 | include $(BUILD_SYSTEM)/combo/select.mk |
| 160 | endif |
| 161 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 162 | .KATI_READONLY := $(_board_strip_readonly_list) |
| 163 | |
| 164 | INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 165 | ifeq ($(TARGET_CPU_ABI),) |
| 166 | $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) |
| 167 | endif |
| 168 | ifneq ($(filter %64,$(TARGET_ARCH)),) |
| 169 | TARGET_IS_64_BIT := true |
| 170 | endif |
| 171 | |
| 172 | ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) |
| 173 | TARGET_SUPPORTS_32_BIT_APPS := true |
| 174 | endif |
| 175 | |
| 176 | # Sanity check to warn about likely cryptic errors later in the build. |
| 177 | ifeq ($(TARGET_IS_64_BIT),true) |
| 178 | ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) |
| 179 | $(warning Building a 32-bit-app-only product on a 64-bit device. \ |
| 180 | If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) |
| 181 | endif |
| 182 | endif |
| 183 | |
| 184 | # "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are |
| 185 | # comma separated lists of the 32 and 64 bit ABIs (in order of |
| 186 | # preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT |
| 187 | # are defined by the board config, we use them. Else, we construct |
| 188 | # these lists based on whether TARGET_IS_64_BIT is set. |
| 189 | # |
| 190 | # Note that this assumes that the 2ND_CPU_ABI for a 64 bit target |
| 191 | # is always 32 bits. If this isn't the case, these variables should |
| 192 | # be overriden in the board configuration. |
| 193 | ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) |
| 194 | ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) |
| 195 | TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) |
| 196 | endif |
| 197 | endif |
| 198 | |
| 199 | ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) |
| 200 | ifneq (true,$(TARGET_IS_64_BIT)) |
| 201 | TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) |
| 202 | else |
| 203 | ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) |
| 204 | # For a 64 bit target, assume that the 2ND_CPU_ABI |
| 205 | # is a 32 bit ABI. |
| 206 | TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) |
| 207 | endif |
| 208 | endif |
| 209 | endif |
| 210 | |
| 211 | # "ro.product.cpu.abilist" is a comma separated list of ABIs (in order |
| 212 | # of preference) that the target supports. If a TARGET_CPU_ABI_LIST |
| 213 | # is specified by the board configuration, we use that. If not, we |
| 214 | # build a list out of the TARGET_CPU_ABIs specified by the config. |
| 215 | ifeq (,$(TARGET_CPU_ABI_LIST)) |
| 216 | ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true) |
| 217 | TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) |
| 218 | else |
| 219 | TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) |
| 220 | endif |
| 221 | endif |
| 222 | |
| 223 | # Strip whitespace from the ABI list string. |
| 224 | TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) |
| 225 | TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) |
| 226 | TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) |
| 227 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 228 | ifneq ($(BUILD_BROKEN_ANDROIDMK_EXPORTS),true) |
| 229 | $(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword) |
| 230 | endif |
| 231 | |
| 232 | ########################################### |
| 233 | # Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK |
| 234 | ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) |
| 235 | TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT) |
| 236 | endif |
| 237 | |
| 238 | ########################################### |
| 239 | # Configure whether we're building the system image |
| 240 | BUILDING_SYSTEM_IMAGE := true |
| 241 | ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),) |
| 242 | ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE |
| 243 | ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE |
| 244 | BUILDING_SYSTEM_IMAGE := |
| 245 | endif |
| 246 | endif |
| 247 | else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false) |
| 248 | BUILDING_SYSTEM_IMAGE := |
| 249 | endif |
| 250 | .KATI_READONLY := BUILDING_SYSTEM_IMAGE |
| 251 | |
| 252 | # Are we building a system_other image |
| 253 | BUILDING_SYSTEM_OTHER_IMAGE := |
| 254 | ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),) |
| 255 | ifdef BUILDING_SYSTEM_IMAGE |
| 256 | ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) |
| 257 | BUILDING_SYSTEM_OTHER_IMAGE := true |
| 258 | endif |
| 259 | endif |
| 260 | else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true) |
| 261 | BUILDING_SYSTEM_OTHER_IMAGE := true |
| 262 | ifndef BUILDING_SYSTEM_IMAGE |
| 263 | $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image) |
| 264 | endif |
| 265 | endif |
| 266 | .KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE |
| 267 | |
| 268 | # Are we building a cache image |
| 269 | BUILDING_CACHE_IMAGE := |
| 270 | ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),) |
| 271 | ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE |
| 272 | BUILDING_CACHE_IMAGE := true |
| 273 | endif |
| 274 | else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true) |
| 275 | BUILDING_CACHE_IMAGE := true |
| 276 | ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE |
| 277 | $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined) |
| 278 | endif |
| 279 | endif |
| 280 | .KATI_READONLY := BUILDING_CACHE_IMAGE |
| 281 | |
| 282 | # TODO: Add BUILDING_BOOT_IMAGE / BUILDING_RECOVERY_IMAGE |
| 283 | # This gets complicated with BOARD_USES_RECOVERY_AS_BOOT, so skipping for now. |
| 284 | |
| 285 | # Are we building a ramdisk image |
| 286 | BUILDING_RAMDISK_IMAGE := true |
| 287 | ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),) |
| 288 | # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true: |
| 289 | # BUILDING_BOOT_IMAGE |
| 290 | # BUILDING_RECOVERY_IMAGE |
| 291 | else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false) |
| 292 | BUILDING_RAMDISK_IMAGE := |
| 293 | endif |
| 294 | .KATI_READONLY := BUILDING_RAMDISK_IMAGE |
| 295 | |
| 296 | # Are we building a userdata image |
| 297 | BUILDING_USERDATA_IMAGE := |
| 298 | ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),) |
| 299 | ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE |
| 300 | BUILDING_USERDATA_IMAGE := true |
| 301 | endif |
| 302 | else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true) |
| 303 | BUILDING_USERDATA_IMAGE := true |
| 304 | endif |
| 305 | .KATI_READONLY := BUILDING_USERDATA_IMAGE |
| 306 | |
| 307 | ########################################### |
| 308 | # Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR |
| 309 | ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) |
| 310 | TARGET_COPY_OUT_VENDOR := system/vendor |
| 311 | else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) |
| 312 | $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) |
| 313 | endif |
| 314 | PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) |
| 315 | |
| 316 | BOARD_USES_VENDORIMAGE := |
| 317 | ifdef BOARD_PREBUILT_VENDORIMAGE |
| 318 | BOARD_USES_VENDORIMAGE := true |
| 319 | endif |
| 320 | ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 321 | BOARD_USES_VENDORIMAGE := true |
| 322 | endif |
| 323 | ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) |
| 324 | BOARD_USES_VENDORIMAGE := true |
| 325 | else ifdef BOARD_USES_VENDORIMAGE |
| 326 | $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) |
| 327 | endif |
| 328 | .KATI_READONLY := BOARD_USES_VENDORIMAGE |
| 329 | |
| 330 | BUILDING_VENDOR_IMAGE := |
| 331 | ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),) |
| 332 | ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 333 | BUILDING_VENDOR_IMAGE := true |
| 334 | endif |
| 335 | else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true) |
| 336 | BUILDING_VENDOR_IMAGE := true |
| 337 | ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 338 | $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined) |
| 339 | endif |
| 340 | endif |
| 341 | ifdef BOARD_PREBUILT_VENDORIMAGE |
| 342 | BUILDING_VENDOR_IMAGE := |
| 343 | endif |
| 344 | .KATI_READONLY := BUILDING_VENDOR_IMAGE |
| 345 | |
| 346 | ########################################### |
| 347 | # Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT |
| 348 | ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) |
| 349 | TARGET_COPY_OUT_PRODUCT := system/product |
| 350 | else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) |
| 351 | $(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) |
| 352 | endif |
| 353 | PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) |
| 354 | |
| 355 | BOARD_USES_PRODUCTIMAGE := |
| 356 | ifdef BOARD_PREBUILT_PRODUCTIMAGE |
| 357 | BOARD_USES_PRODUCTIMAGE := true |
| 358 | endif |
| 359 | ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 360 | BOARD_USES_PRODUCTIMAGE := true |
| 361 | endif |
| 362 | ifeq ($(TARGET_COPY_OUT_PRODUCT),product) |
| 363 | BOARD_USES_PRODUCTIMAGE := true |
| 364 | else ifdef BOARD_USES_PRODUCTIMAGE |
| 365 | $(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image) |
| 366 | endif |
| 367 | .KATI_READONLY := BOARD_USES_PRODUCTIMAGE |
| 368 | |
| 369 | BUILDING_PRODUCT_IMAGE := |
| 370 | ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),) |
| 371 | ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 372 | BUILDING_PRODUCT_IMAGE := true |
| 373 | endif |
| 374 | else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true) |
| 375 | BUILDING_PRODUCT_IMAGE := true |
| 376 | ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 377 | $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined) |
| 378 | endif |
| 379 | endif |
| 380 | ifdef BOARD_PREBUILT_PRODUCTIMAGE |
| 381 | BUILDING_PRODUCT_IMAGE := |
| 382 | endif |
| 383 | .KATI_READONLY := BUILDING_PRODUCT_IMAGE |
| 384 | |
| 385 | ########################################### |
| 386 | # Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT_SERVICES |
| 387 | MERGE_PRODUCT_SERVICES_INTO_PRODUCT := |
| 388 | ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),$(_product_services_path_placeholder)) |
| 389 | TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT) |
| 390 | MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true |
| 391 | else ifeq ($(TARGET_COPY_OUT_PRODUCT),$(TARGET_COPY_OUT_PRODUCT_SERVICES)) |
| 392 | MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true |
| 393 | else ifeq ($(filter product_services system/product_services,$(TARGET_COPY_OUT_PRODUCT_SERVICES)),) |
| 394 | $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services',\ |
| 395 | '$(TARGET_COPY_OUT_PRODUCT)' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.) |
| 396 | endif |
| 397 | .KATI_READONLY := MERGE_PRODUCT_SERVICES_INTO_PRODUCT |
| 398 | PRODUCT_COPY_FILES := $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),$(PRODUCT_COPY_FILES)) |
| 399 | |
| 400 | BOARD_USES_PRODUCT_SERVICESIMAGE := |
| 401 | ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE |
| 402 | BOARD_USES_PRODUCT_SERVICESIMAGE := true |
| 403 | endif |
| 404 | ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE |
| 405 | BOARD_USES_PRODUCT_SERVICESIMAGE := true |
| 406 | endif |
| 407 | ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),product_services) |
| 408 | BOARD_USES_PRODUCT_SERVICESIMAGE := true |
| 409 | else ifdef BOARD_USES_PRODUCT_SERVICESIMAGE |
| 410 | $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be set to 'product_services' to use a product_services image) |
| 411 | endif |
| 412 | |
| 413 | BUILDING_PRODUCT_SERVICES_IMAGE := |
| 414 | ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),) |
| 415 | ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE |
| 416 | BUILDING_PRODUCT_SERVICES_IMAGE := true |
| 417 | endif |
| 418 | else ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),true) |
| 419 | BUILDING_PRODUCT_SERVICES_IMAGE := true |
| 420 | ifndef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE |
| 421 | $(error PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE set to true, but BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE not defined) |
| 422 | endif |
| 423 | endif |
| 424 | ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE |
| 425 | BUILDING_PRODUCT_SERVICES_IMAGE := |
| 426 | endif |
| 427 | .KATI_READONLY := BUILDING_PRODUCT_SERVICES_IMAGE |
| 428 | |
| 429 | ########################################### |
| 430 | # Now we can substitute with the real value of TARGET_COPY_OUT_ODM |
| 431 | ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) |
| 432 | TARGET_COPY_OUT_ODM := vendor/odm |
| 433 | else ifeq ($(filter odm vendor/odm,$(TARGET_COPY_OUT_ODM)),) |
| 434 | $(error TARGET_COPY_OUT_ODM must be either 'odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.) |
| 435 | endif |
| 436 | PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES)) |
| 437 | |
| 438 | BOARD_USES_ODMIMAGE := |
| 439 | ifdef BOARD_PREBUILT_ODMIMAGE |
| 440 | BOARD_USES_ODMIMAGE := true |
| 441 | endif |
| 442 | ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 443 | BOARD_USES_ODMIMAGE := true |
| 444 | endif |
| 445 | ifeq ($(TARGET_COPY_OUT_ODM),odm) |
| 446 | BOARD_USES_ODMIMAGE := true |
| 447 | else ifdef BOARD_USES_ODMIMAGE |
| 448 | $(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image) |
| 449 | endif |
| 450 | |
| 451 | BUILDING_ODM_IMAGE := |
| 452 | ifeq ($(ODM_BUILD_ODM_IMAGE),) |
| 453 | ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 454 | BUILDING_ODM_IMAGE := true |
| 455 | endif |
| 456 | else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true) |
| 457 | BUILDING_ODM_IMAGE := true |
| 458 | ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 459 | $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined) |
| 460 | endif |
| 461 | endif |
| 462 | ifdef BOARD_PREBUILT_ODMIMAGE |
| 463 | BUILDING_ODM_IMAGE := |
| 464 | endif |
| 465 | .KATI_READONLY := BUILDING_ODM_IMAGE |
| 466 | |
| 467 | ########################################### |
| 468 | # Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set. |
| 469 | TARGET_RECOVERY_UPDATER_LIBS ?= |
| 470 | AB_OTA_UPDATER ?= |
| 471 | .KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER |
| 472 | ifeq ($(AB_OTA_UPDATER),true) |
| 473 | ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) |
| 474 | $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER) |
| 475 | endif |
| 476 | endif |
| 477 | |
| 478 | # Check BOARD_VNDK_VERSION |
| 479 | define check_vndk_version |
| 480 | $(eval vndk_path := prebuilts/vndk/v$(1)) \ |
| 481 | $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) |
| 482 | endef |
| 483 | |
| 484 | ifdef BOARD_VNDK_VERSION |
| 485 | ifneq ($(BOARD_VNDK_VERSION),current) |
| 486 | $(error BOARD_VNDK_VERSION: Only "current" is implemented) |
| 487 | endif |
| 488 | |
| 489 | TARGET_VENDOR_TEST_SUFFIX := /vendor |
| 490 | else |
| 491 | TARGET_VENDOR_TEST_SUFFIX := |
| 492 | endif |
| 493 | |
| 494 | ifeq (,$(TARGET_BUILD_APPS)) |
| 495 | ifdef PRODUCT_EXTRA_VNDK_VERSIONS |
| 496 | $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) |
| 497 | endif |
| 498 | endif |
| 499 | |
| 500 | # Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS |
| 501 | _unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) |
| 502 | ifneq (,$(_unsupported_systemsdk_versions)) |
| 503 | $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ |
| 504 | Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) |
| 505 | endif |