1# Android Makefile for WLAN platform modules
2
3ENABLE_WLAN_PLATFORM_DLKM := false
4ifeq ($(TARGET_KERNEL_DLKM_DISABLE), true)
5  ifeq ($(TARGET_KERNEL_DLKM_WLAN_OVERRIDE), true)
6    ENABLE_WLAN_PLATFORM_DLKM := true
7  endif
8else
9  ENABLE_WLAN_PLATFORM_DLKM := true
10endif
11
12ifeq ($(ENABLE_WLAN_PLATFORM_DLKM), true)
13
14# LOCAL_PATH is a relative path to root build directory.
15LOCAL_PATH := $(call my-dir)
16LOCAL_MODULE_DDK_BUILD := true
17LOCAL_MODULE_DDK_ALLOW_UNSAFE_HEADERS := true
18LOCAL_MODULE_KO_DIRS := cnss2/cnss2.ko
19LOCAL_MODULE_KO_DIRS += cnss_utils/cnss_plat_ipc_qmi_svc.ko
20LOCAL_MODULE_KO_DIRS += cnss_utils/wlan_firmware_service.ko
21LOCAL_MODULE_KO_DIRS += cnss_genl/cnss_nl.ko
22LOCAL_MODULE_KO_DIRS += cnss_prealloc/cnss_prealloc.ko
23LOCAL_MODULE_KO_DIRS += cnss_utils/cnss_utils.ko
24LOCAL_MODULE_KO_DIRS += icnss2/icnss2.ko
25
26BOARD_COMMON_DIR ?= device/qcom/common
27DLKM_DIR := $(TOP)/$(BOARD_COMMON_DIR)/dlkm
28
29# WLAN_PLATFORM_ROOT needs to be a absolute since it will be used
30# for header files. $(TOP) cannot be used here since it will be
31# resolved as "." which won't work for Kbuild.
32KBUILD_OPTIONS := WLAN_PLATFORM_ROOT=$(abspath $(LOCAL_PATH))
33
34# WLAN_PLATFORM_KBUILD_OPTIONS should be defined from upper level
35# Product or Board related Makefiles like wlan.mk.
36KBUILD_OPTIONS += $(foreach wlan_platform_kbuild_option, \
37		   $(WLAN_PLATFORM_KBUILD_OPTIONS), \
38		   $(wlan_platform_kbuild_option))
39
40# Sourcing all files is for better incremental compilation.
41CNSS_SRC_FILES := \
42	$(wildcard $(LOCAL_PATH)/*) \
43	$(wildcard $(LOCAL_PATH)/*/*) \
44
45ifeq ($(TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE), true)
46KBUILD_OPTIONS += KBUILD_EXTRA_SYMBOLS=$(PWD)/$(call intermediates-dir-for,DLKM,sec-module-symvers)/Module.symvers
47endif
48
49# Module.symvers needs to be generated as a intermediate module so that
50# other modules which depend on WLAN platform modules can set local
51# dependencies to it.
52
53########################### Module.symvers ############################
54include $(CLEAR_VARS)
55LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
56LOCAL_MODULE              := wlan-platform-module-symvers
57LOCAL_MODULE_STEM         := Module.symvers
58LOCAL_MODULE_KBUILD_NAME  := Module.symvers
59LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
60include $(DLKM_DIR)/Build_external_kernelmodule.mk
61
62# Below are for Android build system to recognize each module name, so
63# they can be installed properly. Since Kbuild is used to compile these
64# modules, invoking any of them will cause other modules to be compiled
65# as well if corresponding flags are added in KBUILD_OPTIONS from upper
66# level Makefiles like wlan.mk.
67
68################################ cnss2 ################################
69include $(CLEAR_VARS)
70ifeq ($(TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE), true)
71LOCAL_REQUIRED_MODULES := sec-module-symvers
72LOCAL_ADDITIONAL_DEPENDENCIES += $(call intermediates-dir-for,DLKM,sec-module-symvers)/Module.symvers
73endif #TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE
74LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
75LOCAL_MODULE              := cnss2.ko
76LOCAL_MODULE_KBUILD_NAME  := cnss2/cnss2.ko
77LOCAL_MODULE_TAGS         := optional
78LOCAL_MODULE_DEBUG_ENABLE := true
79LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
80include $(DLKM_DIR)/Build_external_kernelmodule.mk
81######################## cnss_plat_ipc_qmi_svc ########################
82include $(CLEAR_VARS)
83LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
84LOCAL_MODULE              := cnss_plat_ipc_qmi_svc.ko
85LOCAL_MODULE_KBUILD_NAME  := cnss_utils/cnss_plat_ipc_qmi_svc.ko
86LOCAL_MODULE_TAGS         := optional
87LOCAL_MODULE_DEBUG_ENABLE := true
88LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
89include $(DLKM_DIR)/Build_external_kernelmodule.mk
90######################## wlan_firmware_service ########################
91include $(CLEAR_VARS)
92LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
93LOCAL_MODULE              := wlan_firmware_service.ko
94LOCAL_MODULE_KBUILD_NAME  := cnss_utils/wlan_firmware_service.ko
95LOCAL_MODULE_TAGS         := optional
96LOCAL_MODULE_DEBUG_ENABLE := true
97LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
98include $(DLKM_DIR)/Build_external_kernelmodule.mk
99############################### cnss_nl ###############################
100include $(CLEAR_VARS)
101LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
102LOCAL_MODULE              := cnss_nl.ko
103LOCAL_MODULE_KBUILD_NAME  := cnss_genl/cnss_nl.ko
104LOCAL_MODULE_TAGS         := optional
105LOCAL_MODULE_DEBUG_ENABLE := true
106LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
107include $(DLKM_DIR)/Build_external_kernelmodule.mk
108############################ cnss_prealloc ############################
109include $(CLEAR_VARS)
110LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
111LOCAL_MODULE              := cnss_prealloc.ko
112LOCAL_MODULE_KBUILD_NAME  := cnss_prealloc/cnss_prealloc.ko
113LOCAL_MODULE_TAGS         := optional
114LOCAL_MODULE_DEBUG_ENABLE := true
115LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
116include $(DLKM_DIR)/Build_external_kernelmodule.mk
117############################ cnss_utils ###############################
118include $(CLEAR_VARS)
119LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
120LOCAL_MODULE              := cnss_utils.ko
121LOCAL_MODULE_KBUILD_NAME  := cnss_utils/cnss_utils.ko
122LOCAL_MODULE_TAGS         := optional
123LOCAL_MODULE_DEBUG_ENABLE := true
124LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
125include $(DLKM_DIR)/Build_external_kernelmodule.mk
126################################ icnss2 ################################
127include $(CLEAR_VARS)
128LOCAL_SRC_FILES           := $(CNSS_SRC_FILES)
129LOCAL_MODULE              := icnss2.ko
130LOCAL_MODULE_KBUILD_NAME  := icnss2/icnss2.ko
131LOCAL_MODULE_TAGS         := optional
132LOCAL_MODULE_DEBUG_ENABLE := true
133LOCAL_MODULE_PATH         := $(KERNEL_MODULES_OUT)
134include $(DLKM_DIR)/Build_external_kernelmodule.mk
135endif #ENABLE_WLAN_PLATFORM_DLKM
136