-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.ce
376 lines (299 loc) · 10.9 KB
/
Makefile.ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# 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_CHIP_ID)_$(HIF)
export CONFIG_MTK_PREALLOC_MEMORY=y
#Mstar platform need use prealloc,
#but this need platform insmod prealloc.ko, not suit for all platforms
ifeq "$(UTOPIA)" "true"
export CFG_POWER_OFF_CTRL_SUPPORT=y
ifeq ($(ANDROID),true)
export CONFIG_MTK_PREALLOC_MEMORY=y
endif
endif
WPA3_SUPPORT_VERSION := r-base q-base q-cn r-cn p-cn
ifneq ($(filter $(WPA3_SUPPORT_VERSION), $(MTK_ANDROID_VERSION)),)
$(warning wifi driver MTK_ANDROID_VERSION=$(MTK_ANDROID_VERSION))
export CONFIG_MTK_WPA3_SUPPORT=y
endif
##############################################################
# Platform specific
##############################################################
# Set default platform
#PLATFORM:=MT53XX
PLATFORM:=AML950X4
ifeq ($(TARGET_PRODUCT), rango)
$(warning TARGET_PRODUCT is $(TARGET_PRODUCT))
PLATFORM := AML950X4
endif
ifeq ($(PLATFORM),AML950X4)
$(warning PLATFORM is $(PLATFORM))
KSRC:= $(shell pwd)/$(LINUX_SRC)
$(warning PLATFORM is $(KSRC))
endif
ifeq ($(PLATFORM),avatar)
$(warning CFG_SUPPORT_FWPATH_PREFIX is $(CFG_SUPPORT_FWPATH_PREFIX))
CFG_SUPPORT_FWPATH_PREFIX:=y
endif
64BIT_MODE := false
LINUX_ROOT ?= $(word 1, $(subst /apollo/,/apollo /, $(shell pwd -L)))
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 =============================================)
#- - - - - - - - - - - - - - - - - - - - - - - - - - - -
# MT53XX end
#= = = = = = = = = = = = = = = = = = = = = = = = = = = =
##############################################################
# Compile options
##############################################################
#/***** Common part ******/
# Extend stack limit size to avoid build error
PLATFORM_FLAGS += -Wframe-larger-than=1400
# 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
# For wpa_supplicant w/o MTK priv lib
# y: enable, n: disable
CFG_ANDROID_AOSP_PRIV_CMD=y
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
# 1: Enable SDIO RX Tasklet De-Aggregation
# 0: Disable (default)
CFG_SDIO_RX_AGG_TASKLET=0
# Support disable beacon hint to avoid channel flag be changed.
CFG_SUPPORT_DISABLE_BCN_HINTS=n
#/***** Platform dependent part ******/
ifeq ($(PLATFORM),MT53XX)
CFG_DRIVER_INITIAL_RUNNING_MODE=3
CFG_SUPPORT_SINGLE_SKU_LOCAL_DB=0
endif
ifeq ($(WOW_WAKE_UP), 1)
PLATFORM_FLAGS += -DCFG_SUPPORT_WOW_EINT=1
PLATFORM_FLAGS += -DCFG_SUPPORT_MAGIC_PKT_VENDOR_EVENT=1
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
ifeq ($(CFG_ANDROID_AOSP_PRIV_CMD), y)
PLATFORM_FLAGS += -DCFG_ANDROID_AOSP_PRIV_CMD
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
ifneq ($(CFG_SDIO_RX_AGG_TASKLET),)
PLATFORM_FLAGS += -DCFG_SDIO_RX_AGG_TASKLET=$(CFG_SDIO_RX_AGG_TASKLET)
endif
ifeq ($(CFG_SUPPORT_DISABLE_BCN_HINTS), y)
PLATFORM_FLAGS += -DCFG_SUPPORT_DISABLE_BCN_HINTS
endif
#For adjust channel request interval when ais join net work
ifeq ($(CFG_SUPPORT_ADJUST_JOIN_CH_REQ_INTERVAL),y)
PLATFORM_FLAGS += -DCFG_SUPPORT_ADJUST_JOIN_CH_REQ_INTERVAL
endif
ifeq ($(CFG_SUPPORT_P2P_GO_KEEP_RATE_SETTING), y)
PLATFORM_FLAGS += -DCFG_SUPPORT_P2P_GO_KEEP_RATE_SETTING
endif
ifeq ($(CFG_SUPPORT_P2P_GO_11B_RATE),y)
PLATFORM_FLAGS += -DCFG_SUPPORT_P2P_GO_11B_RATE
endif
ifeq ($(CFG_SUPPORT_P2P_OPEN_SECURITY),y)
PLATFORM_FLAGS += -DCFG_SUPPORT_P2P_OPEN_SECURITY
endif
ifeq ($(CFG_SUPPORT_FWPATH_PREFIX),y)
PLATFORM_FLAGS += -DCFG_SUPPORT_FWPATH_PREFIX
endif
##############################################################
# Compile settings
##############################################################
all: driver
driver:
+make -C $(KSRC) M=$(shell pwd)/$(DRIVER_DIR) PLATFORM_FLAGS="$(PLATFORM_FLAGS)" WLAN_CHIP_ID=$(WLAN_CHIP_ID) modules
ifeq ($(PLATFORM),MSTAR)
$(STRIP) --strip-unneeded $(MODULE_NAME).ko
endif
ifeq ($(PLATFORM),MT53XX)
ifeq ($(DRIVER_PARTIAL_BUILD), y)
@cd $(DRIVER_DIR) && $(STRIP) --strip-unneeded $(MODULE_NAME).ko
else
$(STRIP) --strip-unneeded $(OUT_STA_KO)
ifeq ($(CONFIG_MTK_PREALLOC_MEMORY), y)
$(STRIP) --strip-unneeded $(OUT_STA_KO_DIR)/$(MODULE_NAME)_prealloc.ko
endif
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; \
$(KERNEL_STRIP) $(STRIP_FLAG) $(OUTPUT_ROOT)/basic/wifi_ko/$(MODULE_NAME).ko; \
fi
else
if [ ! -d $(OUTPUT_ROOT)/basic/modules ]; then \
mkdir -p $(OUTPUT_ROOT)/basic/modules/; \
fi
ifeq ($(MUL_WIFI_HW_COMPATIBLE), true)
if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \
cp -f $(OUT_STA_KO) $(OUTPUT_ROOT)/basic/modules/wlan_mt7668.ko; \
fi
else
if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \
cp -f $(OUT_STA_KO) $(OUTPUT_ROOT)/basic/modules/wlan.ko; \
fi
endif
ifeq ($(CONFIG_MTK_PREALLOC_MEMORY), y)
ifeq ($(MUL_WIFI_HW_COMPATIBLE), true)
if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \
cp -f $(OUT_STA_KO_DIR)/$(MODULE_NAME)_prealloc.ko $(OUTPUT_ROOT)/basic/modules/mtprealloc_mt7668.ko; \
fi
else
if [ -d $(OUTPUT_ROOT)/basic/modules ]; then \
cp -f $(OUT_STA_KO_DIR)/$(MODULE_NAME)_prealloc.ko $(OUTPUT_ROOT)/basic/modules/mtprealloc.ko; \
fi
endif
endif
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) ]; then \
cd $(DRIVER_DIR); \
find -L \
\( -name '*.ko' -o -name '.*.cmd' \
-o -name '*.o' -o -name '*.mod.c' \
-o -name '*.o.d' \
-o -name 'modules.order' \
-o -name 'Module.symvers' \) -type f -print | xargs rm -f; \
find -L \( -name '.tmp_versions' \) -print | xargs rm -rf {}; \
fi
.PHONY: all clean driver driver_clean