| # Makefile for MT76x8 combo driver |
| |
| ############################################################## |
| # Common settings |
| ############################################################## |
| export MTK_COMBO_CHIP=MT6632 |
| export HIF=usb |
| export CONFIG_MTK_WIFI_ONLY=m |
| export CONFIG_MTK_COMBO=m |
| export CONFIG_MTK_COMBO_WIFI=m |
| export CONFIG_MTK_COMBO_COMM=m |
| export CONFIG_MTK_COMBO_COMM_UART=m |
| export CONFIG_MTK_COMBO_COMM_SDIO=m |
| export CONFIG_MT_WIFI_CHRDEV=m |
| WLAN_CHIP_ID := mt7668 |
| |
| PWD=$(shell pwd) |
| DRIVER_DIR=$(PWD) |
| |
| ifeq ($(HIF),) |
| HIF=usb |
| endif |
| |
| export CONFIG_MTK_COMBO_WIFI_HIF=$(HIF) |
| MODULE_NAME := wlan_$(WLAN_CHIP_ID)_$(HIF) |
| |
| export CONFIG_MTK_PREALLOC_MEMORY=n |
| |
| ############################################################## |
| # Platform specific |
| ############################################################## |
| # Set default platform |
| PLATFORM:=MT53XX |
| |
| ifeq ($(PLATFORM),) |
| PLATFORM=MT53XX |
| endif |
| |
| #= = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| # MT53XX start |
| #- - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| ifeq ($(PLATFORM),MT53XX) |
| TARGET = LINUX |
| |
| # Sets DRIVER_PARTIAL_BUILD to y to compile driver only, otherwise set to n |
| DRIVER_PARTIAL_BUILD := n |
| ANDROID=true |
| # |
| # [ Driver Partial Build ] |
| # |
| ifeq ($(DRIVER_PARTIAL_BUILD),y) |
| # Please adjust the following variables according to your build attempt |
| ifeq ($(ANDROID),) |
| ANDROID=false |
| endif |
| 64BIT_MODE := false |
| LINUX_ROOT ?= $(word 1, $(subst /apollo/,/apollo /, $(shell pwd -L))) |
| |
| ifeq ($(ANDROID),true) |
| # -> Android, driver partial build |
| SYSBUILD_NAME=m-base |
| RELEASE_NAME=mediatek/mt5891_eu_64 |
| KERNEL_VER=3.18 |
| KERNEL_CONFIG=mt5891_android_smp_mod_defconfig |
| ifeq ($(64BIT_MODE),true) |
| export 64BIT_MODE=true |
| export KERNEL_64BIT=true |
| export TOOL_CHAIN_64BIT=4.9.3 |
| endif |
| LINUX_SRC=$(LINUX_ROOT)/../android/$(SYSBUILD_NAME)/out/mediatek_linux/output/$(RELEASE_NAME)/rel/obj/kernel/linux_core/kernel/linux-$(KERNEL_VER)/$(KERNEL_CONFIG)_modules |
| OBJ_ROOT ?= $(LINUX_ROOT)/../android/$(SYSBUILD_NAME)/out/mediatek_linux/output/$(RELEASE_NAME)/rel/obj |
| export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../.. |
| |
| else |
| # -> Linux, driver partial build |
| # !NOTE! Edit the following parameters! |
| SYSBUILD_NAME := sys_build/XXXX |
| RELEASE_NAME=mt5891_eu |
| KERNEL_VER=3.10? |
| KERNEL_CONFIG=mt5891_smp_mod_defconfig |
| ifeq ($(64BIT_MODE),true) |
| export 64BIT_MODE=true |
| export KERNEL_64BIT=true |
| export TOOL_CHAIN_64BIT=4.9.3 |
| endif |
| LINUX_SRC=$(LINUX_ROOT)/$(SYSBUILD_NAME)/$(RELEASE_NAME)/rel_obj/kernel/linux_core/kernel/linux-$(KERNEL_VER)/$(KERNEL_CONFIG)_modules |
| OBJ_ROOT := $(LINUX_ROOT)/$(SYSBUILD_NAME)/$(RELEASE_NAME)/rel_obj |
| export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../.. |
| CROSS_COMPILE=/mtkoss/gnuarm/neon_4.8.2_2.6.35_cortex-a9-ubuntu/i686/bin/armv7a-mediatek482_001_neon-linux-gnueabi- |
| |
| endif |
| |
| |
| # |
| # [ Sys build ] |
| # |
| else |
| LINUX_SRC=$(KERNEL_OBJ_ROOT)/$(KERNEL_VER)/$(KERNEL_CONFIG)_modules |
| # overwrite $(OUT_STA_KO) for MT53XX platform |
| OUT_STA_KO = $(OBJ_ROOT)/linux_mts/ko_modules/wlan_driver/gen4m/$(MODULE_NAME).ko |
| include $(LINUX_ROOT)/linux_mts/build/mak/toolchain.mak |
| endif |
| |
| ifeq ($(CROSS_COMPILE),) |
| CROSS_COMPILE=/mtkoss/gnuarm/vfp_4.5.1_2.6.27_cortex-a9-rhel4/i686/bin/armv7a-mediatek451_001_vfp-linux-gnueabi- |
| endif |
| ifeq "$(CC)" "gcc" |
| CC ?= $(CROSS_COMPILE)gcc |
| endif |
| |
| $(warning =============================================) |
| $(warning wifi driver LINUX_SRC=$(LINUX_SRC)) |
| $(warning CROSS_COMPILE=$(CROSS_COMPILE)) |
| $(warning KERNEL_CROSS_COMPILE=$(KERNEL_CROSS_COMPILE)) |
| $(warning =============================================) |
| |
| endif |
| #- - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| # MT53XX end |
| #= = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| |
| |
| ############################################################## |
| # Compile options |
| ############################################################## |
| #/***** Common part ******/ |
| |
| # Define maximum different channels supported for ieee80211_iface_combination setting. |
| CFG_NUM_DIFFERENT_CHANNELS_STA=1 |
| CFG_NUM_DIFFERENT_CHANNELS_P2P=1 |
| |
| # Define initial driver running mode. |
| # 0=RUNNING_P2P_MODE, 1=RUNNING_AP_MODE, 2=RUNNING_DUAL_AP_MODE, 3=RUNNING_P2P_AP_MODE |
| CFG_DRIVER_INITIAL_RUNNING_MODE=3 |
| |
| # Define to enable Android wake_lock |
| CFG_ENABLE_WAKE_LOCK=0 |
| |
| CFG_DEFAULT_DBG_LEVEL=0xF |
| |
| CFG_TX_DIRECT_USB=1 |
| |
| CFG_RX_DIRECT_USB=1 |
| |
| CFG_USB_REQ_TX_DATA_FFA_CNT=6 |
| |
| CFG_USB_REQ_TX_DATA_CNT=2 |
| |
| CFG_USB_REQ_RX_DATA_CNT=4 |
| |
| CFG_ENABLE_EFUSE_MAC_ADDR=1 |
| |
| #CFG_SUPPORT_SINGLE_SKU_LOCAL_DB=0 |
| |
| #CFG_SUPPORT_DFS_MASTER=1 |
| |
| CFG_SCAN_CHANNEL_SPECIFIED=1 |
| |
| CFG_SUPPORT_ROAMING=0 |
| |
| # Report all bss networks to cfg80211 when do p2p scan |
| CFG_P2P_SCAN_REPORT_ALL_BSS=0 |
| |
| # Support to change sta, p2p, ap interface names |
| # y: enable, n: disable |
| # eg. insmod wlan_mt7668_usb.ko sta=wlan p2p=p2p ap=ap |
| CFG_DRIVER_INF_NAME_CHANGE=n |
| |
| CFG_CHIP_RESET_SUPPORT=0 |
| |
| #/***** Platform dependent part ******/ |
| ifeq ($(PLATFORM),MT53XX) |
| CFG_DRIVER_INITIAL_RUNNING_MODE=0 |
| CFG_SUPPORT_SINGLE_SKU_LOCAL_DB=0 |
| endif |
| |
| |
| |
| #/***** Manage configs into compile options ******/ |
| ifneq ($(CFG_NUM_DIFFERENT_CHANNELS_STA),) |
| PLATFORM_FLAGS += -DCFG_NUM_DIFFERENT_CHANNELS_STA=$(CFG_NUM_DIFFERENT_CHANNELS_STA) |
| endif |
| |
| ifneq ($(CFG_NUM_DIFFERENT_CHANNELS_P2P),) |
| PLATFORM_FLAGS += -DCFG_NUM_DIFFERENT_CHANNELS_P2P=$(CFG_NUM_DIFFERENT_CHANNELS_P2P) |
| endif |
| |
| ifneq ($(CFG_DRIVER_INITIAL_RUNNING_MODE),) |
| PLATFORM_FLAGS += -DCFG_DRIVER_INITIAL_RUNNING_MODE=$(CFG_DRIVER_INITIAL_RUNNING_MODE) |
| endif |
| |
| ifneq ($(CFG_ENABLE_WAKE_LOCK),) |
| PLATFORM_FLAGS += -DCFG_ENABLE_WAKE_LOCK=$(CFG_ENABLE_WAKE_LOCK) |
| endif |
| |
| ifneq ($(CFG_DEFAULT_DBG_LEVEL),) |
| PLATFORM_FLAGS += -DCFG_DEFAULT_DBG_LEVEL=$(CFG_DEFAULT_DBG_LEVEL) |
| endif |
| |
| ifneq ($(CFG_TX_DIRECT_USB),) |
| PLATFORM_FLAGS += -DCFG_TX_DIRECT_USB=$(CFG_TX_DIRECT_USB) |
| endif |
| |
| ifneq ($(CFG_RX_DIRECT_USB),) |
| PLATFORM_FLAGS += -DCFG_RX_DIRECT_USB=$(CFG_RX_DIRECT_USB) |
| endif |
| |
| ifneq ($(CFG_USB_REQ_TX_DATA_FFA_CNT),) |
| PLATFORM_FLAGS += -DCFG_USB_REQ_TX_DATA_FFA_CNT=$(CFG_USB_REQ_TX_DATA_FFA_CNT) |
| endif |
| |
| ifneq ($(CFG_USB_REQ_TX_DATA_CNT),) |
| PLATFORM_FLAGS += -DCFG_USB_REQ_TX_DATA_CNT=$(CFG_USB_REQ_TX_DATA_CNT) |
| endif |
| |
| ifneq ($(CFG_USB_REQ_RX_DATA_CNT),) |
| PLATFORM_FLAGS += -DCFG_USB_REQ_RX_DATA_CNT=$(CFG_USB_REQ_RX_DATA_CNT) |
| endif |
| |
| ifneq ($(CFG_SUPPORT_ROAMING),) |
| PLATFORM_FLAGS += -DCFG_SUPPORT_ROAMING=$(CFG_SUPPORT_ROAMING) |
| endif |
| |
| ifneq ($(CFG_ENABLE_EFUSE_MAC_ADDR),) |
| PLATFORM_FLAGS += -DCFG_ENABLE_EFUSE_MAC_ADDR=$(CFG_ENABLE_EFUSE_MAC_ADDR) |
| endif |
| |
| ifeq ($(CFG_DRIVER_INF_NAME_CHANGE), y) |
| PLATFORM_FLAGS += -DCFG_DRIVER_INF_NAME_CHANGE |
| endif |
| |
| ifneq ($(CFG_SUPPORT_SINGLE_SKU_LOCAL_DB),) |
| PLATFORM_FLAGS += -DCFG_SUPPORT_SINGLE_SKU_LOCAL_DB=$(CFG_SUPPORT_SINGLE_SKU_LOCAL_DB) |
| endif |
| |
| ifneq ($(CFG_SUPPORT_DFS_MASTER),) |
| PLATFORM_FLAGS += -DCFG_SUPPORT_DFS_MASTER=$(CFG_SUPPORT_DFS_MASTER) |
| endif |
| |
| ifneq ($(CFG_P2P_SCAN_REPORT_ALL_BSS),) |
| PLATFORM_FLAGS += -DCFG_P2P_SCAN_REPORT_ALL_BSS=$(CFG_P2P_SCAN_REPORT_ALL_BSS) |
| endif |
| |
| ifneq ($(CFG_SCAN_CHANNEL_SPECIFIED),) |
| PLATFORM_FLAGS += -DCFG_SCAN_CHANNEL_SPECIFIED=$(CFG_SCAN_CHANNEL_SPECIFIED) |
| endif |
| |
| ifneq ($(CFG_CHIP_RESET_SUPPORT),) |
| PLATFORM_FLAGS += -DCFG_CHIP_RESET_SUPPORT=$(CFG_CHIP_RESET_SUPPORT) |
| endif |
| |
| ############################################################## |
| # Compile settings |
| ############################################################## |
| |
| all: driver |
| |
| driver: |
| +cd $(DRIVER_DIR) && make -C $(LINUX_SRC) M=$(DRIVER_DIR) PLATFORM_FLAGS="$(PLATFORM_FLAGS)" WLAN_CHIP_ID=$(WLAN_CHIP_ID) modules |
| ifeq ($(PLATFORM),MT53XX) |
| ifeq ($(DRIVER_PARTIAL_BUILD), y) |
| @cd $(DRIVER_DIR) && $(CROSS_COMPILE)strip --strip-unneeded $(MODULE_NAME).ko |
| else |
| $(KERNEL_CROSS_COMPILE)strip --strip-unneeded $(OUT_STA_KO) |
| endif |
| endif |
| |
| ############################################################## |
| # Post processing |
| ############################################################## |
| |
| #= = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| # MT53XX start |
| #- - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| ifeq ($(PLATFORM),MT53XX) |
| ifneq ($(DRIVER_PARTIAL_BUILD), y) |
| ifneq ($(ANDROID),true) |
| if [ ! -d $(OUTPUT_ROOT)/basic/wifi_ko ]; then \ |
| mkdir -p $(OUTPUT_ROOT)/basic/wifi_ko/; \ |
| fi |
| if [ -d $(OUTPUT_ROOT)/basic/wifi_ko ]; then \ |
| cp -f $(OUT_STA_KO) $(OUTPUT_ROOT)/basic/wifi_ko/$(MODULE_NAME).ko; \ |
| fi |
| else |
| if [ ! -d $(OUTPUT_ROOT)/basic/modules ]; then \ |
| mkdir -p $(OUTPUT_ROOT)/basic/modules/; \ |
| fi |
| if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \ |
| cp -f $(OUT_STA_KO) $(OUTPUT_ROOT)/basic/modules/wlan.ko; \ |
| fi |
| endif # ifneq ($(ANDROID),true) |
| ifeq ($(S_PLATFORM),true) |
| if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \ |
| cp -f $(ANDROID_BUILD_TOP)/vendor/mediatek/open/hardware/prebuilt/wifi/WIFI_RAM_CODE_MT7668.bin $(OUTPUT_ROOT)/basic/modules; \ |
| cp -f $(ANDROID_BUILD_TOP)/vendor/mediatek/open/hardware/prebuilt/wifi/WIFI_RAM_CODE2_USB_MT7668.bin $(OUTPUT_ROOT)/basic/modules; \ |
| cp -f $(ANDROID_BUILD_TOP)/vendor/mediatek/open/hardware/prebuilt/wifi/wifi.cfg $(OUTPUT_ROOT)/basic/modules; \ |
| cp -f $(ANDROID_BUILD_TOP)/vendor/mediatek/open/hardware/prebuilt/wifi/TxPwrLimit_MT76x8.dat $(OUTPUT_ROOT)/basic/modules; \ |
| cp -f $(ANDROID_BUILD_TOP)/vendor/mediatek/open/hardware/prebuilt/bt/mt7668/mt7668_patch_e1_hdr.bin $(OUTPUT_ROOT)/basic/modules; \ |
| cp -f $(ANDROID_BUILD_TOP)/vendor/mediatek/open/hardware/prebuilt/bt/mt7668/mt7668_patch_e2_hdr.bin $(OUTPUT_ROOT)/basic/modules; \ |
| fi |
| endif |
| endif # ifneq ($(DRIVER_PARTIAL_BUILD), y) |
| endif # ifeq ($(PLATFORM),MT53XX) |
| #- - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| # MT53XX end |
| #= = = = = = = = = = = = = = = = = = = = = = = = = = = = |
| |
| clean: driver_clean |
| ifeq ($(PLATFORM),MT53XX) |
| ifeq ($(S_PLATFORM),true) |
| if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \ |
| rm -f $(OUTPUT_ROOT)/basic/modules/WIFI_RAM_CODE_MT7668.bin; \ |
| rm -f $(OUTPUT_ROOT)/basic/modules/WIFI_RAM_CODE2_USB_MT7668.bin; \ |
| rm -f $(OUTPUT_ROOT)/basic/modules/wifi.cfg; \ |
| rm -f $(OUTPUT_ROOT)/basic/modules/TxPwrLimit_MT76x8.dat; \ |
| rm -f $(OUTPUT_ROOT)/basic/modules/mt7668_patch_e1_hdr.bin; \ |
| rm -f $(OUTPUT_ROOT)/basic/modules/mt7668_patch_e2_hdr.bin; \ |
| fi |
| endif |
| endif |
| |
| driver_clean: |
| ifneq ($(ANDROID),true) |
| rm -rf $(THIRDPARTY_LIB_ROOT)/wlan |
| endif |
| if [ -d $(DRIVER_DIR) ] && [ -d $(LINUX_SRC) ]; then \ |
| cd $(DRIVER_DIR) && make -C $(LINUX_SRC) M=$(DRIVER_DIR) MODULE_NAME=$(MODULE_NAME) clean; \ |
| fi |
| if [ -e $(DRIVER_DIR)/$(MODULE_NAME).ko ]; then rm $(DRIVER_DIR)/$(MODULE_NAME).ko; fi; |
| |
| |
| |
| |
| .PHONY: all clean driver driver_clean |
| |