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 \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 89 | BUILD_BROKEN_DUP_RULES \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 90 | BUILD_BROKEN_ENG_DEBUG_TAGS \ |
Dan Willemsen | 0586c65 | 2019-04-09 09:56:48 -0700 | [diff] [blame] | 91 | BUILD_BROKEN_USES_NETWORK \ |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 92 | |
Dan Willemsen | 695849e | 2019-04-17 12:25:09 -0700 | [diff] [blame] | 93 | _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 Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 99 | _board_true_false_vars := $(_build_broken_var_list) |
| 100 | _board_strip_readonly_list += $(_build_broken_var_list) |
| 101 | |
Anton Hansson | 74dc00b | 2019-02-27 14:38:27 +0000 | [diff] [blame] | 102 | # Conditional to building on linux, as dex2oat currently does not work on darwin. |
| 103 | ifeq ($(HOST_OS),linux) |
| 104 | WITH_DEXPREOPT := true |
| 105 | endif |
| 106 | |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 107 | # ############################################################### |
| 108 | # Broken build defaults |
| 109 | # ############################################################### |
Dan Willemsen | 0586c65 | 2019-04-09 09:56:48 -0700 | [diff] [blame] | 110 | $(foreach v,$(_build_broken_var_list),$(eval $(v) :=)) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 111 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 112 | # 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. |
| 116 | ifdef 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 |
| 121 | else |
| 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 |
| 136 | endif |
| 137 | include $(board_config_mk) |
| 138 | ifeq ($(TARGET_ARCH),) |
| 139 | $(error TARGET_ARCH not defined by board config: $(board_config_mk)) |
| 140 | endif |
| 141 | ifneq ($(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) |
| 144 | endif |
| 145 | board_config_mk := |
| 146 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 147 | # 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 Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 152 | |
| 153 | # Default *_CPU_VARIANT_RUNTIME to CPU_VARIANT if unspecified. |
| 154 | TARGET_CPU_VARIANT_RUNTIME := $(or $(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_CPU_VARIANT)) |
| 155 | TARGET_2ND_CPU_VARIANT_RUNTIME := $(or $(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_CPU_VARIANT)) |
| 156 | |
Anton Hansson | 1927985 | 2019-02-28 17:15:57 +0000 | [diff] [blame] | 157 | # The combo makefiles sanity-check and set defaults for various CPU configuration |
| 158 | combo_target := TARGET_ |
| 159 | combo_2nd_arch_prefix := |
| 160 | include $(BUILD_SYSTEM)/combo/select.mk |
| 161 | |
| 162 | ifdef TARGET_2ND_ARCH |
| 163 | combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) |
| 164 | include $(BUILD_SYSTEM)/combo/select.mk |
| 165 | endif |
| 166 | |
Anton Hansson | d488d2d | 2019-02-26 15:49:25 +0000 | [diff] [blame] | 167 | .KATI_READONLY := $(_board_strip_readonly_list) |
| 168 | |
| 169 | INTERNAL_KERNEL_CMDLINE := $(BOARD_KERNEL_CMDLINE) |
Anton Hansson | b954469 | 2019-02-26 13:37:28 +0000 | [diff] [blame] | 170 | ifeq ($(TARGET_CPU_ABI),) |
| 171 | $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) |
| 172 | endif |
| 173 | ifneq ($(filter %64,$(TARGET_ARCH)),) |
| 174 | TARGET_IS_64_BIT := true |
| 175 | endif |
| 176 | |
| 177 | ifeq (,$(filter true,$(TARGET_SUPPORTS_32_BIT_APPS) $(TARGET_SUPPORTS_64_BIT_APPS))) |
| 178 | TARGET_SUPPORTS_32_BIT_APPS := true |
| 179 | endif |
| 180 | |
| 181 | # Sanity check to warn about likely cryptic errors later in the build. |
| 182 | ifeq ($(TARGET_IS_64_BIT),true) |
| 183 | ifeq (,$(filter true false,$(TARGET_SUPPORTS_64_BIT_APPS))) |
Anton Hansson | 6d25fc6 | 2019-05-10 15:29:28 +0100 | [diff] [blame^] | 184 | $(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] | 185 | If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false) |
| 186 | endif |
| 187 | endif |
| 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. |
| 198 | ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) |
| 199 | ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) |
| 200 | TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) |
| 201 | endif |
| 202 | endif |
| 203 | |
| 204 | ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) |
| 205 | ifneq (true,$(TARGET_IS_64_BIT)) |
| 206 | TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) |
| 207 | else |
| 208 | ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) |
| 209 | # For a 64 bit target, assume that the 2ND_CPU_ABI |
| 210 | # is a 32 bit ABI. |
| 211 | TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) |
| 212 | endif |
| 213 | endif |
| 214 | endif |
| 215 | |
| 216 | # "ro.product.cpu.abilist" is a comma separated list of ABIs (in order |
| 217 | # of preference) that the target supports. If a TARGET_CPU_ABI_LIST |
| 218 | # is specified by the board configuration, we use that. If not, we |
| 219 | # build a list out of the TARGET_CPU_ABIs specified by the config. |
| 220 | ifeq (,$(TARGET_CPU_ABI_LIST)) |
| 221 | ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true) |
| 222 | TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) |
| 223 | else |
| 224 | TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) |
| 225 | endif |
| 226 | endif |
| 227 | |
| 228 | # Strip whitespace from the ABI list string. |
| 229 | TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) |
| 230 | TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) |
| 231 | TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) |
| 232 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 233 | ifneq ($(BUILD_BROKEN_ANDROIDMK_EXPORTS),true) |
| 234 | $(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword) |
| 235 | endif |
| 236 | |
| 237 | ########################################### |
| 238 | # Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK |
| 239 | ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) |
| 240 | TARGET_COPY_OUT_RAMDISK := $(TARGET_COPY_OUT_ROOT) |
| 241 | endif |
| 242 | |
| 243 | ########################################### |
Bowgo Tsai | 0013f55 | 2019-03-20 17:59:52 +0800 | [diff] [blame] | 244 | # Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK |
| 245 | ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) |
| 246 | TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk |
| 247 | endif |
| 248 | |
| 249 | ########################################### |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 250 | # Configure whether we're building the system image |
| 251 | BUILDING_SYSTEM_IMAGE := true |
| 252 | ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),) |
| 253 | ifndef PRODUCT_USE_DYNAMIC_PARTITION_SIZE |
| 254 | ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE |
| 255 | BUILDING_SYSTEM_IMAGE := |
| 256 | endif |
| 257 | endif |
| 258 | else ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),false) |
| 259 | BUILDING_SYSTEM_IMAGE := |
| 260 | endif |
| 261 | .KATI_READONLY := BUILDING_SYSTEM_IMAGE |
| 262 | |
| 263 | # Are we building a system_other image |
| 264 | BUILDING_SYSTEM_OTHER_IMAGE := |
| 265 | ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),) |
| 266 | ifdef BUILDING_SYSTEM_IMAGE |
| 267 | ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) |
| 268 | BUILDING_SYSTEM_OTHER_IMAGE := true |
| 269 | endif |
| 270 | endif |
| 271 | else ifeq ($(PRODUCT_BUILD_SYSTEM_OTHER_IMAGE),true) |
| 272 | BUILDING_SYSTEM_OTHER_IMAGE := true |
| 273 | ifndef BUILDING_SYSTEM_IMAGE |
| 274 | $(error PRODUCT_BUILD_SYSTEM_OTHER_IMAGE = true requires building the system image) |
| 275 | endif |
| 276 | endif |
| 277 | .KATI_READONLY := BUILDING_SYSTEM_OTHER_IMAGE |
| 278 | |
| 279 | # Are we building a cache image |
| 280 | BUILDING_CACHE_IMAGE := |
| 281 | ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),) |
| 282 | ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE |
| 283 | BUILDING_CACHE_IMAGE := true |
| 284 | endif |
| 285 | else ifeq ($(PRODUCT_BUILD_CACHE_IMAGE),true) |
| 286 | BUILDING_CACHE_IMAGE := true |
| 287 | ifndef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE |
| 288 | $(error PRODUCT_BUILD_CACHE_IMAGE set to true, but BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE not defined) |
| 289 | endif |
| 290 | endif |
| 291 | .KATI_READONLY := BUILDING_CACHE_IMAGE |
| 292 | |
| 293 | # TODO: Add BUILDING_BOOT_IMAGE / BUILDING_RECOVERY_IMAGE |
| 294 | # This gets complicated with BOARD_USES_RECOVERY_AS_BOOT, so skipping for now. |
| 295 | |
| 296 | # Are we building a ramdisk image |
| 297 | BUILDING_RAMDISK_IMAGE := true |
| 298 | ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),) |
| 299 | # TODO: Be smarter about this. This probably only needs to happen when one of the follow is true: |
| 300 | # BUILDING_BOOT_IMAGE |
| 301 | # BUILDING_RECOVERY_IMAGE |
| 302 | else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false) |
| 303 | BUILDING_RAMDISK_IMAGE := |
| 304 | endif |
| 305 | .KATI_READONLY := BUILDING_RAMDISK_IMAGE |
| 306 | |
| 307 | # Are we building a userdata image |
| 308 | BUILDING_USERDATA_IMAGE := |
| 309 | ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),) |
| 310 | ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE |
| 311 | BUILDING_USERDATA_IMAGE := true |
| 312 | endif |
| 313 | else ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true) |
| 314 | BUILDING_USERDATA_IMAGE := true |
| 315 | endif |
| 316 | .KATI_READONLY := BUILDING_USERDATA_IMAGE |
| 317 | |
| 318 | ########################################### |
| 319 | # Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR |
| 320 | ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) |
| 321 | TARGET_COPY_OUT_VENDOR := system/vendor |
| 322 | else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) |
| 323 | $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) |
| 324 | endif |
| 325 | PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) |
| 326 | |
| 327 | BOARD_USES_VENDORIMAGE := |
| 328 | ifdef BOARD_PREBUILT_VENDORIMAGE |
| 329 | BOARD_USES_VENDORIMAGE := true |
| 330 | endif |
| 331 | ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 332 | BOARD_USES_VENDORIMAGE := true |
| 333 | endif |
| 334 | ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) |
| 335 | BOARD_USES_VENDORIMAGE := true |
| 336 | else ifdef BOARD_USES_VENDORIMAGE |
| 337 | $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) |
| 338 | endif |
| 339 | .KATI_READONLY := BOARD_USES_VENDORIMAGE |
| 340 | |
| 341 | BUILDING_VENDOR_IMAGE := |
| 342 | ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),) |
| 343 | ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 344 | BUILDING_VENDOR_IMAGE := true |
| 345 | endif |
| 346 | else ifeq ($(PRODUCT_BUILD_VENDOR_IMAGE),true) |
| 347 | BUILDING_VENDOR_IMAGE := true |
| 348 | ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE |
| 349 | $(error PRODUCT_BUILD_VENDOR_IMAGE set to true, but BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE not defined) |
| 350 | endif |
| 351 | endif |
| 352 | ifdef BOARD_PREBUILT_VENDORIMAGE |
| 353 | BUILDING_VENDOR_IMAGE := |
| 354 | endif |
| 355 | .KATI_READONLY := BUILDING_VENDOR_IMAGE |
| 356 | |
| 357 | ########################################### |
| 358 | # Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT |
| 359 | ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) |
| 360 | TARGET_COPY_OUT_PRODUCT := system/product |
| 361 | else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) |
| 362 | $(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) |
| 363 | endif |
| 364 | PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) |
| 365 | |
| 366 | BOARD_USES_PRODUCTIMAGE := |
| 367 | ifdef BOARD_PREBUILT_PRODUCTIMAGE |
| 368 | BOARD_USES_PRODUCTIMAGE := true |
| 369 | endif |
| 370 | ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 371 | BOARD_USES_PRODUCTIMAGE := true |
| 372 | endif |
| 373 | ifeq ($(TARGET_COPY_OUT_PRODUCT),product) |
| 374 | BOARD_USES_PRODUCTIMAGE := true |
| 375 | else ifdef BOARD_USES_PRODUCTIMAGE |
| 376 | $(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image) |
| 377 | endif |
| 378 | .KATI_READONLY := BOARD_USES_PRODUCTIMAGE |
| 379 | |
| 380 | BUILDING_PRODUCT_IMAGE := |
| 381 | ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),) |
| 382 | ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 383 | BUILDING_PRODUCT_IMAGE := true |
| 384 | endif |
| 385 | else ifeq ($(PRODUCT_BUILD_PRODUCT_IMAGE),true) |
| 386 | BUILDING_PRODUCT_IMAGE := true |
| 387 | ifndef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE |
| 388 | $(error PRODUCT_BUILD_PRODUCT_IMAGE set to true, but BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE not defined) |
| 389 | endif |
| 390 | endif |
| 391 | ifdef BOARD_PREBUILT_PRODUCTIMAGE |
| 392 | BUILDING_PRODUCT_IMAGE := |
| 393 | endif |
| 394 | .KATI_READONLY := BUILDING_PRODUCT_IMAGE |
| 395 | |
| 396 | ########################################### |
| 397 | # Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT_SERVICES |
| 398 | MERGE_PRODUCT_SERVICES_INTO_PRODUCT := |
| 399 | ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),$(_product_services_path_placeholder)) |
| 400 | TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT) |
| 401 | MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true |
| 402 | else ifeq ($(TARGET_COPY_OUT_PRODUCT),$(TARGET_COPY_OUT_PRODUCT_SERVICES)) |
| 403 | MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true |
| 404 | else ifeq ($(filter product_services system/product_services,$(TARGET_COPY_OUT_PRODUCT_SERVICES)),) |
| 405 | $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services',\ |
| 406 | '$(TARGET_COPY_OUT_PRODUCT)' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.) |
| 407 | endif |
| 408 | .KATI_READONLY := MERGE_PRODUCT_SERVICES_INTO_PRODUCT |
| 409 | PRODUCT_COPY_FILES := $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),$(PRODUCT_COPY_FILES)) |
| 410 | |
| 411 | BOARD_USES_PRODUCT_SERVICESIMAGE := |
| 412 | ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE |
| 413 | BOARD_USES_PRODUCT_SERVICESIMAGE := true |
| 414 | endif |
| 415 | ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE |
| 416 | BOARD_USES_PRODUCT_SERVICESIMAGE := true |
| 417 | endif |
| 418 | ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),product_services) |
| 419 | BOARD_USES_PRODUCT_SERVICESIMAGE := true |
| 420 | else ifdef BOARD_USES_PRODUCT_SERVICESIMAGE |
| 421 | $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be set to 'product_services' to use a product_services image) |
| 422 | endif |
| 423 | |
| 424 | BUILDING_PRODUCT_SERVICES_IMAGE := |
| 425 | ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),) |
| 426 | ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE |
| 427 | BUILDING_PRODUCT_SERVICES_IMAGE := true |
| 428 | endif |
| 429 | else ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),true) |
| 430 | BUILDING_PRODUCT_SERVICES_IMAGE := true |
| 431 | ifndef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE |
| 432 | $(error PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE set to true, but BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE not defined) |
| 433 | endif |
| 434 | endif |
| 435 | ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE |
| 436 | BUILDING_PRODUCT_SERVICES_IMAGE := |
| 437 | endif |
| 438 | .KATI_READONLY := BUILDING_PRODUCT_SERVICES_IMAGE |
| 439 | |
| 440 | ########################################### |
| 441 | # Now we can substitute with the real value of TARGET_COPY_OUT_ODM |
| 442 | ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) |
| 443 | TARGET_COPY_OUT_ODM := vendor/odm |
| 444 | else ifeq ($(filter odm vendor/odm,$(TARGET_COPY_OUT_ODM)),) |
| 445 | $(error TARGET_COPY_OUT_ODM must be either 'odm' or 'vendor/odm', seeing '$(TARGET_COPY_OUT_ODM)'.) |
| 446 | endif |
| 447 | PRODUCT_COPY_FILES := $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),$(PRODUCT_COPY_FILES)) |
| 448 | |
| 449 | BOARD_USES_ODMIMAGE := |
| 450 | ifdef BOARD_PREBUILT_ODMIMAGE |
| 451 | BOARD_USES_ODMIMAGE := true |
| 452 | endif |
| 453 | ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 454 | BOARD_USES_ODMIMAGE := true |
| 455 | endif |
| 456 | ifeq ($(TARGET_COPY_OUT_ODM),odm) |
| 457 | BOARD_USES_ODMIMAGE := true |
| 458 | else ifdef BOARD_USES_ODMIMAGE |
| 459 | $(error TARGET_COPY_OUT_ODM must be set to 'odm' to use an odm image) |
| 460 | endif |
| 461 | |
| 462 | BUILDING_ODM_IMAGE := |
Dan Willemsen | 25a6937 | 2019-04-19 15:00:12 -0700 | [diff] [blame] | 463 | ifeq ($(PRODUCT_BUILD_ODM_IMAGE),) |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 464 | ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 465 | BUILDING_ODM_IMAGE := true |
| 466 | endif |
| 467 | else ifeq ($(PRODUCT_BUILD_ODM_IMAGE),true) |
| 468 | BUILDING_ODM_IMAGE := true |
| 469 | ifndef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE |
| 470 | $(error PRODUCT_BUILD_ODM_IMAGE set to true, but BOARD_ODMIMAGE_FILE_SYSTEM_TYPE not defined) |
| 471 | endif |
| 472 | endif |
| 473 | ifdef BOARD_PREBUILT_ODMIMAGE |
| 474 | BUILDING_ODM_IMAGE := |
| 475 | endif |
| 476 | .KATI_READONLY := BUILDING_ODM_IMAGE |
| 477 | |
| 478 | ########################################### |
| 479 | # Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set. |
| 480 | TARGET_RECOVERY_UPDATER_LIBS ?= |
| 481 | AB_OTA_UPDATER ?= |
| 482 | .KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER |
| 483 | ifeq ($(AB_OTA_UPDATER),true) |
| 484 | ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) |
| 485 | $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER) |
| 486 | endif |
| 487 | endif |
| 488 | |
Tao Bao | 9be20c7 | 2019-04-08 21:11:59 -0700 | [diff] [blame] | 489 | # Sanity check for building generic OTA packages. Currently it only supports A/B OTAs. |
| 490 | ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) |
| 491 | ifneq ($(AB_OTA_UPDATER),true) |
| 492 | $(error PRODUCT_BUILD_GENERIC_OTA_PACKAGE with 'AB_OTA_UPDATER != true' is not supported) |
| 493 | endif |
| 494 | endif |
| 495 | |
Anton Hansson | bb76ce8 | 2019-02-26 12:34:03 +0000 | [diff] [blame] | 496 | # Check BOARD_VNDK_VERSION |
| 497 | define check_vndk_version |
| 498 | $(eval vndk_path := prebuilts/vndk/v$(1)) \ |
| 499 | $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) |
| 500 | endef |
| 501 | |
| 502 | ifdef BOARD_VNDK_VERSION |
| 503 | ifneq ($(BOARD_VNDK_VERSION),current) |
| 504 | $(error BOARD_VNDK_VERSION: Only "current" is implemented) |
| 505 | endif |
| 506 | |
| 507 | TARGET_VENDOR_TEST_SUFFIX := /vendor |
| 508 | else |
| 509 | TARGET_VENDOR_TEST_SUFFIX := |
| 510 | endif |
| 511 | |
| 512 | ifeq (,$(TARGET_BUILD_APPS)) |
| 513 | ifdef PRODUCT_EXTRA_VNDK_VERSIONS |
| 514 | $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) |
| 515 | endif |
| 516 | endif |
| 517 | |
| 518 | # Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS |
| 519 | _unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) |
| 520 | ifneq (,$(_unsupported_systemsdk_versions)) |
| 521 | $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ |
| 522 | Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) |
| 523 | endif |
Dan Willemsen | 695849e | 2019-04-17 12:25:09 -0700 | [diff] [blame] | 524 | |
| 525 | ########################################### |
| 526 | # Handle BUILD_BROKEN_USES_BUILD_* |
| 527 | |
| 528 | $(foreach m,$(DEFAULT_WARNING_BUILD_MODULE_TYPES),\ |
| 529 | $(if $(filter false,$(BUILD_BROKEN_USES_$(m))),\ |
| 530 | $(KATI_obsolete_var $(m),Please convert to Soong),\ |
| 531 | $(KATI_deprecated_var $(m),Please convert to Soong))) |
| 532 | |
| 533 | $(foreach m,$(DEFAULT_ERROR_BUILD_MODULE_TYPES),\ |
| 534 | $(if $(filter true,$(BUILD_BROKEN_USES_$(m))),\ |
| 535 | $(KATI_deprecated_var $(m),Please convert to Soong),\ |
| 536 | $(KATI_obsolete_var $(m),Please convert to Soong))) |