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