From 61cd4b514283a70f85641ea54a089b3c9b71607e Mon Sep 17 00:00:00 2001 From: Prashanth Bhatta Date: Tue, 28 Jan 2014 14:16:54 -0800 Subject: qcacld: Define open source flag based on license Kbuild file enables WLAN_OPEN_SOURCE flag based on the directory path but this doesn't work for all the platform as path may be different. This change passes the WLAN_OPEN_SOURCE flag from Android.mk or Makefile. Makefile determines whether the driver is open source or proprietary and accordingly WLAN_OPEN_SOURCE is set to 1 or 0. Change-Id: Id0149f71ceb3e94bd1a67868565cd3b8151bdd7d --- Android.mk | 3 +++ Kbuild | 15 ++++++--------- Makefile | 10 +++++++++- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Android.mk b/Android.mk index de83532a4213..d3dfafce1fe0 100644 --- a/Android.mk +++ b/Android.mk @@ -22,8 +22,10 @@ ifneq ($(findstring vendor,$(LOCAL_PATH)),) # Determine if we are Proprietary or Open Source ifneq ($(findstring opensource,$(LOCAL_PATH)),) WLAN_PROPRIETARY := 0 + WLAN_OPEN_SOURCE := 1 else WLAN_PROPRIETARY := 1 + WLAN_OPEN_SOURCE := 0 endif ifeq ($(WLAN_PROPRIETARY),1) @@ -52,6 +54,7 @@ KBUILD_OPTIONS += MODNAME=wlan KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM) KBUILD_OPTIONS += $(WLAN_SELECT) KBUILD_OPTIONS += $(WLAN_ISOC_SELECT) +KBUILD_OPTIONS += WLAN_OPEN_SOURCE=$(WLAN_OPEN_SOURCE) include $(CLEAR_VARS) LOCAL_MODULE := $(WLAN_CHIPSET)_wlan.ko diff --git a/Kbuild b/Kbuild index 7742ef25a445..1bc81b1042b4 100644 --- a/Kbuild +++ b/Kbuild @@ -1,5 +1,5 @@ -# We can build either as part of a standalone Kernel build or part -# of an Android build. Determine which mechanism is being used +# We can build either as part of a standalone Kernel build or as +# an external module. Determine which mechanism is being used ifeq ($(MODNAME),) KERNEL_BUILD := 1 else @@ -7,10 +7,11 @@ else endif ifeq ($(KERNEL_BUILD),1) - # These are provided in Android-based builds + # These are provided in external module based builds # Need to explicitly define for Kernel-based builds MODNAME := wlan - WLAN_ROOT := drivers/staging/prima + WLAN_ROOT := drivers/staging/qcacld-2.0 + WLAN_OPEN_SOURCE := 1 endif ifeq ($(KERNEL_BUILD), 0) @@ -972,11 +973,7 @@ ifeq ($(RE_ENABLE_WIFI_ON_WDI_TIMEOUT),1) CDEFINES += -DWDI_RE_ENABLE_WIFI_ON_WDI_TIMEOUT endif -ifeq ($(KERNEL_BUILD),1) -CDEFINES += -DWLAN_OPEN_SOURCE -endif - -ifeq ($(findstring opensource, $(WLAN_ROOT)), opensource) +ifeq ($(WLAN_OPEN_SOURCE), 1) CDEFINES += -DWLAN_OPEN_SOURCE endif diff --git a/Makefile b/Makefile index e63cab248f48..c05b00f26c57 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,21 @@ KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build -KBUILD_OPTIONS := WLAN_ROOT=$(shell pwd) +KBUILD_OPTIONS := WLAN_ROOT=$(PWD) KBUILD_OPTIONS += MODNAME=wlan +# Determine if the driver license is Open source or proprietary +# This is determined under the assumption that LICENSE doesn't change. +# Please change here if driver license text changes. +LICENSE_FILE ?= $(PWD)/$(WLAN_ROOT)/CORE/HDD/src/wlan_hdd_main.c +WLAN_OPEN_SOURCE = $(shell if grep -q "MODULE_LICENSE(\"Dual BSD/GPL\")" \ + $(LICENSE_FILE); then echo 1; else echo 0; fi) + #By default build for CLD WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m KBUILD_OPTIONS += CONFIG_QCA_WIFI_ISOC=0 KBUILD_OPTIONS += CONFIG_QCA_WIFI_2_0=1 KBUILD_OPTIONS += $(WLAN_SELECT) +KBUILD_OPTIONS += WLAN_OPEN_SOURCE=$(WLAN_OPEN_SOURCE) KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any all: -- cgit v1.2.3