| LOCAL_PATH := $(call my-dir) |
| include $(CLEAR_VARS) |
| |
| LOCAL_MODULE := brcmfmac.ko |
| LOCAL_MDOULE_TAGS := optional |
| LOCAL_MODULE_DEBUG_ENABLE := true |
| LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules |
| LOCAL_MODULE_CLASS := DLKM |
| |
| include $(BUILD_SYSTEM)/base_rules.mk |
| |
| ifeq ($(TARGET_PRODUCT),antares) |
| |
| LOCAL_DIR := device/nest/antares |
| include device/nest/antares/kernel.mk |
| |
| kbuild_kernel_offset_to_root := ../../../../../ |
| kbuild_kernel_image := $(KERNEL_IMAGE) |
| kbuild_kernel_src := $(TARGET_KERNEL_SRC) |
| kbuild_cflags := $(if $(KERNEL_CFLAGS),KCFLAGS=$(strip $(KERNEL_CFLAGS))) |
| kbuild_aflags := $(if $(KERNEL_AFLAGS),KAFLAGS=$(strip $(KERNEL_AFLAGS))) |
| sign_file_path := perl $(kbuild_kernel_src)/scripts/sign-file |
| sign_sec_key := $(KERNEL_OUT)/signing_key.priv |
| sign_pub_key := $(KERNEL_OUT)/signing_key.x509 |
| |
| else ifeq ($(TARGET_PRODUCT),cygnus) |
| |
| KERNEL_DEFCONFIG ?= $(if $(filter $(TARGET_BUILD_VARIANT),user), msmcortex-perf_defconfig, msmcortex_defconfig) |
| include kernel/AndroidKernel.mk |
| |
| kbuild_kernel_offset_to_root := ../ |
| kbuild_kernel_image := $(TARGET_PREBUILT_KERNEL) |
| kbuild_kernel_src := $(TARGET_KERNEL_SOURCE) |
| kbuild_cflags := $(strip $(KERNEL_CFLAGS)) |
| kbuild_aflags := $(strip $(KERNEL_AFLAGS)) |
| sign_file_path := perl $(kbuild_kernel_src)/scripts/sign-file |
| sign_sec_key := $(KERNEL_OUT)/signing_key.priv |
| sign_pub_key := $(KERNEL_OUT)/signing_key.x509 |
| |
| else ifeq ($(TARGET_PRODUCT),iot_cygnus) |
| |
| include device/qcom/msm8x53/AndroidBoard_common.mk |
| include device/google/iot/kernel.mk |
| |
| kbuild_kernel_offset_to_root := ../../../../../ |
| kbuild_kernel_image := $(KERNEL_BIN) |
| kbuild_kernel_src := $(TARGET_KERNEL_SRC) |
| kbuild_cflags := $(if $(KERNEL_CFLAGS),KCFLAGS=$(strip $(KERNEL_CFLAGS))) |
| kbuild_aflags := $(if $(KERNEL_AFLAGS),KAFLAGS=$(strip $(KERNEL_AFLAGS))) |
| sign_file_path := $(KERNEL_OUT)/scripts/sign-file |
| sign_sec_key = $(KERNEL_OUT)/$(shell cat $(KERNEL_OUT)/.config | grep CONFIG_MODULE_SIG_KEY | cut -d'=' -f2 | sed 's/\"//g') |
| sign_pub_key := $(KERNEL_OUT)/certs/signing_key.x509 |
| |
| endif |
| |
| kbuild_defconfig := defconfig-brcmfmac |
| |
| KBUILD_OPTIONS := \ |
| KLIB_BUILD=../../../$(KERNEL_OUT) |
| |
| KBUILD_TARGET := $(strip \ |
| $(subst .,_, \ |
| $(subst -,_, \ |
| $(subst :,_, \ |
| $(subst /,_,$(LOCAL_PATH)))))) |
| |
| # Intermediate directory where the kernel modules are created |
| # by the kernel build system. Ideally this would be the same |
| # directory as LOCAL_BUILT_MODULE, but because we're using |
| # relative paths for both O= and M=, we don't have much choice |
| KBUILD_OUT_DIR := $(KERNEL_OUT)/$(kbuild_kernel_offset_to_root)$(LOCAL_PATH) |
| |
| # Path to the intermediate location where the kernel build |
| # system creates the kernel module. |
| |
| KBUILD_MODULE := \ |
| $(KBUILD_OUT_DIR)/compat/compat.ko \ |
| $(KBUILD_OUT_DIR)/net/wireless/cfg80211.ko \ |
| $(KBUILD_OUT_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko \ |
| $(KBUILD_OUT_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/$(LOCAL_MODULE) |
| |
| # Since we only invoke the kernel build system once per directory, |
| # each kernel module must depend on the same target. |
| $(KBUILD_MODULE): kbuild_out := $(KBUILD_OUT_DIR)/$(LOCAL_MODULE_KBUILD_NAME) |
| $(KBUILD_MODULE): $(KBUILD_TARGET) | $(ACP) |
| ifneq "$(LOCAL_MODULE_KBUILD_NAME)" "" |
| mv -f $(kbuild_out) $@ |
| endif |
| ifneq "$(LOCAL_MODULE_DEBUG_ENABLE)" "" |
| mkdir -p $(dir $(TARGET_OUT_INTERMEDIATES)/DLKM/$(notdir $@)_intermediates/$(notdir $@)) |
| cp $@ $@.unstripped |
| $(TARGET_STRIP) --strip-debug $@ |
| cp $@ $@.stripped |
| endif |
| @sh -c "\ |
| KMOD_SIG_ALL=`cat $(KERNEL_OUT)/.config | grep CONFIG_MODULE_SIG_ALL | cut -d'=' -f2`; \ |
| KMOD_SIG_HASH=`cat $(KERNEL_OUT)/.config | grep CONFIG_MODULE_SIG_HASH | cut -d'=' -f2 | sed 's/\"//g'`; \ |
| if [ \"\$$KMOD_SIG_ALL\" = \"y\" ] && [ -n \"\$$KMOD_SIG_HASH\" ]; then \ |
| echo \"Signing kernel module: \" `basename $@`; \ |
| MODSECKEY=$(sign_sec_key); \ |
| MODPUBKEY=$(sign_pub_key); \ |
| cp $@ $@.unsigned; \ |
| $(sign_file_path) \$$KMOD_SIG_HASH \$$MODSECKEY \$$MODPUBKEY $@; \ |
| fi; \ |
| " |
| cp $@ $(TARGET_OUT_INTERMEDIATES)/DLKM/$(notdir $@)_intermediates/$(notdir $@) |
| |
| $(LOCAL_BUILT_MODULE): $(KBUILD_MODULE) |
| |
| # This should really be cleared in build/core/clear-vars.mk, but for |
| # the time being, we need to clear it ourselves |
| LOCAL_MODULE_KBUILD_NAME := |
| LOCAL_MODULE_DEBUG_ENABLE := |
| |
| # Ensure the kernel module created by the kernel build system, as |
| # well as all the other intermediate files, are removed during a clean. |
| $(cleantarget): PRIVATE_CLEAN_FILES := $(PRIVATE_CLEAN_FILES) $(KBUILD_OUT_DIR) |
| |
| |
| # Since this file will be included more than once for directories |
| # with more than one kernel module, the shared KBUILD_TARGET rule should |
| # only be defined once to avoid "overriding commands ..." warnings. |
| ifndef $(KBUILD_TARGET)_RULE |
| $(KBUILD_TARGET)_RULE := 1 |
| |
| # Kernel modules have to be built after: |
| # * the kernel config has been created |
| # * host executables, like scripts/basic/fixdep, have been built |
| # (otherwise parallel invocations of the kernel build system will |
| # fail as they all try to compile these executables at the same time) |
| # * a full kernel build (to make module versioning work) |
| # |
| # For these reasons, kernel modules are dependent on |
| # TARGET_PREBUILT_INT_KERNEL which will ensure all of the above. |
| # |
| # NOTE: Due to a bug in the kernel build system when using a Kbuild file |
| # and relative paths for both O= and M=, the Kbuild file must |
| # be copied to the output directory. |
| # |
| # NOTE: The following paths are equivalent: |
| # $(KBUILD_OUT_DIR) |
| # $(KERNEL_OUT)/$(kbuild_kernel_offset_to_root)$(LOCAL_PATH) |
| .PHONY: $(KBUILD_TARGET) |
| $(KBUILD_TARGET): local_path := $(LOCAL_PATH) |
| $(KBUILD_TARGET): kbuild_out_dir := $(KBUILD_OUT_DIR) |
| $(KBUILD_TARGET): kbuild_options := $(KBUILD_OPTIONS) |
| $(KBUILD_TARGET): $(kbuild_kernel_image) |
| @mkdir -p $(kbuild_out_dir) |
| $(MAKE) -C $(local_path) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(kbuild_cflags) $(kbuild_aflags) $(kbuild_options) $(kbuild_defconfig) |
| $(MAKE) -C $(local_path) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(kbuild_cflags) $(kbuild_aflags) $(kbuild_options) backport-include/backport/autoconf.h |
| $(MAKE) -C $(kbuild_kernel_src) M=$(kbuild_kernel_offset_to_root)$(local_path) O=$(kbuild_kernel_offset_to_root)$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(kbuild_cflags) $(kbuild_aflags) $(kbuild_options) BACKPORT_DIR=$(shell pwd)/$(local_path) ANDROID_BUILD=y modules |
| |
| endif |
| |
| # Once the KBUILD_OPTIONS variable has been used for the target |
| # that's specific to the LOCAL_PATH, clear it. If this isn't done, |
| # then every kernel module would need to explicitly set KBUILD_OPTIONS, |
| # or the variable would have to be cleared in 'include $(CLEAR_VARS)' |
| # which would require a change to build/core. |
| KBUILD_OPTIONS := |
| |
| include $(CLEAR_VARS) |
| LOCAL_MODULE := brcmutil.ko |
| LOCAL_MDOULE_TAGS := optional |
| LOCAL_MODULE_DEBUG_ENABLE := true |
| LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules |
| LOCAL_MODULE_CLASS := DLKM |
| include $(BUILD_SYSTEM)/base_rules.mk |
| $(LOCAL_BUILT_MODULE) : $(TARGET_OUT_INTERMEDIATES)/DLKM/brcmfmac.ko_intermediates/brcmfmac.ko |
| |
| include $(CLEAR_VARS) |
| LOCAL_MODULE := compat.ko |
| LOCAL_MDOULE_TAGS := optional |
| LOCAL_MODULE_DEBUG_ENABLE := true |
| LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules |
| LOCAL_MODULE_CLASS := DLKM |
| LOCAL_ADDITIONAL_DEPENDENCIES := brcmfmac.ko |
| include $(BUILD_SYSTEM)/base_rules.mk |
| $(LOCAL_BUILT_MODULE) : $(TARGET_OUT_INTERMEDIATES)/DLKM/brcmfmac.ko_intermediates/brcmfmac.ko |
| |
| include $(CLEAR_VARS) |
| LOCAL_MODULE := cfg80211.ko |
| LOCAL_MDOULE_TAGS := optional |
| LOCAL_MODULE_DEBUG_ENABLE := true |
| LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules |
| LOCAL_MODULE_CLASS := DLKM |
| LOCAL_ADDITIONAL_DEPENDENCIES := brcmfmac.ko |
| include $(BUILD_SYSTEM)/base_rules.mk |
| $(LOCAL_BUILT_MODULE) : $(TARGET_OUT_INTERMEDIATES)/DLKM/brcmfmac.ko_intermediates/brcmfmac.ko |