From 5426fc45f2d841464ff652f24a684ff28cdef0c8 Mon Sep 17 00:00:00 2001 From: "yang.tian" Date: Thu, 28 Jan 2021 16:29:02 +0800 Subject: [PATCH] MA-18646 Build nxp mxmwifi driver out of kernel tree Add mxmwifi.mk to build nxp wifi driver out of kernel tree with clang. Remove GCC ccflag options to build wifi driver. Change-Id: Ie9a2550a2a626daa069e7edb305080c91ef71bfa Signed-off-by: yang.tian --- mxm_wifiex/mxmwifi.mk | 44 ++++++++++++++++++++++++++++++++++++ mxm_wifiex/wlan_src/Makefile | 18 +++++++-------- 2 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 mxm_wifiex/mxmwifi.mk diff --git a/mxm_wifiex/mxmwifi.mk b/mxm_wifiex/mxmwifi.mk new file mode 100644 index 0000000..4261e77 --- /dev/null +++ b/mxm_wifiex/mxmwifi.mk @@ -0,0 +1,44 @@ +# Copyright 2021 NXP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +KERNEL_DIR := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ +TARGET_ARCH := $(TARGET_KERNEL_ARCH) +MXMWIFI_CROSS_COMPILE := aarch64-linux-gnu- + +MXMWIFI_SRC_PATH := $(MXMWIFI_PATH)/mxm_wifiex/wlan_src +MXMWIFI_OUT := $(TARGET_OUT_INTERMEDIATES)/MXMWIFI_OBJ + +KERNEL_CFLAGS ?= KCFLAGS=-mno-android +ARCH ?= $(TARGET_ARCH) + +MXMWIFI_KERNELENVSH := $(MXMWIFI_OUT)/kernelenv.sh +$(MXMWIFI_KERNELENVSH): + mkdir -p $(MXMWIFI_OUT) + echo 'export KERNEL_DIR=$(KERNEL_DIR)' > $(MXMWIFI_KERNELENVSH) + echo 'export CROSS_COMPILE=$(MXMWIFI_CROSS_COMPILE)' >> $(MXMWIFI_KERNELENVSH) + echo 'export ARCH=$(ARCH)' >> $(MXMWIFI_KERNELENVSH) + +mxmwifi: $(MXMWIFI_KERNELENVSH) $(MXMWIFI_SRC_PATH) + $(hide) if [ ${clean_build} = 1 ]; then \ + PATH=$$PATH $(MAKE) -C $(MXMWIFI_SRC_PATH) ANDROID=yes clean; \ + fi + @ . $(MXMWIFI_KERNELENVSH); $(kernel_build_shell_env) \ + $(MAKE) -C $(MXMWIFI_SRC_PATH) ANDROID=yes \ + PWD=$(ANDROID_BUILD_TOP)/vendor/nxp-opensource/nxp-mwifiex/mxm_wifiex/wlan_src \ + $(CLANG_TO_COMPILE) \ + $(KERNEL_CFLAGS) \ + ARCH=$(ARCH) \ + DEBUG=$(DEBUG); \ + cp $(MXMWIFI_SRC_PATH)/mlan.ko $(MXMWIFI_OUT); + cp $(MXMWIFI_SRC_PATH)/moal.ko $(MXMWIFI_OUT); diff --git a/mxm_wifiex/wlan_src/Makefile b/mxm_wifiex/wlan_src/Makefile index 645e5d1..43138c0 100644 --- a/mxm_wifiex/wlan_src/Makefile +++ b/mxm_wifiex/wlan_src/Makefile @@ -116,7 +116,7 @@ ccflags-y += -I$(M)/mlan ccflags-y += -DLINUX KERNELVERSION_X86 := $(shell uname -r) -KERNELDIR ?= /lib/modules/$(KERNELVERSION_X86)/build +KERNELDIR ?= $(KERNEL_DIR) LD += -S BINDIR = ../bin_mxm_wifiex @@ -297,16 +297,16 @@ endif # add -Wno-packed-bitfield-compat when GCC version greater than 4.4 GCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc ) ifeq ($(GCC_VERSION),1) - ccflags-y += -Wno-packed-bitfield-compat +#ccflags-y += -Wno-packed-bitfield-compat endif WimpGCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1 -d.`| bc ) -ifeq ($(shell test $(WimpGCC_VERSION) -ge 7; echo $$?),0) -ccflags-y += -Wimplicit-fallthrough=3 -endif -ccflags-y += -Wno-stringop-overflow -ccflags-y += -Wno-tautological-compare -ccflags-y += -Wno-stringop-truncation -ccflags-y += -Wno-packed-bitfield-compat +#ifeq ($(shell test $(WimpGCC_VERSION) -ge 7; echo $$?),0) +#ccflags-y += -Wimplicit-fallthrough=3 +#endif +#ccflags-y += -Wno-stringop-overflow +#ccflags-y += -Wno-tautological-compare +#ccflags-y += -Wno-stringop-truncation +#ccflags-y += -Wno-packed-bitfield-compat ############################################################################# # Make Targets