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