Browse Source

qcacld-3.0: Add new method to build/use driver based on targets

Add the change to build and set WLAN driver as default for different
targets based on target specific flags WIFI_DRIVER_BUILT and
WIFI_DRIVER_DEFAULT.

KERNEL_TO_BUILD_ROOT_OFFSET needs to be set a default value if upper
level makefiles do not define it.

Change-Id: I4768b8c75a5d4042d01c3ddfb67b20c13e42463a
CRs-fixed: 1005069
Yue Ma 9 years ago
parent
commit
1e382ffa9b
1 changed files with 19 additions and 10 deletions
  1. 19 10
      Android.mk

+ 19 - 10
Android.mk

@@ -5,37 +5,43 @@ WLAN_CHIPSET :=
 
 ifeq ($(BOARD_HAS_QCOM_WLAN), true)
 
-# Build/Package options for 8084/8092/8960/8992/8994 target
-ifeq ($(call is-board-platform-in-list, msm8994 msm8996 msm8998 msmcobalt),true)
+# Check if this driver needs be built for current target
+ifneq ($(findstring qca_cld3,$(WIFI_DRIVER_BUILT)),)
 	WLAN_CHIPSET := qca_cld3
 	WLAN_SELECT  := CONFIG_QCA_CLD_WLAN=m
-endif # platform
+endif
 
 # Build/Package only in case of supported target
 ifneq ($(WLAN_CHIPSET),)
 
-# If TARGET_KERNEL_VERSION is not defined, using default kernel path,
-# otherwise kernel path should come from top level Android makefiles.
+# If kernel version is not defined, using default kernel path, otherwise
+# kernel path offset should come from top level Android makefiles.
 ifeq ($(TARGET_KERNEL_VERSION),)
-$(info "WLAN: TARGET_KERNEL_VERSION not defined, assuming default")
+$(info "$(WLAN_CHIPSET): TARGET_KERNEL_VERSION not defined, assuming default")
 TARGET_KERNEL_SOURCE := kernel
 KERNEL_TO_BUILD_ROOT_OFFSET := ../
 endif
 
+# If kernel path offset is not defined, assume old kernel structure
+ifeq ($(KERNEL_TO_BUILD_ROOT_OFFSET),)
+$(info "$(WLAN_CHIPSET): KERNEL_TO_BUILD_ROOT_OFFSET not defined, assuming default")
+KERNEL_TO_BUILD_ROOT_OFFSET := ../
+endif
+
 LOCAL_PATH := $(call my-dir)
 
 # This makefile is only for DLKM
 ifneq ($(findstring vendor,$(LOCAL_PATH)),)
 
 ifneq ($(findstring opensource,$(LOCAL_PATH)),)
-    WLAN_BLD_DIR := vendor/qcom/opensource/wlan
+	WLAN_BLD_DIR := vendor/qcom/opensource/wlan
 endif # opensource
 
 # DLKM_DIR was moved for JELLY_BEAN (PLATFORM_SDK 16)
 ifeq ($(call is-platform-sdk-version-at-least,16),true)
-       DLKM_DIR := $(TOP)/device/qcom/common/dlkm
+	DLKM_DIR := $(TOP)/device/qcom/common/dlkm
 else
-       DLKM_DIR := build/dlkm
+	DLKM_DIR := build/dlkm
 endif # platform-sdk-version
 
 # Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
@@ -63,9 +69,12 @@ include $(DLKM_DIR)/AndroidKernelModule.mk
 ###########################################################
 
 # Create Symbolic link
+ifneq ($(findstring $(WLAN_CHIPSET),$(WIFI_DRIVER_DEFAULT)),)
+$(shell mkdir -p $(TARGET_OUT)/lib/modules; \
+	ln -sf /system/lib/modules/$(WLAN_CHIPSET)/$(LOCAL_MODULE) $(TARGET_OUT)/lib/modules/wlan.ko)
+endif
 $(shell ln -sf /persist/wlan_mac.bin $(TARGET_OUT_ETC)/firmware/wlan/qca_cld/wlan_mac.bin)
 
 endif # DLKM check
-
 endif # supported target check
 endif # WLAN enabled check