1# File: Makefile 2# 3# Copyright (C) 2008-2017, Marvell International Ltd. 4# 5# This software file (the "File") is distributed by Marvell International 6# Ltd. under the terms of the GNU General Public License Version 2, June 1991 7# (the "License"). You may use, redistribute and/or modify this File in 8# accordance with the terms and conditions of the License, a copy of which 9# is available by writing to the Free Software Foundation, Inc., 10# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 11# worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 12# 13# A copy of the GPL is available in file gpl-2.0.txt accompanying in this 14# deliverables. 15# 16# THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 17# IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 18# ARE EXPRESSLY DISCLAIMED. The License provides additional details about 19# this warranty disclaimer. 20 21COMPATDIR=/lib/modules/$(KERNELVERSION_X86)/build/compat-wireless-3.2-rc1-1/include 22CC= $(CROSS_COMPILE)gcc -I$(COMPATDIR) 23LD= $(CROSS_COMPILE)ld 24BACKUP= /root/backup 25YMD= `date +%Y%m%d%H%M` 26 27ifneq ($(COMPAT_VERSION_CODE),) 28DRV_DIR ?= $(shell pwd) 29export DRV_DIR 30COMPAT_VERSION=$(shell echo $(COMPAT_VERSION_CODE) | awk -F '.' '{print $$1}') 31COMPAT_PATCHLEVEL=$(shell echo $(COMPAT_VERSION_CODE) | awk -F '.' '{print $$2}') 32COMPAT_SUBLEVEL=$(shell echo $(COMPAT_VERSION_CODE) | awk -F '.' '{print $$3}') 33DECL_HEADER_FILE=$(DRV_DIR)/mlinux/moal_main.h 34$(shell sed -i 's/COMPAT_VERSION_CODE KERNEL_VERSION.*/COMPAT_VERSION_CODE KERNEL_VERSION(\ 35 $(COMPAT_VERSION), $(COMPAT_PATCHLEVEL), $(COMPAT_SUBLEVEL))/g' $(DECL_HEADER_FILE)) 36endif 37 38############################################################################# 39# Configuration Options 40############################################################################# 41 42# Debug Option 43# DEBUG LEVEL n/1/2: 44# n: NO DEBUG 45# 1: Only PRINTM(MMSG,...), PRINTM(MFATAL,...), ... 46# 2: All PRINTM() 47CONFIG_DEBUG=1 48 49# Proc debug file 50CONFIG_PROC_DEBUG=y 51 52# Enable STA mode support 53CONFIG_STA_SUPPORT=y 54 55# Enable uAP mode support 56CONFIG_UAP_SUPPORT=y 57 58# Enable WIFIDIRECT support 59CONFIG_WIFI_DIRECT_SUPPORT=y 60 61# Enable WIFIDISPLAY support 62CONFIG_WIFI_DISPLAY_SUPPORT=y 63 64# Re-association in driver 65CONFIG_REASSOCIATION=y 66 67 68# Manufacturing firmware support 69CONFIG_MFG_CMD_SUPPORT=y 70 71# OpenWrt support 72CONFIG_OPENWRT_SUPPORT=n 73 74# Big-endian platform 75CONFIG_BIG_ENDIAN=n 76 77 78# Enable driver based authenticator 79CONFIG_DRV_EMBEDDED_AUTHENTICATOR=y 80 81# Enable driver based supplicant 82CONFIG_DRV_EMBEDDED_SUPPLICANT=y 83 84ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT), y) 85CONFIG_EMBEDDED_SUPP_AUTH=y 86else 87ifeq ($(CONFIG_DRV_EMBEDDED_AUTHENTICATOR), y) 88CONFIG_EMBEDDED_SUPP_AUTH=y 89endif 90endif 91 92# Enable SDIO multi-port Tx aggregation 93CONFIG_SDIO_MULTI_PORT_TX_AGGR=y 94 95# Enable SDIO multi-port Rx aggregation 96CONFIG_SDIO_MULTI_PORT_RX_AGGR=y 97 98# SDIO suspend/resume 99CONFIG_SDIO_SUSPEND_RESUME=y 100 101# DFS testing support 102CONFIG_DFS_TESTING_SUPPORT=y 103 104# Multi-channel support 105CONFIG_MULTI_CHAN_SUPPORT=y 106 107 108CONFIG_ANDROID_KERNEL=y 109 110 111#32bit app over 64bit kernel support 112CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT=n 113 114############################################################################# 115# Select Platform Tools 116############################################################################# 117KERNELDIR := ./../../../../../ 118CURRENT_DIR := $(shell pwd) 119MODEXT = ko 120 121ccflags-y += -I$(M)/mlan 122ccflags-y += -DLINUX 123 124ccflags-y += -Idrivers/net/wireless/rockchip_wlan/mvl88w8977/mlan/ 125ccflags-y += -Idrivers/net/wireless/rockchip_wlan/mvl88w8977/mlinux 126ccflags-y += -Idrivers/net/wireless/rockchip_wlan/mvl88w8977/mlan/esa 127ccflags-y += -Idrivers/net/wireless/rockchip_wlan/mvl88w8977/mlan/esa/common 128 129ifeq ($(CONFIG_EMBEDDED_SUPP_AUTH), y) 130ccflags-y += -I$(M)/mlan/esa 131ccflags-y += -I$(M)/mlan/esa/common 132endif 133 134LD += -S 135 136BINDIR = ../bin_sd8977 137 138############################################################################# 139# Compiler Flags 140############################################################################# 141 142 ccflags-y += -I$(KERNELDIR)/include 143 ccflags-y += -I$(PWD)/mlan/esa 144 ccflags-y += -I$(PWD)/mlan/esa/common 145 146 ccflags-y += -DFPNUM='"68"' 147 148ifeq ($(CONFIG_DEBUG),1) 149 ccflags-y += -DDEBUG_LEVEL1 150endif 151 152ifeq ($(CONFIG_DEBUG),2) 153 ccflags-y += -DDEBUG_LEVEL1 154 ccflags-y += -DDEBUG_LEVEL2 155 DBG= -dbg 156endif 157 158ifeq ($(CONFIG_PROC_DEBUG),y) 159 ccflags-y += -DPROC_DEBUG 160 export CONFIG_PROC_DEBUG 161endif 162 163ifeq ($(CONFIG_64BIT), y) 164 ccflags-y += -DMLAN_64BIT 165endif 166 167ifeq ($(CONFIG_STA_SUPPORT),y) 168 ccflags-y += -DSTA_SUPPORT 169ifeq ($(CONFIG_REASSOCIATION),y) 170 ccflags-y += -DREASSOCIATION 171endif 172else 173CONFIG_WIFI_DIRECT_SUPPORT=n 174CONFIG_WIFI_DISPLAY_SUPPORT=n 175CONFIG_STA_WEXT=n 176CONFIG_STA_CFG80211=n 177endif 178 179ifeq ($(CONFIG_UAP_SUPPORT),y) 180 ccflags-y += -DUAP_SUPPORT 181else 182CONFIG_WIFI_DIRECT_SUPPORT=n 183CONFIG_WIFI_DISPLAY_SUPPORT=n 184CONFIG_UAP_WEXT=n 185CONFIG_UAP_CFG80211=n 186endif 187 188ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y) 189 ccflags-y += -DWIFI_DIRECT_SUPPORT 190endif 191ifeq ($(CONFIG_WIFI_DISPLAY_SUPPORT),y) 192 ccflags-y += -DWIFI_DISPLAY_SUPPORT 193endif 194 195ifeq ($(CONFIG_MFG_CMD_SUPPORT),y) 196 ccflags-y += -DMFG_CMD_SUPPORT 197endif 198 199ifeq ($(CONFIG_BIG_ENDIAN),y) 200 ccflags-y += -DBIG_ENDIAN_SUPPORT 201endif 202 203ifeq ($(CONFIG_USERSPACE_32BIT_OVER_KERNEL_64BIT),y) 204 ccflags-y += -DUSERSPACE_32BIT_OVER_KERNEL_64BIT 205endif 206 207ifeq ($(CONFIG_SDIO_MULTI_PORT_TX_AGGR),y) 208 ccflags-y += -DSDIO_MULTI_PORT_TX_AGGR 209endif 210 211ifeq ($(CONFIG_SDIO_MULTI_PORT_RX_AGGR),y) 212 ccflags-y += -DSDIO_MULTI_PORT_RX_AGGR 213endif 214 215ifeq ($(CONFIG_SDIO_SUSPEND_RESUME),y) 216 ccflags-y += -DSDIO_SUSPEND_RESUME 217endif 218 219ifeq ($(CONFIG_MULTI_CHAN_SUPPORT),y) 220 ccflags-y += -DMULTI_CHAN_SUPPORT 221endif 222 223ifeq ($(CONFIG_DFS_TESTING_SUPPORT),y) 224 ccflags-y += -DDFS_TESTING_SUPPORT 225endif 226 227 228ifeq ($(CONFIG_ANDROID_KERNEL), y) 229 ccflags-y += -DANDROID_KERNEL 230endif 231 232ifeq ($(CONFIG_OPENWRT_SUPPORT), y) 233 ccflags-y += -DOPENWRT 234endif 235 236 237ifeq ($(CONFIG_T50), y) 238 ccflags-y += -DT50 239 ccflags-y += -DT40 240 ccflags-y += -DT3T 241endif 242 243# add -Wno-packed-bitfield-compat when GCC version greater than 4.4 244GCC_VERSION := $(shell echo `gcc -dumpversion | cut -f1-2 -d.` \>= 4.4 | sed -e 's/\./*100+/g' | bc ) 245ifeq ($(GCC_VERSION),1) 246 ccflags-y += -Wno-packed-bitfield-compat 247endif 248 249############################################################################# 250# Make Targets 251############################################################################# 252 253ifneq ($(KERNELRELEASE),) 254 255ifeq ($(CONFIG_WIRELESS_EXT),y) 256ifeq ($(CONFIG_WEXT_PRIV),y) 257 # Enable WEXT for STA 258 CONFIG_STA_WEXT=y 259 # Enable WEXT for uAP 260 CONFIG_UAP_WEXT=y 261else 262# Disable WEXT for STA 263 CONFIG_STA_WEXT=n 264# Disable WEXT for uAP 265 CONFIG_UAP_WEXT=n 266endif 267endif 268 269# Enable CFG80211 for STA 270ifeq ($(CONFIG_CFG80211),y) 271 CONFIG_STA_CFG80211=y 272else 273ifeq ($(CONFIG_CFG80211),m) 274 CONFIG_STA_CFG80211=y 275else 276 CONFIG_STA_CFG80211=n 277endif 278endif 279 280# OpenWrt 281ifeq ($(CONFIG_OPENWRT_SUPPORT), y) 282ifeq ($(CPTCFG_CFG80211),y) 283 CONFIG_STA_CFG80211=y 284else 285ifeq ($(CPTCFG_CFG80211),m) 286 CONFIG_STA_CFG80211=y 287else 288 CONFIG_STA_CFG80211=n 289endif 290endif 291endif 292 293# Enable CFG80211 for uAP 294ifeq ($(CONFIG_CFG80211),y) 295 CONFIG_UAP_CFG80211=y 296else 297ifeq ($(CONFIG_CFG80211),m) 298 CONFIG_UAP_CFG80211=y 299else 300 CONFIG_UAP_CFG80211=n 301endif 302endif 303 304# OpenWrt 305ifeq ($(CONFIG_OPENWRT_SUPPORT), y) 306ifeq ($(CPTCFG_CFG80211),y) 307 CONFIG_UAP_CFG80211=y 308else 309ifeq ($(CPTCFG_CFG80211),m) 310 CONFIG_UAP_CFG80211=y 311else 312 CONFIG_UAP_CFG80211=n 313endif 314endif 315endif 316 317ifneq ($(CONFIG_STA_SUPPORT),y) 318 CONFIG_WIFI_DIRECT_SUPPORT=n 319 CONFIG_WIFI_DISPLAY_SUPPORT=n 320 CONFIG_STA_WEXT=n 321 CONFIG_STA_CFG80211=n 322endif 323 324ifneq ($(CONFIG_UAP_SUPPORT),y) 325 CONFIG_WIFI_DIRECT_SUPPORT=n 326 CONFIG_WIFI_DISPLAY_SUPPORT=n 327 CONFIG_UAP_WEXT=n 328 CONFIG_UAP_CFG80211=n 329endif 330 331ifeq ($(CONFIG_STA_SUPPORT),y) 332ifeq ($(CONFIG_STA_WEXT),y) 333 ccflags-y += -DSTA_WEXT 334endif 335ifeq ($(CONFIG_STA_CFG80211),y) 336 ccflags-y += -DSTA_CFG80211 337endif 338endif 339ifeq ($(CONFIG_UAP_SUPPORT),y) 340ifeq ($(CONFIG_UAP_WEXT),y) 341 ccflags-y += -DUAP_WEXT 342endif 343ifeq ($(CONFIG_UAP_CFG80211),y) 344 ccflags-y += -DUAP_CFG80211 345endif 346endif 347 348print: 349ifeq ($(CONFIG_STA_SUPPORT),y) 350ifeq ($(CONFIG_STA_WEXT),n) 351ifeq ($(CONFIG_STA_CFG80211),n) 352 @echo "Can not build STA without WEXT or CFG80211" 353 exit 2 354endif 355endif 356endif 357ifeq ($(CONFIG_UAP_SUPPORT),y) 358ifeq ($(CONFIG_UAP_WEXT),n) 359ifeq ($(CONFIG_UAP_CFG80211),n) 360 @echo "Can not build UAP without WEXT or CFG80211" 361 exit 2 362endif 363endif 364endif 365 366 367ifeq ($(CONFIG_DRV_EMBEDDED_AUTHENTICATOR), y) 368 ccflags-y += -DDRV_EMBEDDED_AUTHENTICATOR 369endif 370 371ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT), y) 372 ccflags-y += -DDRV_EMBEDDED_SUPPLICANT 373endif 374 375 376MOALOBJS = mlinux/moal_main.o \ 377 mlinux/moal_ioctl.o \ 378 mlinux/moal_shim.o \ 379 mlinux/moal_eth_ioctl.o 380 381MLANOBJS = mlan/mlan_shim.o mlan/mlan_init.o \ 382 mlan/mlan_txrx.o \ 383 mlan/mlan_cmdevt.o mlan/mlan_misc.o \ 384 mlan/mlan_cfp.o \ 385 mlan/mlan_module.o 386 387MLANOBJS += mlan/mlan_wmm.o 388MLANOBJS += mlan/mlan_sdio.o 389MLANOBJS += mlan/mlan_11n_aggr.o 390MLANOBJS += mlan/mlan_11n_rxreorder.o 391MLANOBJS += mlan/mlan_11n.o 392MLANOBJS += mlan/mlan_11d.o 393MLANOBJS += mlan/mlan_11h.o 394ifeq ($(CONFIG_STA_SUPPORT),y) 395MLANOBJS += mlan/mlan_meas.o 396MLANOBJS += mlan/mlan_scan.o \ 397 mlan/mlan_sta_ioctl.o \ 398 mlan/mlan_sta_rx.o \ 399 mlan/mlan_sta_tx.o \ 400 mlan/mlan_sta_event.o \ 401 mlan/mlan_sta_cmd.o \ 402 mlan/mlan_sta_cmdresp.o \ 403 mlan/mlan_join.o 404ifeq ($(CONFIG_STA_WEXT),y) 405MOALOBJS += mlinux/moal_priv.o \ 406 mlinux/moal_wext.o 407endif 408endif 409ifeq ($(CONFIG_UAP_SUPPORT),y) 410MLANOBJS += mlan/mlan_uap_ioctl.o 411MLANOBJS += mlan/mlan_uap_cmdevent.o 412MLANOBJS += mlan/mlan_uap_txrx.o 413MOALOBJS += mlinux/moal_uap.o 414ifeq ($(CONFIG_UAP_WEXT),y) 415MOALOBJS += mlinux/moal_uap_priv.o 416MOALOBJS += mlinux/moal_uap_wext.o 417endif 418endif 419ifeq ($(CONFIG_STA_CFG80211),y) 420MOALOBJS += mlinux/moal_cfg80211.o 421MOALOBJS += mlinux/moal_cfgvendor.o 422MOALOBJS += mlinux/moal_sta_cfg80211.o 423endif 424ifeq ($(CONFIG_UAP_CFG80211),y) 425MOALOBJS += mlinux/moal_cfg80211.o 426MOALOBJS += mlinux/moal_cfgvendor.o 427MOALOBJS += mlinux/moal_uap_cfg80211.o 428endif 429 430ifdef CONFIG_PROC_FS 431MOALOBJS += mlinux/moal_proc.o 432ifeq ($(CONFIG_PROC_DEBUG),y) 433MOALOBJS += mlinux/moal_debug.o 434endif 435endif 436 437 438 439 440ifeq ($(CONFIG_EMBEDDED_SUPP_AUTH), y) 441MLANOBJS += mlan/esa/common/rc4.o \ 442 mlan/esa/common/aes_cmac_rom.o \ 443 mlan/esa/common/hmac_sha1.o \ 444 mlan/esa/common/md5.o \ 445 mlan/esa/common/mrvl_sha256_crypto.o \ 446 mlan/esa/common/hmac_md5.o \ 447 mlan/esa/common/crypt_new_rom.o \ 448 mlan/esa/common/rijndael.o \ 449 mlan/esa/common/sha1.o \ 450 mlan/esa/common/sha256.o \ 451 mlan/esa/common/pass_phrase.o \ 452 mlan/esa/common/pmkCache.o \ 453 mlan/esa/common/pmkCache_rom.o \ 454 mlan/esa/common/parser.o \ 455 mlan/esa/common/parser_rom.o \ 456 mlan/esa/keyMgmtApStaCommon.o \ 457 mlan/esa/hostsa_init.o \ 458 mlan/esa/authenticator_api.o 459endif 460 461 462ifeq ($(CONFIG_DRV_EMBEDDED_SUPPLICANT),y) 463MLANOBJS += mlan/esa/keyMgmtSta.o \ 464 mlan/esa/keyMgmtSta_rom.o \ 465 mlan/esa/supplicant.o 466endif 467 468ifeq ($(CONFIG_DRV_EMBEDDED_AUTHENTICATOR),y) 469MLANOBJS += mlan/esa/AssocAp_srv_rom.o \ 470 mlan/esa/keyMgmtAp_rom.o \ 471 mlan/esa/keyMgmtAp.o 472endif 473 474ifeq ($(CONFIG_MULTI_INTERFACE),y) 475obj-m := mlan_sdio.o 476mlan_sdio-objs := $(MLANOBJS) 477else 478obj-m := mlan.o 479mlan-objs := $(MLANOBJS) 480endif 481MOALOBJS += mlinux/moal_sdio_mmc.o 482obj-m += sd8xxx.o 483sd8xxx-objs := $(MOALOBJS) 484 485# Otherwise we were called directly from the command line; invoke the kernel build system. 486else 487 488default: 489 $(MAKE) -C $(KERNELDIR) M=$(PWD) modules 490 491endif 492 493############################################################### 494 495export CC LD ccflags-y KERNELDIR 496 497echo: 498 499build: echo default 500 501 @if [ ! -d $(BINDIR) ]; then \ 502 mkdir $(BINDIR); \ 503 fi 504 505ifeq ($(CONFIG_MULTI_INTERFACE),y) 506 cp -f mlan_sdio.$(MODEXT) $(BINDIR)/mlan_sdio$(DBG).$(MODEXT) 507else 508 cp -f mlan.$(MODEXT) $(BINDIR)/mlan$(DBG).$(MODEXT) 509endif 510 cp -f sd8xxx.$(MODEXT) $(BINDIR)/sd8977$(DBG).$(MODEXT) 511 cp -rpf script/sdio_mmc/* $(BINDIR)/ 512 513ifeq ($(CONFIG_STA_SUPPORT),y) 514 cp -f README $(BINDIR) 515 cp -f README_MLAN $(BINDIR) 516ifeq ($(CONFIG_OPENWRT_SUPPORT),y) 517 cp -f README_OPENWRT $(BINDIR) 518endif 519endif 520ifeq ($(CONFIG_UAP_SUPPORT),y) 521 cp -f README_UAP $(BINDIR) 522endif 523ifeq ($(CONFIG_WIFI_DIRECT_SUPPORT),y) 524 cp -f README_WIFIDIRECT $(BINDIR) 525 cp -rpf script/wifidirect $(BINDIR) 526ifeq ($(CONFIG_WIFI_DISPLAY_SUPPORT),y) 527 cp -rpf script/wifidisplay $(BINDIR) 528endif 529endif 530 531clean: 532 -find . -name "*.o" -exec rm {} \; 533 -find . -name "*.ko" -exec rm {} \; 534 -find . -name ".*.cmd" -exec rm {} \; 535 -find . -name "*.mod.c" -exec rm {} \; 536 -find . -name "Module.symvers" -exec rm {} \; 537 -find . -name "Module.markers" -exec rm {} \; 538 -find . -name "modules.order" -exec rm {} \; 539 -find . -name ".*.dwo" -exec rm {} \; 540 -find . -name "*dwo" -exec rm {} \; 541 -rm -rf .tmp_versions 542 543install: default 544 545 cp -f mlan.$(MODEXT) $(INSTALLDIR)/mlan$(DBG).$(MODEXT) 546 cp -f ../io/sdio/$(PLATFORM)/sdio.$(MODEXT) $(INSTALLDIR) 547 cp -f sd8xxx.$(MODEXT) $(INSTALLDIR)/sd8977$(DBG).$(MODEXT) 548 echo "sd8977 Driver Installed" 549 550distclean: 551 -find . -name "*.o" -exec rm {} \; 552 -find . -name "*.orig" -exec rm {} \; 553 -find . -name "*.swp" -exec rm {} \; 554 -find . -name "*.*~" -exec rm {} \; 555 -find . -name "*~" -exec rm {} \; 556 -find . -name "*.d" -exec rm {} \; 557 -find . -name "*.a" -exec rm {} \; 558 -find . -name "tags" -exec rm {} \; 559 -find . -name ".*" -exec rm -rf 2> /dev/null \; 560 -find . -name "*.ko" -exec rm {} \; 561 -find . -name ".*.cmd" -exec rm {} \; 562 -find . -name "*.mod.c" -exec rm {} \; 563 -find . -name ".*.dwo" -exec rm {} \; 564 -find . -name "*dwo" -exec rm {} \; 565 -rm -rf .tmp_versions 566 567# End of file 568