wlan: Support new build tree structure

The kernel can be either directly under build_root/kernel or in a
subdirectory within it. The WLAN module has a hard coded assumption
for the path. Hence add the changes to correct it for prima driver.

Change-Id: Ic4738da5c414a1ce1d74e2b42b918b906f5fda98
CRs-fixed: 992940
diff --git a/Android.mk b/Android.mk
index b0b5571..37dc852 100644
--- a/Android.mk
+++ b/Android.mk
@@ -78,11 +78,22 @@
 
 endif
 
+ifeq ($(TARGET_KERNEL_VERSION),)
+$(info "WLAN: TARGET_KERNEL_VERSION is not defined, assuming default")
+TARGET_KERNEL_SOURCE := kernel
+KERNEL_TO_BUILD_ROOT_OFFSET := ../
+endif
+
+ifeq ($(KERNEL_TO_BUILD_ROOT_OFFSET),)
+$(info "WLAN: KERNEL_TO_BUILD_ROOT_OFFSET is not defined, assuming default")
+KERNEL_TO_BUILD_ROOT_OFFSET := ../
+endif
+
 # Build wlan.ko as either prima_wlan.ko or pronto_wlan.ko
 ###########################################################
 
 # This is set once per LOCAL_PATH, not per (kernel) module
-KBUILD_OPTIONS := WLAN_ROOT=../$(WLAN_BLD_DIR)/prima
+KBUILD_OPTIONS := WLAN_ROOT=$(KERNEL_TO_BUILD_ROOT_OFFSET)$(WLAN_BLD_DIR)/prima
 # We are actually building wlan.ko here, as per the
 # requirement we are specifying <chipset>_wlan.ko as LOCAL_MODULE.
 # This means we need to rename the module to <chipset>_wlan.ko