Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f926990b authored by Dima Zavin's avatar Dima Zavin
Browse files

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: default avatarDima Zavin <dima@android.com>
parent 59c2136e
Loading
Loading
Loading
Loading
+14 −8
Original line number Original line Diff line number Diff line
@@ -159,19 +159,24 @@ board_config_mk :=
# etc.
# etc.
TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
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
# also allow the board config to provide additional directories since
# there could be device/oem/base_hw and device/oem/derived_hw
# 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
# that both are valid devices but derived_hw needs to use kernel headers
# from base_hw.
# from base_hw.
TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
_bad_kernel_hdr_dirs := \
$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS))
	$(foreach hdr_dir,$(TARGET_BOARD_KERNEL_HEADERS),\

		$(filter-out kernel-headers,$(notdir $(hdr_dir))))
# then add product-inherited includes, to allow for
ifneq ($(words $(_bad_kernel_hdr_dirs)),0)
# hardware/sivendor/chip/chip.mk to include their own headers
  $(error Board kernel header dirs must be end in kernel-headers: $(TARGET_BOARD_KERNEL_HEADERS))
TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)))
endif
TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS))
_bad_kernel_hdr_dirs :=
$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))


# Clean up/verify variables defined by the board config file.
# Clean up/verify variables defined by the board config file.
TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
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)
HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_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
# 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
# sure to only specify them for the target compilers checked in to
+4 −0
Original line number Original line Diff line number Diff line
@@ -86,6 +86,7 @@ _product_var_list := \
    PRODUCT_DEFAULT_DEV_CERTIFICATE \
    PRODUCT_DEFAULT_DEV_CERTIFICATE \
    PRODUCT_RESTRICT_VENDOR_FILES \
    PRODUCT_RESTRICT_VENDOR_FILES \
    PRODUCT_FACTORY_RAMDISK_MODULES \
    PRODUCT_FACTORY_RAMDISK_MODULES \
    PRODUCT_VENDOR_KERNEL_HEADERS \




define dump-product
define dump-product
@@ -201,6 +202,9 @@ _product_stash_var_list := $(_product_var_list) \
	TARGET_ARCH_VARIANT \
	TARGET_ARCH_VARIANT \
	TARGET_BOARD_PLATFORM \
	TARGET_BOARD_PLATFORM \
	TARGET_BOARD_PLATFORM_GPU \
	TARGET_BOARD_PLATFORM_GPU \
	TARGET_BOARD_KERNEL_HEADERS \
	TARGET_DEVICE_KERNEL_HEADERS \
	TARGET_PRODUCT_KERNEL_HEADERS \
	TARGET_BOOTLOADER_BOARD_NAME \
	TARGET_BOOTLOADER_BOARD_NAME \
	TARGET_COMPRESS_MODULE_SYMBOLS \
	TARGET_COMPRESS_MODULE_SYMBOLS \
	TARGET_NO_BOOTLOADER \
	TARGET_NO_BOOTLOADER \
+4 −0
Original line number Original line Diff line number Diff line
@@ -306,6 +306,10 @@ DEVICE_PACKAGE_OVERLAYS := \
# An list of whitespace-separated words.
# An list of whitespace-separated words.
PRODUCT_TAGS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_TAGS))
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.
# Add the product-defined properties to the build properties.
ADDITIONAL_BUILD_PROPERTIES := \
ADDITIONAL_BUILD_PROPERTIES := \
    $(ADDITIONAL_BUILD_PROPERTIES) \
    $(ADDITIONAL_BUILD_PROPERTIES) \