-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
406 lines (352 loc) · 11.4 KB
/
Makefile
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
#MODE - STA or AP
ifeq ($(WIFI_MODE),)
RT28xx_MODE = STA
else
RT28xx_MODE = $(WIFI_MODE)
endif
CFLAGS = "-Wno-error=date-time -Wno-unused-variable -Wno-unused-value -Wno-unused-label -Wno-unused-parameter -Wno-unused-function -Wno-unused -Wno-error=unused-local-typedefs -Wno-error=misleading-indentation"
#TARTET - LINUX, UCOS, ECOS, or THREADX.
ifeq ($(TARGET),)
TARGET = LINUX
endif
# CHIPSET
# rt2860, rt2870, rt2880, rt2070, rt3070, rt3090, rt3572, rt3062, rt3562, rt3593, rt3573
# rt3562(for rt3592), rt3050, rt3350, rt3352, rt5350, rt5370, rt5390, rt5572, rt5592,
# rt8592(for rt85592),
# mt7601e, mt7601u,
# mt7650e, mt7630e, mt7610e, mt7650u, mt7630u, mt7610u
# mt7662e, mt7632e, mt7612e, mt7662u, mt7632u, mt7612u
# mt7603e, mt7603u, mt7636u, mt7636s
ifeq ($(CHIPSET),)
CHIPSET = mt7601u
#CHIPSET = mt7650e mt7630e mt7610e
#CHIPSET = mt7650u mt7630u mt7610u
#CHIPSET = mt7662e mt7632e mt7612e
#CHIPSET = mt7662u mt7632u mt7612u
#CHIPSET = mt7603e
#CHIPSET = mt7603u
#CHIPSET = mt7636u
#CHIPSET = mt7636s
endif
MODULE = $(word 1, $(CHIPSET))
#OS ABL - YES or NO
OSABL = NO
#Build Prealloc ko
PREALLOC = NO
ifneq ($(TARGET),THREADX)
#RT28xx_DIR = home directory of RT28xx source code
RT28xx_DIR = $(shell pwd)
endif
include $(RT28xx_DIR)/os/linux/config.mk
RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(MODULE)
#PLATFORM: Target platform
PLATFORM = PC
#PLATFORM = MSTAR
#PLATFORM = HISILICON
#PLATFORM = HE_TV
LINUX_SRC =
CROSS_COMPILE =
#APSOC
ifeq ($(MODULE),3050)
PLATFORM = RALINK_3050
endif
ifeq ($(MODULE),3052)
PLATFORM = RALINK_3052
endif
ifeq ($(MODULE),3350)
PLATFORM = RALINK_3050
endif
ifeq ($(MODULE),3352)
PLATFORM = RALINK_3352
endif
ifeq ($(CHIPSET),mt7628)
PLATFORM = MT7628
endif
#RELEASE Package
RELEASE = DPOA
ifeq ($(TARGET),LINUX)
MAKE = make
endif
ifeq ($(TARGET), UCOS)
MAKE = make
endif
ifeq ($(TARGET),THREADX)
MAKE = gmake
endif
ifeq ($(TARGET), ECOS)
MAKE = make
MODULE = $(shell pwd | sed "s/.*\///" ).o
export MODULE
endif
ifeq ($(PLATFORM),PC)
PREALLOC = NO
# Linux 2.6
LINUX_SRC = /lib/modules/$(shell uname -r)/build
# Linux 2.4 Change to your local setting
#LINUX_SRC = /usr/src/linux-2.4
LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/
endif
ifeq ($(PLATFORM),MSTAR)
PREALLOC = YES
endif
ifeq ($(PLATFORM),HISILICON)
PREALLOC = YES
endif
ifeq ($(PLATFORM),HE_TV)
PREALLOC = NO
TARGET = LINUX
#****** For system auto build ******
#LINUX_SRC=$(KERNEL_OBJ_ROOT)/$(KERNEL_VER)/$(KERNEL_CONFIG)_modules
#****** For local build ******
# uncomment the following lines
VM_LINUX_ROOT ?= $(word 1, $(subst /vm_linux/,/vm_linux /, $(shell pwd)))
LINUX_ROOT ?= $(VM_LINUX_ROOT)
ifeq ($(LINUX_SRC),)
LINUX_SRC=$(VM_LINUX_ROOT)/output/mtk_android/mt5399_cn_android/rel/obj/kernel/chiling/kernel/linux-3.10/mt5399_android_smp_mod_defconfig_modules
endif
OBJ_ROOT ?= $(VM_LINUX_ROOT)/output/mtk_android/mt5399_cn_android/rel/obj
export KERNEL_OBJ_ROOT=$(LINUX_SRC)/../..
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 CC=$(CC) for wifi driver LINUX_SRC=$(LINUX_SRC))
$(warning TARGET=$(TARGET))
$(warning =============================================)
endif
export OSABL RT28xx_DIR RT28xx_MODE LINUX_SRC CROSS_COMPILE CROSS_COMPILE_INCLUDE PLATFORM RELEASE CHIPSET MODULE RTMP_SRC_DIR LINUX_SRC_MODULE TARGET HAS_WOW_SUPPORT PREALLOC
# The targets that may be used.
PHONY += all build_tools test UCOS THREADX LINUX release prerelease clean uninstall install libwapi osabl sdk_build_tools
ifeq ($(TARGET),LINUX)
all: build_tools $(TARGET) plug_in
else
all: $(TARGET)
endif
build_tools:
$(MAKE) -C tools
$(RT28xx_DIR)/tools/bin2h
sdk_build_tools:
if [ -f $(RT28xx_DIR)/eeprom_log ]; then \
rm -f $(RT28xx_DIR)/eeprom_log
fi
echo $(EE_TYPE) >> eeprom_log
echo $(CHIPSET) >> eeprom_log
if [ -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin ]; then \
echo 'find SA/MT7603E_EEPROM.bin' >> eeprom_log ; \
cp -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin $(RT28xx_DIR)/eeprom/MT7603E_EEPROM.bin ; \
else \
cp -f $(RT28xx_DIR)/eeprom/$(EE_TYPE)/MT7603E_EEPROM.bin $(RT28xx_DIR)/eeprom/MT7603E_EEPROM.bin ; \
fi
$(MAKE) -C tools
$(RT28xx_DIR)/tools/bin2h
# rm -f $(RT28xx_DIR)/eeprom/SA/MT7603E_EEPROM.bin
test:
$(MAKE) -C tools test
UCOS:
$(MAKE) -C os/ucos/ MODE=$(RT28xx_MODE)
echo $(RT28xx_MODE)
ECOS:
$(MAKE) -C os/ecos/ MODE=$(RT28xx_MODE)
cp -f os/ecos/$(MODULE) $(MODULE)
THREADX:
$(MAKE) -C $(RT28xx_DIR)/os/Threadx -f $(RT28xx_DIR)/os/ThreadX/Makefile
LINUX:
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.4.util $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
endif
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
endif
ifeq ($(RT28xx_MODE),AP)
ifneq ($(PLATFORM),BB_SOC)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap.o /tftpboot
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_ap.o /tftpboot
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_ap.o /tftpboot
endif
ifeq ($(PLATFORM),INF_AMAZON_SE)
cp -f /tftpboot/rt2870ap.o /backup/ifx/build/root_filesystem/lib/modules/2.4.31-Amazon_SE-3.6.2.2-R0416_Ralink/kernel/drivers/net
endif
endif #BB_SOC
else #AP
ifeq ($(RT28xx_MODE),APSTA)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta.o /tftpboot
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_apsta.o /tftpboot
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_apsta.o /tftpboot
endif
else #APSTA
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta.o /tftpboot
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/rtutil$(MODULE)_sta.o /tftpboot
cp -f $(RT28xx_DIR)/os/linux/rtnet$(MODULE)_sta.o /tftpboot
endif
endif #APSTA
endif #AP
else #2.4
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
endif
ifeq ($(PREALLOC), YES)
#build prealloc.ko
cp -f os/linux/Makefile.6.prealloc os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
endif
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
ifeq ($(PLATFORM),DM6446)
$(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
else
ifeq ($(PLATFORM),FREESCALE8377)
$(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
else
#build mt7603u_sta.ko
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
endif
endif #DM6446
ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
endif
ifeq ($(RT28xx_MODE),AP)
ifneq ($(PLATFORM),BB_SOC)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap.ko /tftpboot
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap_util.ko /tftpboot
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_ap_net.ko /tftpboot
endif
else #BB_SOC
rm -f os/linux/$(MODULE)_ap.ko.lzma
/root/bin/lzma e os/linux/$(MODULE)_ap.ko os/linux/$(MODULE)_ap.ko.lzma
endif #BB_SOC
else #AP
ifeq ($(RT28xx_MODE),APSTA)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta.ko /tftpboot
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta_util.ko /tftpboot
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_apsta_net.ko /tftpboot
endif
else #APSTA
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta_util.ko /tftpboot
cp -f $(RT28xx_DIR)/os/linux/$(MODULE)_sta_net.ko /tftpboot
endif
endif #APSTA
endif #AP
endif #2.4
ifeq ($(PLATFORM),MT85XX)
mkdir -p $(RT28xx_DIR)/../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
endif
plug_in:
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/tools/plug_in MODULE_FLAGS="$(WFLAGS)"
release: build_tools
$(MAKE) -C $(RT28xx_DIR)/striptool -f Makefile.release clean
$(MAKE) -C $(RT28xx_DIR)/striptool -f Makefile.release
striptool/striptool.out
ifeq ($(PLATFORM),MT85XX)
cp -f tools/osabl_check.sh $(RELEASE)/
endif
ifeq ($(RELEASE), DPO)
gcc -o striptool/banner striptool/banner.c
./striptool/banner -b striptool/copyright.gpl -s DPO/ -d DPO_GPL -R
./striptool/banner -b striptool/copyright.frm -s DPO_GPL/include/firmware.h
endif
prerelease:
ifeq ($(MODULE), 2880)
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.release.2880 prerelease
else
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.release prerelease
endif
cp $(RT28xx_DIR)/os/linux/Makefile.DPB $(RTMP_SRC_DIR)/os/linux/.
cp $(RT28xx_DIR)/os/linux/Makefile.DPA $(RTMP_SRC_DIR)/os/linux/.
cp $(RT28xx_DIR)/os/linux/Makefile.DPC $(RTMP_SRC_DIR)/os/linux/.
ifeq ($(RT28xx_MODE),STA)
cp $(RT28xx_DIR)/os/linux/Makefile.DPD $(RTMP_SRC_DIR)/os/linux/.
cp $(RT28xx_DIR)/os/linux/Makefile.DPO $(RTMP_SRC_DIR)/os/linux/.
endif
clean:
ifeq ($(TARGET), LINUX)
cp -f os/linux/Makefile.clean os/linux/Makefile
$(MAKE) -C os/linux clean
rm -rf os/linux/Makefile
endif
ifeq ($(TARGET), UCOS)
$(MAKE) -C os/ucos clean MODE=$(RT28xx_MODE)
endif
ifeq ($(TARGET), ECOS)
$(MAKE) -C os/ecos clean MODE=$(RT28xx_MODE)
endif
uninstall:
ifeq ($(TARGET), LINUX)
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 uninstall
else
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 uninstall
endif
endif
install:
ifeq ($(TARGET), LINUX)
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 install
else
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 install
endif
endif
libwapi:
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
cp -f os/linux/Makefile.libwapi.4 $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.libwapi.6 $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
endif
osutil:
ifeq ($(OSABL),YES)
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
cp -f os/linux/Makefile.4.util $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6.util $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
ifeq ($(PLATFORM),MT85XX)
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
endif
endif
endif
osnet:
ifeq ($(OSABL),YES)
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6.netif $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
ifeq ($(PLATFORM),MT85XX)
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
endif
endif
endif
osdrv:
ifneq (,$(findstring 2.4.,$(LINUX_SRC)))
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
else
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
ifeq ($(PLATFORM),MT85XX)
ifeq ($(OSABL),YES)
cp -f $(RT28xx_DIR)/os/linux/mt7603u_sta.ko $(RT28xx_DIR)/../../../../../../BDP_Generic/build_linux_ko/src/driver/wlan/
endif
endif
endif
# Declare the contents of the .PHONY variable as phony. We keep that information in a variable
.PHONY: $(PHONY)