From 8d12052fe9b08f87c51326366acc96a5b62cd9b3 Mon Sep 17 00:00:00 2001 From: Jindong Yue Date: Fri, 10 Dec 2021 14:20:40 +0800 Subject: [PATCH] MA-18757 Fix build issue when build mxmwifi from other folder When we build mxmwifi from other folders, like AOSP kernel build repo to collect symbols used by imx drivers, it will meet below build error: make -C common M=/home/ssd-2/jindong/android/gki-imx ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules make[1]: *** common: No such file or directory. Stop. Use KERNEL_SRC to hold kernel directory, which can be passed from AOSP kernel build repo. Add a new target modules_install. Change-Id: I344b0984317ae477b6961ab05eb73bf0a6c97e50 Signed-off-by: Jindong Yue --- mxm_wifiex/mxmwifi.mk | 5 ++--- mxm_wifiex/wlan_src/Makefile | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mxm_wifiex/mxmwifi.mk b/mxm_wifiex/mxmwifi.mk index f4b1c10..9078616 100644 --- a/mxm_wifiex/mxmwifi.mk +++ b/mxm_wifiex/mxmwifi.mk @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -KERNEL_DIR := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ +KERNEL_SRC := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ TARGET_ARCH := $(TARGET_KERNEL_ARCH) MXMWIFI_CROSS_COMPILE := aarch64-linux-gnu- @@ -25,7 +25,7 @@ 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 KERNEL_SRC=$(KERNEL_SRC)' > $(MXMWIFI_KERNELENVSH) echo 'export CROSS_COMPILE=$(MXMWIFI_CROSS_COMPILE)' >> $(MXMWIFI_KERNELENVSH) echo 'export ARCH=$(ARCH)' >> $(MXMWIFI_KERNELENVSH) @@ -35,7 +35,6 @@ mxmwifi: $(MXMWIFI_KERNELENVSH) $(MXMWIFI_SRC_PATH) 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) \ diff --git a/mxm_wifiex/wlan_src/Makefile b/mxm_wifiex/wlan_src/Makefile index 057a2d7..2e7f563 100644 --- a/mxm_wifiex/wlan_src/Makefile +++ b/mxm_wifiex/wlan_src/Makefile @@ -27,6 +27,7 @@ endif LD ?= $(CROSS_COMPILE)ld BACKUP= /root/backup YMD= `date +%Y%m%d%H%M` +PWD := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) ############################################################################# # Configuration Options @@ -121,7 +122,7 @@ MODEXT = ko ccflags-y += -I$(M)/mlan ccflags-y += -DLINUX -KERNELDIR ?= $(KERNEL_DIR) +KERNELDIR ?= $(KERNEL_SRC) ARCH ?= arm64 CONFIG_IMX_SUPPORT=y ifeq ($(CONFIG_IMX_SUPPORT),y) @@ -562,6 +563,10 @@ else default: $(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules +modules_install: + $(MAKE) -C $(KERNELDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules_install + + endif ###############################################################