[qca-ssdk] Add support for kernel 3.18.x

Change-Id: I4436a75bb6b44b7078b75d3d16a45b73428bacfe
Signed-off-by: Ram Chandra Jangir <rjangi@codeaurora.org>
diff --git a/app/nathelper/linux/napt_procfs.c b/app/nathelper/linux/napt_procfs.c
index 4126c47..f87b86b 100755
--- a/app/nathelper/linux/napt_procfs.c
+++ b/app/nathelper/linux/napt_procfs.c
@@ -915,37 +915,37 @@
 
 struct kobject *napt_sys = NULL;
 static const struct device_attribute napt_hnat_attr =
-	__ATTR(hnat, S_IWUGO | S_IRUGO, napt_hnat_get, napt_hnat_set);
+	__ATTR(hnat, 0660, napt_hnat_get, napt_hnat_set);
 static const struct device_attribute napt_wan_type_attr =
-	__ATTR(wan_type, S_IWUGO | S_IRUGO, napt_wan_type_get, napt_wan_type_set);
+	__ATTR(wan_type, 0660, napt_wan_type_get, napt_wan_type_set);
 static const struct device_attribute napt_ppp_id_attr =
-	__ATTR(ppp_id, S_IWUGO | S_IRUGO, napt_ppp_id_get, napt_ppp_id_set);
+	__ATTR(ppp_id, 0660, napt_ppp_id_get, napt_ppp_id_set);
 static const struct device_attribute napt_udp_thresh_attr =
-	__ATTR(udp_thresh, S_IWUGO | S_IRUGO, napt_udp_thresh_get, napt_udp_thresh_set);
+	__ATTR(udp_thresh, 0660, napt_udp_thresh_get, napt_udp_thresh_set);
 static const struct device_attribute napt_wan_ip_attr =
-	__ATTR(wan_ip, S_IWUGO | S_IRUGO, napt_wan_ip_get, napt_wan_ip_set);
+	__ATTR(wan_ip, 0660, napt_wan_ip_get, napt_wan_ip_set);
 static const struct device_attribute napt_ppp_peer_ip_attr =
-	__ATTR(peer_ip, S_IWUGO | S_IRUGO, napt_ppp_peer_ip_get, napt_ppp_peer_ip_set);
+	__ATTR(peer_ip, 0660, napt_ppp_peer_ip_get, napt_ppp_peer_ip_set);
 static const struct device_attribute napt_ppp_peer_mac_attr =
-	__ATTR(peer_mac, S_IWUGO | S_IRUGO, napt_peer_mac_get, napt_peer_mac_set);
+	__ATTR(peer_mac, 0660, napt_peer_mac_get, napt_peer_mac_set);
 static const struct device_attribute napt_wan_mac_attr =
-	__ATTR(wan_mac, S_IWUGO | S_IRUGO, napt_wan_mac_get, napt_wan_mac_set);
+	__ATTR(wan_mac, 0660, napt_wan_mac_get, napt_wan_mac_set);
 static const struct device_attribute napt_ppp_id2_attr =
-	__ATTR(ppp_id2, S_IWUGO | S_IRUGO, napt_ppp_id2_get, napt_ppp_id2_set);
+	__ATTR(ppp_id2, 0660, napt_ppp_id2_get, napt_ppp_id2_set);
 static const struct device_attribute napt_ppp_peer_mac2_attr =
-	__ATTR(peer_mac2, S_IWUGO | S_IRUGO, napt_peer_mac2_get, napt_peer_mac2_set);
+	__ATTR(peer_mac2, 0660, napt_peer_mac2_get, napt_peer_mac2_set);
 static const struct device_attribute napt_sync_counter_en_attr =
-	__ATTR(sync_counter_en, S_IWUGO | S_IRUGO, napt_sync_counter_en_get, napt_sync_counter_en_set);
+	__ATTR(sync_counter_en, 0660, napt_sync_counter_en_get, napt_sync_counter_en_set);
 static const struct device_attribute napt_log_en_attr =
-	__ATTR(log_en, S_IWUGO | S_IRUGO, napt_log_en_get, napt_log_en_set);
+	__ATTR(log_en, 0660, napt_log_en_get, napt_log_en_set);
 static const struct device_attribute napt_log_show_attr =
-	__ATTR(log_show, S_IWUGO | S_IRUGO, napt_log_show_get, NULL);
+	__ATTR(log_show, 0660, napt_log_show_get, NULL);
 static const struct device_attribute napt_scan_period_attr =
-	__ATTR(speriod, S_IWUGO | S_IRUGO, napt_scan_period_get, napt_scan_period_set);
+	__ATTR(speriod, 0660, napt_scan_period_get, napt_scan_period_set);
 static const struct device_attribute napt_scan_enable_attr =
-	__ATTR(scan_en, S_IWUGO | S_IRUGO, napt_scan_enable_get, napt_scan_enable_set);
+	__ATTR(scan_en, 0660, napt_scan_enable_get, napt_scan_enable_set);
 static const struct device_attribute napt_need_clean_attr =
-	__ATTR(napt_clean, S_IWUGO | S_IRUGO, napt_need_clean_get, napt_need_clean_set);
+	__ATTR(napt_clean, 0660, napt_need_clean_get, napt_need_clean_set);
 
 
 int napt_procfs_init(void)
diff --git a/config b/config
index 124cdaa..4f6650c 100755
--- a/config
+++ b/config
@@ -10,6 +10,14 @@
 OS_VER=3_4
 endif
 
+ifeq ($(KVER), 3.18)
+OS_VER=3_18
+endif
+
+ifeq ($(KVER), 3.18.19)
+OS_VER=3_18
+endif
+
 ifeq ($(KVER), 3.4.103)
 OS_VER=3_4
 endif
@@ -78,9 +86,17 @@
 ifeq ($(KVER), 3.4.103)
   CPU_CFLAG=-D__LINUX_ARM_ARCH__=7  -DMODULE -fno-common -DCONFIG_MMU -D$(BOARD_NAME)
 endif
+ifeq ($(KVER), 3.18.19)
+  CPU_CFLAG=-D__LINUX_ARM_ARCH__=7  -DMODULE -fno-common -DCONFIG_MMU -D$(BOARD_NAME)
+endif
+
 ifeq ($(KVER),$(filter 3.14%,$(KVER)))
   CPU_CFLAG= -DMODULE -nostdinc -D$(BOARD_NAME) -mlittle-endian -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -DCC_HAVE_ASM_GOTO    -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(mem)"  -D"KBUILD_MODNAME=KBUILD_STR(mem)"
 endif
+
+ifeq ($(KVER),$(filter 3.18%,$(KVER)))
+  CPU_CFLAG= -DMODULE -nostdinc -D$(BOARD_NAME) -mlittle-endian -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -DCC_HAVE_ASM_GOTO    -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(mem)"  -D"KBUILD_MODNAME=KBUILD_STR(mem)"
+endif
 endif
 
 ifeq ($(BOARD_TYPE), ap136)
diff --git a/make/linux_opt.mk b/make/linux_opt.mk
index c12bff5..3de3895 100755
--- a/make/linux_opt.mk
+++ b/make/linux_opt.mk
@@ -183,6 +183,28 @@
 
   MODULE_INC += -I$(PRJ_PATH)/include/shell_lib
 
+  ifeq (3_18, $(OS_VER))
+		MODULE_CFLAG += -DKVER34
+		MODULE_CFLAG += -DKVER32
+	    MODULE_CFLAG += -DLNX26_22
+	    MODULE_INC += -I$(SYS_PATH) \
+	          -I$(TOOL_PATH)/../lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.8.3/include/ \
+	          -I$(SYS_PATH)/include \
+              -I$(SYS_PATH)/source/include \
+              -I$(SYS_PATH)/source/arch/arm/mach-msm/include \
+              -I$(SYS_PATH)/arch/arm/mach-msm/include \
+              -I$(SYS_PATH)/source/arch/arm/include \
+              -I$(SYS_PATH)/arch/arm/include \
+              -I$(SYS_PATH)/source/arch/arm/include/asm \
+              -I$(SYS_PATH)/arch/arm/include/generated \
+              -I$(SYS_PATH)/include/generated/uapi \
+              -I$(SYS_PATH)/include/uapi \
+              -I$(SYS_PATH)/arch/arm/include/uapi \
+              -I$(SYS_PATH)/source/arch/arm/include/asm/mach \
+	          -include $(SYS_PATH)/include/linux/kconfig.h
+
+  endif
+
   ifeq (3_14, $(OS_VER))
 		MODULE_CFLAG += -DKVER34
 		MODULE_CFLAG += -DKVER32