blob: 4602cf9b787c1c3c0272d1eafb6bdf3a32a1c329 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001# Android makefile for the WLAN Module
2
3# Assume no targets will be supported
4WLAN_CHIPSET :=
5
6ifeq ($(BOARD_HAS_QCOM_WLAN), true)
7
Yue Ma1e382ff2016-04-21 12:04:26 -07008# Check if this driver needs be built for current target
9ifneq ($(findstring qca_cld3,$(WIFI_DRIVER_BUILT)),)
Satish Singhfbb9b372015-11-25 19:57:38 -080010 WLAN_CHIPSET := qca_cld3
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080011 WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
Yue Ma1e382ff2016-04-21 12:04:26 -070012endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080013
14# Build/Package only in case of supported target
15ifneq ($(WLAN_CHIPSET),)
16
Yue Ma1e382ff2016-04-21 12:04:26 -070017# If kernel version is not defined, using default kernel path, otherwise
18# kernel path offset should come from top level Android makefiles.
Yue Madecd7af2016-03-21 16:45:05 -070019ifeq ($(TARGET_KERNEL_VERSION),)
Yue Ma1e382ff2016-04-21 12:04:26 -070020$(info "$(WLAN_CHIPSET): TARGET_KERNEL_VERSION not defined, assuming default")
Yue Madecd7af2016-03-21 16:45:05 -070021TARGET_KERNEL_SOURCE := kernel
22KERNEL_TO_BUILD_ROOT_OFFSET := ../
23endif
24
Yue Ma1e382ff2016-04-21 12:04:26 -070025# If kernel path offset is not defined, assume old kernel structure
26ifeq ($(KERNEL_TO_BUILD_ROOT_OFFSET),)
27$(info "$(WLAN_CHIPSET): KERNEL_TO_BUILD_ROOT_OFFSET not defined, assuming default")
28KERNEL_TO_BUILD_ROOT_OFFSET := ../
29endif
30
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080031LOCAL_PATH := $(call my-dir)
32
33# This makefile is only for DLKM
34ifneq ($(findstring vendor,$(LOCAL_PATH)),)
35
36ifneq ($(findstring opensource,$(LOCAL_PATH)),)
Yue Ma1e382ff2016-04-21 12:04:26 -070037 WLAN_BLD_DIR := vendor/qcom/opensource/wlan
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080038endif # opensource
39
40# DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
41ifeq ($(call is-platform-sdk-version-at-least,16),true)
Yue Ma1e382ff2016-04-21 12:04:26 -070042 DLKM_DIR := $(TOP)/device/qcom/common/dlkm
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080043else
Yue Ma1e382ff2016-04-21 12:04:26 -070044 DLKM_DIR := build/dlkm
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080045endif # platform-sdk-version
46
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080047# Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
48###########################################################
49# This is set once per LOCAL_PATH, not per (kernel) module
Yue Madecd7af2016-03-21 16:45:05 -070050KBUILD_OPTIONS := WLAN_ROOT=$(KERNEL_TO_BUILD_ROOT_OFFSET)$(WLAN_BLD_DIR)/qcacld-3.0
Yue Ma188f59a2016-04-20 12:46:03 -070051KBUILD_OPTIONS += WLAN_COMMON_ROOT=../qca-wifi-host-cmn
52KBUILD_OPTIONS += WLAN_COMMON_INC=$(KERNEL_TO_BUILD_ROOT_OFFSET)$(WLAN_BLD_DIR)/qca-wifi-host-cmn
Prakash Dhavali08abad62016-04-11 23:41:47 -070053
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080054# We are actually building wlan.ko here, as per the
55# requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
56# This means we need to rename the module to <chipset>_wlan.ko
57# after wlan.ko is built.
58KBUILD_OPTIONS += MODNAME=wlan
59KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
60KBUILD_OPTIONS += $(WLAN_SELECT)
61
62include $(CLEAR_VARS)
Prakash Dhavali08abad62016-04-11 23:41:47 -070063LOCAL_MODULE := $(WLAN_CHIPSET)_wlan.ko
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080064LOCAL_MODULE_KBUILD_NAME := wlan.ko
65LOCAL_MODULE_TAGS := debug
66LOCAL_MODULE_DEBUG_ENABLE := true
67LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules/$(WLAN_CHIPSET)
68include $(DLKM_DIR)/AndroidKernelModule.mk
69###########################################################
70
71# Create Symbolic link
Yue Ma1e382ff2016-04-21 12:04:26 -070072ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
73$(shell mkdir -p $(TARGET_OUT)/lib/modules; \
74 ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/wlan.ko)
75endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080076$(shell ln -sf /persist/wlan_mac.bin $(TARGET_OUT_ETC)/firmware/wlan/qca_cld/wlan_mac.bin)
77
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080078endif # DLKM check
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080079endif # supported target check
80endif # WLAN enabled check