core: allow product to provide kernel headers as well

This is useful when a device inherits from an architecture
product, such as omap4.mk. The architecture specific product
can provide kernel headers to all the devices that use
that architecture.

Change-Id: I0c9d3120a6089fb535a3fa8eccf10775a271cd21
Signed-off-by: Dima Zavin <dima@android.com>
This commit is contained in:
Dima Zavin 2012-03-16 09:57:11 -07:00
parent 59c2136e1b
commit f926990ba3
3 changed files with 22 additions and 8 deletions

View File

@ -159,19 +159,24 @@ board_config_mk :=
# etc.
TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
define validate-kernel-headers
$(if $(firstword $(foreach hdr_dir,$(1),\
$(filter-out kernel-headers,$(notdir $(hdr_dir))))),\
$(error Kernel header dirs must be end in kernel-headers: $(1)))
endef
# also allow the board config to provide additional directories since
# there could be device/oem/base_hw and device/oem/derived_hw
# that both are valid devices but derived_hw needs to use kernel headers
# from base_hw.
TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
_bad_kernel_hdr_dirs := \
$(foreach hdr_dir,$(TARGET_BOARD_KERNEL_HEADERS),\
$(filter-out kernel-headers,$(notdir $(hdr_dir))))
ifneq ($(words $(_bad_kernel_hdr_dirs)),0)
$(error Board kernel header dirs must be end in kernel-headers: $(TARGET_BOARD_KERNEL_HEADERS))
endif
_bad_kernel_hdr_dirs :=
$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS))
# then add product-inherited includes, to allow for
# hardware/sivendor/chip/chip.mk to include their own headers
TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)))
TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS))
$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))
# Clean up/verify variables defined by the board config file.
TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
@ -353,7 +358,8 @@ TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS)
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
$(TARGET_PRODUCT_KERNEL_HEADERS)
# Many host compilers don't support these flags, so we have to make
# sure to only specify them for the target compilers checked in to

View File

@ -86,6 +86,7 @@ _product_var_list := \
PRODUCT_DEFAULT_DEV_CERTIFICATE \
PRODUCT_RESTRICT_VENDOR_FILES \
PRODUCT_FACTORY_RAMDISK_MODULES \
PRODUCT_VENDOR_KERNEL_HEADERS \
define dump-product
@ -201,6 +202,9 @@ _product_stash_var_list := $(_product_var_list) \
TARGET_ARCH_VARIANT \
TARGET_BOARD_PLATFORM \
TARGET_BOARD_PLATFORM_GPU \
TARGET_BOARD_KERNEL_HEADERS \
TARGET_DEVICE_KERNEL_HEADERS \
TARGET_PRODUCT_KERNEL_HEADERS \
TARGET_BOOTLOADER_BOARD_NAME \
TARGET_COMPRESS_MODULE_SYMBOLS \
TARGET_NO_BOOTLOADER \

View File

@ -306,6 +306,10 @@ DEVICE_PACKAGE_OVERLAYS := \
# An list of whitespace-separated words.
PRODUCT_TAGS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_TAGS))
# The list of product-specific kernel header dirs
PRODUCT_VENDOR_KERNEL_HEADERS := \
$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_KERNEL_HEADERS)
# Add the product-defined properties to the build properties.
ADDITIONAL_BUILD_PROPERTIES := \
$(ADDITIONAL_BUILD_PROPERTIES) \