blob: c06f690c0edfc4e8c20011ba5715337e5d4a5b6c [file] [log] [blame]
Smita Ghosh56a9bf72019-09-11 19:48:14 -07001ENABLE_QCACLD := true
2ifeq ($(TARGET_USES_QMAA), true)
3ifneq ($(TARGET_USES_QMAA_OVERRIDE_WLAN), true)
4ENABLE_QCACLD := false
5else
6ENABLE_QCACLD := true
7endif
8endif
9
10ifeq ($(ENABLE_QCACLD), true)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011# Android makefile for the WLAN Module
Yu Wang6c4599c2018-10-09 10:18:14 +080012LOCAL_PATH := $(call my-dir)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013
14# Assume no targets will be supported
15WLAN_CHIPSET :=
16
17ifeq ($(BOARD_HAS_QCOM_WLAN), true)
18
Yue Ma1e382ff2016-04-21 12:04:26 -070019# Check if this driver needs be built for current target
20ifneq ($(findstring qca_cld3,$(WIFI_DRIVER_BUILT)),)
Satish Singhfbb9b372015-11-25 19:57:38 -080021 WLAN_CHIPSET := qca_cld3
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080022 WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
Yue Ma1e382ff2016-04-21 12:04:26 -070023endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080024
25# Build/Package only in case of supported target
26ifneq ($(WLAN_CHIPSET),)
27
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080028# This makefile is only for DLKM
29ifneq ($(findstring vendor,$(LOCAL_PATH)),)
30
31ifneq ($(findstring opensource,$(LOCAL_PATH)),)
Yuanyuan Liu49948f12018-10-16 12:42:28 -070032 WLAN_BLD_DIR := vendor/qcom/opensource/wlan
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080033endif # opensource
34
Yu Wang6c4599c2018-10-09 10:18:14 +080035# Multi-ko check
Yu Wang8cf2c242019-09-04 20:09:06 +080036LOCAL_DEV_NAME := $(patsubst .%,%,\
37 $(lastword $(strip $(subst /, ,$(LOCAL_PATH)))))
Yu Wang6c4599c2018-10-09 10:18:14 +080038
39ifeq (1, $(strip $(shell expr $(words $(strip $(TARGET_WLAN_CHIP))) \>= 2)))
Yu Wang7d866f62019-03-13 17:55:44 +080040
41ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
Yu Wang6c4599c2018-10-09 10:18:14 +080042LOCAL_MULTI_KO := true
43else
44LOCAL_MULTI_KO := false
45endif
Yu Wang7d866f62019-03-13 17:55:44 +080046
Yu Wang6c4599c2018-10-09 10:18:14 +080047endif
48
49ifeq ($(LOCAL_MULTI_KO), true)
50LOCAL_ANDROID_ROOT := $(shell pwd)
51LOCAL_WLAN_BLD_DIR := $(LOCAL_ANDROID_ROOT)/$(WLAN_BLD_DIR)
Yu Wang8cf2c242019-09-04 20:09:06 +080052$(shell find $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/ -maxdepth 1 \
53 -name '.*' ! -name '.git' -exec rm -rf {} +)
Yu Wang6c4599c2018-10-09 10:18:14 +080054
55$(foreach chip, $(TARGET_WLAN_CHIP), \
Yu Wang8cf2c242019-09-04 20:09:06 +080056 $($(shell mkdir -p $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip); \
Yu Wang6c4599c2018-10-09 10:18:14 +080057 ln -sf $(LOCAL_WLAN_BLD_DIR)/qca-wifi-host-cmn \
Yu Wang8cf2c242019-09-04 20:09:06 +080058 $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip)/qca-wifi-host-cmn); \
Yu Wang6c4599c2018-10-09 10:18:14 +080059 $(foreach node, \
60 $(shell find $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/ -maxdepth 1 \
Yu Wang8cf2c242019-09-04 20:09:06 +080061 ! -name '.*' ! -name '*~' \
Yu Wang6c4599c2018-10-09 10:18:14 +080062 ! -name '.' ! -name 'qcacld-3.0'), \
63 $(shell ln -sf $(node) \
Yu Wang8cf2c242019-09-04 20:09:06 +080064 $(LOCAL_WLAN_BLD_DIR)/qcacld-3.0/.$(chip)/$(lastword $(strip $(subst /, ,$(node)))) \
Yu Wang6c4599c2018-10-09 10:18:14 +080065 ))))
66
Yu Wang8cf2c242019-09-04 20:09:06 +080067include $(foreach chip, $(TARGET_WLAN_CHIP), $(LOCAL_PATH)/.$(chip)/Android.mk)
Yu Wang6c4599c2018-10-09 10:18:14 +080068
69else # Multi-ok check
70
Yu Wang7d866f62019-03-13 17:55:44 +080071ifeq ($(LOCAL_DEV_NAME), qcacld-3.0)
72
73LOCAL_DEV_NAME := wlan
Yu Wang6c4599c2018-10-09 10:18:14 +080074LOCAL_MOD_NAME := wlan
75CMN_OFFSET := ..
76LOCAL_SRC_DIR :=
77WLAN_PROFILE := default
78TARGET_FW_DIR := firmware/wlan/qca_cld
79TARGET_CFG_PATH := /vendor/etc/wifi
80TARGET_MAC_BIN_PATH := /mnt/vendor/persist
Yu Wang7d866f62019-03-13 17:55:44 +080081
Yu Wang6c4599c2018-10-09 10:18:14 +080082else
Yu Wang7d866f62019-03-13 17:55:44 +080083
Yu Wang8cf2c242019-09-04 20:09:06 +080084LOCAL_SRC_DIR := .$(LOCAL_DEV_NAME)
Yu Wang6c4599c2018-10-09 10:18:14 +080085CMN_OFFSET := .
Yu Wang7d866f62019-03-13 17:55:44 +080086WLAN_PROFILE := $(LOCAL_DEV_NAME)
87TARGET_FW_DIR := firmware/wlan/qca_cld/$(LOCAL_DEV_NAME)
88TARGET_CFG_PATH := /vendor/etc/wifi/$(LOCAL_DEV_NAME)
89TARGET_MAC_BIN_PATH := /mnt/vendor/persist/$(LOCAL_DEV_NAME)
90
91ifneq ($(TARGET_MULTI_WLAN), true)
92LOCAL_MOD_NAME := wlan
93DYNAMIC_SINGLE_CHIP := $(LOCAL_DEV_NAME)
94else
95LOCAL_MOD_NAME := $(LOCAL_DEV_NAME)
96endif
97
Yu Wang6c4599c2018-10-09 10:18:14 +080098endif
99
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800100# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
101ifeq ($(call is-platform-sdk-version-at-least,16),true)
Yue Ma1e382ff2016-04-21 12:04:26 -0700102 DLKM_DIR := $(TOP)/device/qcom/common/dlkm
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800103else
Yue Ma1e382ff2016-04-21 12:04:26 -0700104 DLKM_DIR := build/dlkm
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800105endif # platform-sdk-version
106
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800107# Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
108###########################################################
109# This is set once per LOCAL_PATH, not per (kernel) module
Yu Wang6c4599c2018-10-09 10:18:14 +0800110KBUILD_OPTIONS := WLAN_ROOT=$(WLAN_BLD_DIR)/qcacld-3.0/$(LOCAL_SRC_DIR)
111KBUILD_OPTIONS += WLAN_COMMON_ROOT=$(CMN_OFFSET)/qca-wifi-host-cmn
Sameer Thalappilba309e12017-04-04 16:18:59 -0700112KBUILD_OPTIONS += WLAN_COMMON_INC=$(WLAN_BLD_DIR)/qca-wifi-host-cmn
Yu Wang6c4599c2018-10-09 10:18:14 +0800113KBUILD_OPTIONS += WLAN_FW_API=$(WLAN_BLD_DIR)/fw-api
114KBUILD_OPTIONS += WLAN_PROFILE=$(WLAN_PROFILE)
Yu Wang7d866f62019-03-13 17:55:44 +0800115KBUILD_OPTIONS += DYNAMIC_SINGLE_CHIP=$(DYNAMIC_SINGLE_CHIP)
Prakash Dhavali08abad62016-04-11 23:41:47 -0700116
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800117# We are actually building wlan.ko here, as per the
118# requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
119# This means we need to rename the module to <chipset>_wlan.ko
120# after wlan.ko is built.
Yu Wang6c4599c2018-10-09 10:18:14 +0800121KBUILD_OPTIONS += MODNAME=$(LOCAL_MOD_NAME)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
123KBUILD_OPTIONS += $(WLAN_SELECT)
124
Yu Wangbaff8002019-08-08 19:48:16 +0800125ifneq ($(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME)),)
126KBUILD_OPTIONS += WLAN_CFG_OVERRIDE="$(WLAN_CFG_OVERRIDE_$(LOCAL_DEV_NAME))"
127endif
128
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800129include $(CLEAR_VARS)
Yu Wang7d866f62019-03-13 17:55:44 +0800130LOCAL_MODULE := $(WLAN_CHIPSET)_$(LOCAL_DEV_NAME).ko
Yu Wang6c4599c2018-10-09 10:18:14 +0800131LOCAL_MODULE_KBUILD_NAME := $(LOCAL_MOD_NAME).ko
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800132LOCAL_MODULE_DEBUG_ENABLE := true
Sameer Thalappil64271512017-07-12 16:36:04 -0700133ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
134 ifeq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),true)
135 LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
136 else
Sameer Thalappilb4d7b212017-07-18 09:07:09 -0700137 LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)
Sameer Thalappil64271512017-07-12 16:36:04 -0700138 endif
139else
140 LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
141endif
142
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800143include $(DLKM_DIR)/AndroidKernelModule.mk
144###########################################################
145
146# Create Symbolic link
Yue Ma1e382ff2016-04-21 12:04:26 -0700147ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
Sameer Thalappil64271512017-07-12 16:36:04 -0700148ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
149ifneq ($(WIFI_DRIVER_INSTALL_TO_KERNEL_OUT),)
150$(shell mkdir -p $(TARGET_OUT_VENDOR)/lib/modules; \
Yu Wang7d866f62019-03-13 17:55:44 +0800151 ln -sf /$(TARGET_COPY_OUT_VENDOR)/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT_VENDOR)/lib/modules/$(LOCAL_MODULE))
Sameer Thalappil64271512017-07-12 16:36:04 -0700152endif
153else
Yue Ma1e382ff2016-04-21 12:04:26 -0700154$(shell mkdir -p $(TARGET_OUT)/lib/modules; \
Yu Wang7d866f62019-03-13 17:55:44 +0800155 ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/$(LOCAL_MODULE))
Yue Ma1e382ff2016-04-21 12:04:26 -0700156endif
Sameer Thalappil64271512017-07-12 16:36:04 -0700157endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800158
Sameer Thalappil64271512017-07-12 16:36:04 -0700159ifeq ($(PRODUCT_VENDOR_MOVE_ENABLED),true)
Yu Wang6c4599c2018-10-09 10:18:14 +0800160TARGET_FW_PATH := $(TARGET_OUT_VENDOR)/$(TARGET_FW_DIR)
Sameer Thalappil64271512017-07-12 16:36:04 -0700161else
Yu Wang6c4599c2018-10-09 10:18:14 +0800162TARGET_FW_PATH := $(TARGET_OUT_ETC)/$(TARGET_FW_DIR)
Sameer Thalappil64271512017-07-12 16:36:04 -0700163endif
Yu Wang6c4599c2018-10-09 10:18:14 +0800164
165$(shell mkdir -p $(TARGET_FW_PATH); \
166 ln -sf $(TARGET_MAC_BIN_PATH)/wlan_mac.bin $(TARGET_FW_PATH)/wlan_mac.bin; \
167 ln -sf $(TARGET_CFG_PATH)/WCNSS_qcom_cfg.ini $(TARGET_FW_PATH)/WCNSS_qcom_cfg.ini)
168
169endif # Multi-ko check
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170endif # DLKM check
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800171endif # supported target check
172endif # WLAN enabled check
Smita Ghosh56a9bf72019-09-11 19:48:14 -0700173endif # ENABLE_QCACLD