mwifiex/mxm_wifiex/mxmwifi.mk
Jindong Yue 8d12052fe9 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 <jindong.yue@nxp.com>
2021-12-10 15:12:42 +08:00

43 lines
1.6 KiB
Makefile

# 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_SRC := $(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_SRC=$(KERNEL_SRC)' > $(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 \
$(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);