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