9b07ac795c70ba07edf6243b1da4f9854590e776
[oweals/u-boot_mod.git] / u-boot / Makefile
1 #
2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 #
5 # See file CREDITS for list of people who contributed to this
6 # project.
7 #
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 # MA 02111-1307 USA
22 #
23
24 VERSION                 = 1
25 PATCHLEVEL              = 1
26 SUBLEVEL                = 4
27 EXTRAVERSION    = -$(shell git rev-parse --short=8 HEAD)
28 ISREPODIRTY             = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi)
29 VERSION_FILE    = include/version_autogenerated.h
30
31 # Show in version string if we are not building from clean repository
32 ifeq ($(ISREPODIRTY), 1)
33 U_BOOT_VERSION  = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty"
34 else
35 U_BOOT_VERSION  = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean"
36 endif
37
38 HOSTARCH := $(shell uname -m | \
39         sed -e s/i.86/i386/ \
40             -e s/sun4u/sparc64/ \
41             -e s/arm.*/arm/ \
42             -e s/sa110/arm/ \
43             -e s/powerpc/ppc/ \
44             -e s/macppc/ppc/)
45
46 HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
47             sed -e 's/\(cygwin\).*/cygwin/')
48
49 export  HOSTARCH HOSTOS
50
51 # Deal with colliding definitions from tcsh etc.
52 VENDOR=
53
54 #########################################################################
55
56 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
57 export  TOPDIR
58
59 ifdef COMPRESSED_UBOOT
60         ifndef CONFIG_SKIP_LOWLEVEL_INIT
61 COMPRESSED_UBOOT = 1
62 export export COMPRESSED_UBOOT
63         endif
64 endif
65
66 ifeq (include/config.mk,$(wildcard include/config.mk))
67 # load ARCH, BOARD, and CPU configuration
68 include include/config.mk
69 export  ARCH CPU BOARD VENDOR SOC
70 ifndef CROSS_COMPILE
71 ifeq ($(HOSTARCH),ppc)
72 CROSS_COMPILE =
73 else
74 ifeq ($(ARCH),ppc)
75 CROSS_COMPILE = powerpc-linux-
76 endif
77 ifeq ($(ARCH),arm)
78 CROSS_COMPILE = arm-linux-
79 endif
80 ifeq ($(ARCH),i386)
81 ifeq ($(HOSTARCH),i386)
82 CROSS_COMPILE =
83 else
84 CROSS_COMPILE = i386-linux-
85 endif
86 endif
87 ifeq ($(ARCH),mips)
88 CROSS_COMPILE = mips-linux-
89 endif
90 ifeq ($(ARCH),nios)
91 CROSS_COMPILE = nios-elf-
92 endif
93 ifeq ($(ARCH),nios2)
94 CROSS_COMPILE = nios2-elf-
95 endif
96 ifeq ($(ARCH),m68k)
97 CROSS_COMPILE = m68k-elf-
98 endif
99 ifeq ($(ARCH),microblaze)
100 CROSS_COMPILE = mb-
101 endif
102 ifeq ($(ARCH),blackfin)
103 CROSS_COMPILE = bfin-elf-
104 endif
105 endif
106 endif
107
108 export  CROSS_COMPILE
109
110 # load other configuration
111 include $(TOPDIR)/config.mk
112
113
114 #########################################################################
115 # U-Boot objects....order is important (i.e. start must be first)
116 OBJS  = cpu/$(CPU)/start.o
117
118 ifdef COMPRESSED_UBOOT
119         ifndef CONFIG_SKIP_LOWLEVEL_INIT
120 OBJS_BOOTSTRAP  = cpu/$(CPU)/start_bootstrap.o
121         endif
122 endif
123
124 LIBS  = lib_generic/libgeneric.a
125 LIBS += common/libcommon.a
126 LIBS += board/$(BOARDDIR)/lib$(BOARD).a
127 LIBS += cpu/$(CPU)/lib$(CPU).a
128
129 ifdef SOC
130 LIBS += cpu/$(CPU)/$(SOC)/lib$(SOC).a
131 endif
132
133 LIBS += lib_$(ARCH)/lib$(ARCH).a
134 LIBS += drivers/libdrivers.a
135 LIBS += net/libnet.a
136 LIBS += rtc/librtc.a
137 LIBS += httpd/libhttpd.a
138 LIBS += $(BOARDLIBS)
139
140 ifdef COMPRESSED_UBOOT
141         ifndef CONFIG_SKIP_LOWLEVEL_INIT
142 LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a 
143 LIBS_BOOTSTRAP += board/$(BOARDDIR)/lib$(BOARD).a 
144 LIBS_BOOTSTRAP += cpu/$(CPU)/lib$(CPU).a
145 LIBS_BOOTSTRAP += cpu/$(CPU)/$(SOC)/lib$(SOC).a
146         endif
147 endif
148
149 .PHONY : $(LIBS)
150
151 ifdef COMPRESSED_UBOOT
152         ifndef CONFIG_SKIP_LOWLEVEL_INIT
153 .PHONY : $(LIBS_BOOTSTRAP)
154         endif
155 endif
156
157 # Add GCC lib
158 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
159
160 # The "tools" are needed early, so put this first
161 # Don't include stuff already done in $(LIBS)
162 SUBDIRS = tools
163
164 .PHONY : $(SUBDIRS)
165
166 #########################################################################
167 #########################################################################
168
169 ALL = u-boot.srec u-boot.bin System.map
170
171 ifdef COMPRESSED_UBOOT
172 ifndef CONFIG_SKIP_LOWLEVEL_INIT
173 all:    $(ALL) tuboot.bin
174 else
175 all:    $(ALL) u-boot.img
176 endif
177 else
178 all:    $(ALL) u-boot.img
179 endif
180
181 u-boot.hex:     u-boot
182         $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
183
184 u-boot.srec:    u-boot
185         $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
186
187 u-boot.bin:     u-boot
188         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
189
190 u-boot.img:     u-boot.bin
191         @/bin/echo -e "\e[32m> Preparing U-Boot image \"u-boot.img\"...\e[0m"
192         ./tools/mkimage -A $(ARCH) -T firmware -C none \
193                 -a $(TEXT_BASE) -e 0 \
194                 -n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' $(VERSION_FILE) | \
195                 sed -e 's/"[     ]*$$/ for $(BOARD) board"/') \
196                 -d $< $@
197
198 u-boot.dis:     u-boot
199         $(OBJDUMP) -d $< > $@
200
201 u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
202         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
203                 $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
204                 --start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
205                 -Map u-boot.map -o u-boot
206
207 $(LIBS):
208         $(MAKE) -C `dirname $@`
209
210 $(SUBDIRS):
211         $(MAKE) -C $@ all
212
213 ifdef COMPRESSED_UBOOT
214 ifndef CONFIG_SKIP_LOWLEVEL_INIT
215 LZMA = $(BUILD_TOPDIR)/host_util/lzma
216
217 tuboot.bin:     System.map bootstrap.bin u-boot.lzimg   
218         @cat bootstrap.bin > $@
219         @cat u-boot.lzimg >> $@
220
221 u-boot.lzimg: $(obj)u-boot.bin System.map
222         @rm -rf u-boot.bin.lzma
223         $(LZMA) --best --keep $(obj)u-boot.bin
224         @/bin/echo -e "\e[32m> Preparing compressed U-Boot image \"u-boot.lzimg\"...\e[0m"
225         ./tools/mkimage -A mips -T firmware -C lzma \
226                 -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
227                 -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | awk '{ printf "%s", $$1 }') \
228                 -n 'u-boot image' -d $(obj)u-boot.bin.lzma $@
229
230 bootstrap.bin:  bootstrap
231         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
232
233 bootstrap:      depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LDSCRIPT_BOOTSTRAP)
234         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
235                 $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
236                 --start-group $(LIBS_BOOTSTRAP) --end-group $(PLATFORM_LIBS) \
237                 -Map bootstrap.map -o bootstrap
238
239 $(LIBS_BOOTSTRAP):
240         $(MAKE) -C `dirname $@`
241 endif
242 endif
243
244 version:
245         @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
246                 echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
247                 echo "\"" >> $(VERSION_FILE)
248
249 gdbtools:
250         $(MAKE) -C tools/gdb || exit 1
251
252 depend dep:
253         @for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
254
255 tags:
256         ctags -w `find $(SUBDIRS) include \
257                 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
258                 fs/cramfs fs/fat fs/fdos fs/jffs2 \
259                 net disk rtc dtt drivers drivers/sk98lin common \
260                 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
261
262 etags:
263         etags -a `find $(SUBDIRS) include \
264                 lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
265                 fs/cramfs fs/fat fs/fdos fs/jffs2 \
266                 net disk rtc dtt drivers drivers/sk98lin common \
267                 \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
268
269 System.map:     u-boot
270         @$(NM) $< | \
271                 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
272                 sort > System.map
273
274 #########################################################################
275 else
276 all install u-boot u-boot.srec depend dep:
277         @echo "System not configured - see README" >&2
278         @ exit 1
279 endif
280
281 #########################################################################
282
283 unconfig:
284         @rm -f include/config.h include/config.mk board/*/config.tmp
285
286 #========================================================================
287 # MIPS
288 #========================================================================
289 #########################################################################
290 ## MIPS32 AR7100 (24K)
291 #########################################################################
292 common_config :
293         @ >include/config.h
294         @echo "/* Temporary solution */"             >> include/config.h
295         @echo "/* AR933x */"                         >> include/config.h
296         @echo "#define QCA_AR9330_SOC           0x00001" >> include/config.h
297         @echo "#define QCA_AR9331_SOC           0x00002" >> include/config.h
298         @echo "#define QCA_AR933X_SOC           (QCA_AR9330_SOC | QCA_AR9331_SOC)" >> include/config.h
299         @echo "/* AR934x */"                         >> include/config.h
300         @echo "#define QCA_AR9341_SOC           0x00010" >> include/config.h
301         @echo "#define QCA_AR9342_SOC           0x00020" >> include/config.h
302         @echo "#define QCA_AR9344_SOC           0x00040" >> include/config.h
303         @echo "#define QCA_AR934X_SOC           (QCA_AR9341_SOC | QCA_AR9342_SOC | QCA_AR9344_SOC)" >> include/config.h
304         @echo "/* QCA953x */"                        >> include/config.h
305         @echo "#define QCA_QCA9531_SOC          0x00100" >> include/config.h
306         @echo "#define QCA_QCA9533_SOC          0x00200" >> include/config.h
307         @echo "#define QCA_QCA953X_SOC          (QCA_QCA9531_SOC | QCA_QCA9533_SOC)" >> include/config.h
308         @echo "/* QCA956x */"                        >> include/config.h
309         @echo "#define QCA_QCA9561_SOC          0x01000" >> include/config.h
310         @echo "#define QCA_QCA9563_SOC          0x02000" >> include/config.h
311         @echo "#define QCA_QCA956X_SOC          (QCA_QCA9561_SOC | QCA_QCA9563_SOC)" >> include/config.h
312         @echo "/* QCA955x */"                        >> include/config.h
313         @echo "#define QCA_QCA9557_SOC          0x10000" >> include/config.h
314         @echo "#define QCA_QCA9558_SOC          0x20000" >> include/config.h
315         @echo "#define QCA_QCA955X_SOC          (QCA_QCA9557_SOC | QCA_QCA9558_SOC)" >> include/config.h
316         @echo ""                                     >> include/config.h
317
318 ifdef CONFIG_BOOTDELAY
319         @echo "#define CONFIG_BOOTDELAY "$(CONFIG_BOOTDELAY)   >> include/config.h
320 endif
321
322 ifdef CONFIG_MAX_UBOOT_SIZE_KB
323         @echo "#define CONFIG_MAX_UBOOT_SIZE_KB "$(CONFIG_MAX_UBOOT_SIZE_KB) >> include/config.h
324 endif
325
326 ifdef DISABLE_CONSOLE_OUTPUT
327         @echo "#define CONFIG_SILENT_CONSOLE                1" >> include/config.h
328 endif
329
330 ifdef CONFIG_SKIP_LOWLEVEL_INIT
331         @echo "#define CONFIG_SKIP_LOWLEVEL_INIT            1" >> include/config.h
332         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
333 endif
334
335         @echo "#define CONFIG_DELAY_TO_AUTORUN_HTTPD        3" >> include/config.h
336         @echo "#define CONFIG_DELAY_TO_AUTORUN_CONSOLE      5" >> include/config.h
337         @echo "#define CONFIG_DELAY_TO_AUTORUN_NETCONSOLE   7" >> include/config.h
338
339         # max delay time for button pressing
340         @echo "#define CONFIG_MAX_BUTTON_PRESSING          10" >> include/config.h
341
342         # don't show info about console (in, out, err...)
343         @echo "#define CFG_CONSOLE_INFO_QUIET"                 >> include/config.h
344
345 hornet_common_config : common_config
346         @echo "#define SOC_TYPE                QCA_AR933X_SOC" >> include/config.h
347         @echo "#define CONFIG_MACH_HORNET                   1" >> include/config.h
348
349 wr703n_config : unconfig hornet_common_config
350         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR703N at:' `date` '\e[0m'
351         @echo "#define CONFIG_FOR_TPLINK_WR703N_V1          1" >> include/config.h
352         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
353         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
354         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
355         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR703N\"" >> include/config.h
356
357         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
358
359 wr720n_v3_CN_config : unconfig hornet_common_config
360         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR720N v3 CN at:' `date` '\e[0m'
361         @echo "#define CONFIG_FOR_TPLINK_WR720N_V3          1" >> include/config.h
362         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
363         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
364         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
365         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR720N v3 CN\"" >> include/config.h
366
367         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
368
369 wr710n_config : unconfig hornet_common_config
370         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR710N at:' `date` '\e[0m'
371         @echo "#define CONFIG_FOR_TPLINK_WR710N_V1          1" >> include/config.h
372         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
373         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
374         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
375         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR710N\"" >> include/config.h
376
377         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
378
379 mr3020_config : unconfig hornet_common_config
380         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3020 at:' `date`.'\e[0m'
381         @echo "#define CONFIG_FOR_TPLINK_MR3020_V1          1" >> include/config.h
382         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
383         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
384         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
385         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3020\"" >> include/config.h
386
387         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
388
389 mr3040_config : unconfig hornet_common_config
390         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3040 at:' `date` '\e[0m'
391         @echo "#define CONFIG_FOR_TPLINK_MR3040_V1V2        1" >> include/config.h
392         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
393         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
394         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
395         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3040\"" >> include/config.h
396
397         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
398
399 mr10u_config : unconfig hornet_common_config
400         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR10U at:' `date` '\e[0m'
401         @echo "#define CONFIG_FOR_TPLINK_MR10U_V1           1" >> include/config.h
402         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
403         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
404         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
405         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR10U\"" >> include/config.h
406
407         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
408
409 mr13u_config : unconfig hornet_common_config
410         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR13U at:' `date` '\e[0m'
411         @echo "#define CONFIG_FOR_TPLINK_MR13U_V1           1" >> include/config.h
412         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
413         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
414         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
415         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR13U\"" >> include/config.h
416
417         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
418
419 wr740n_v4_config : unconfig hornet_common_config
420         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR740N v4 at:' `date` '\e[0m'
421         @echo "#define CONFIG_FOR_TPLINK_WR740N_V4          1" >> include/config.h
422         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
423         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
424         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
425         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR74xN/D v4\"" >> include/config.h
426
427         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
428
429 mr3220_v2_config : unconfig hornet_common_config
430         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3220 v2 at:' `date` '\e[0m'
431         @echo "#define CONFIG_FOR_TPLINK_MR3220_V2          1" >> include/config.h
432         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
433         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
434         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
435         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3220 v2\"" >> include/config.h
436
437         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
438
439 dir505_config : unconfig hornet_common_config
440         @/bin/echo -e '\e[32m> Configuring for D-Link DIR-505 at:' `date` '\e[0m'
441         @echo "#define CONFIG_FOR_DLINK_DIR505_A1           1" >> include/config.h
442         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
443         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
444         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
445         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"D-Link DIR-505\"" >> include/config.h
446
447         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
448
449 gs_oolite_v1_dev_config : unconfig hornet_common_config
450         @/bin/echo -e '\e[32m> Configuring for GS-Oolite v1 with dev board at:' `date` '\e[0m'
451         @echo "#define CONFIG_FOR_GS_OOLITE_V1_DEV          1" >> include/config.h
452         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
453         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
454         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Gainstrong GS-Oolite v1\"" >> include/config.h
455
456         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
457
458 black_swift_board_config : unconfig hornet_common_config
459         @echo '======= Configuring for Black Swift board (128K compressed) at:' `date` '======='
460         @echo "#define CONFIG_FOR_BLACK_SWIFT_BOARD         1" >> include/config.h
461         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
462         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
463         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
464         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Black Swift board\"" >> include/config.h
465
466         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
467
468 carambola2_config : unconfig hornet_common_config
469         @/bin/echo -e '\e[32m> Configuring for 8devices Carambola 2 at:' `date` '\e[0m'
470         @echo "#define CONFIG_FOR_8DEVICES_CARAMBOLA2       1" >> include/config.h
471         @echo "#undef COMPRESSED_UBOOT"                        >> include/config.h
472         @echo "#define CONFIG_40MHZ_XTAL_SUPPORT            1" >> include/config.h
473         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
474         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
475         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
476         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"8devices Carambola2 v1\"" >> include/config.h
477
478         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
479
480 dragino_v2_ms14_config : unconfig hornet_common_config
481         @/bin/echo -e '\e[32m> Configuring for Dragino Dragino v2 (MS14) at:' `date` '\e[0m'
482         @echo "#define CONFIG_FOR_DRAGINO_V2                1" >> include/config.h
483         @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
484         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
485         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
486         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
487         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
488         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
489         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Dragino v2 MS14\"" >> include/config.h
490
491         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
492
493 villagetelco_mp2_config : unconfig hornet_common_config
494         @/bin/echo -e '\e[32m> Configuring for Village Telco Mesh Potato 2 at:' `date` '\e[0m'
495         @echo "#define CONFIG_FOR_MESH_POTATO_V2            1" >> include/config.h
496         @echo "#undef  COMPRESSED_UBOOT"                       >> include/config.h
497         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
498         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
499         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB     16" >> include/config.h
500         @echo "#define WEBFAILSAFE_DISABLE_ART_UPGRADE      1" >> include/config.h
501         @echo "#define WEBFAILSAFE_DISABLE_UBOOT_UPGRADE    1" >> include/config.h
502         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Village Telco Mesh Potato 2\"" >> include/config.h
503
504         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
505
506 gl-inet_config : unconfig hornet_common_config
507         @/bin/echo -e '\e[32m> Configuring for GL.iNet at:' `date` '\e[0m'
508         @echo "#define CONFIG_FOR_GL_INET                   1" >> include/config.h
509         @echo "#define CONFIG_GPIO_RESET_BTN               11" >> include/config.h
510         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
511         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"GL.iNet\"" >> include/config.h
512
513         @./mkconfig -a ap121 mips mips ap121 ar7240 ar7240
514
515 wasp_common_config : common_config
516         @echo "#define CONFIG_WASP                          1" >> include/config.h
517         @echo "#define CONFIG_WASP_SUPPORT                  1" >> include/config.h
518
519 wdr3600_43x0_config : unconfig wasp_common_config
520         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WDR3600/43x0 at:' `date` '\e[0m'
521         @echo "#define SOC_TYPE                QCA_AR9344_SOC" >> include/config.h
522         @echo "#define CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1 1" >> include/config.h
523         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
524         @echo "#define CFG_ATHRS17_PHY                      1" >> include/config.h
525         @echo "#define CFG_AG7240_NMACS                     1" >> include/config.h
526         @echo "#define CFG_DUAL_PHY_SUPPORT                 1" >> include/config.h
527         @echo "#define CONFIG_GPIO_RESET_BTN               16" >> include/config.h
528         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
529         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
530         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
531         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WDR3600/43x0\"" >> include/config.h
532
533         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
534
535 wdr3500_config : unconfig wasp_common_config
536         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WDR3500 at:' `date` '\e[0m'
537         @echo "#define SOC_TYPE                QCA_AR9344_SOC" >> include/config.h
538         @echo "#define CONFIG_FOR_TPLINK_WDR3500_V1         1" >> include/config.h
539         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
540         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
541         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
542         @echo "#define CONFIG_GPIO_RESET_BTN               16" >> include/config.h
543         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
544         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
545         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
546         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WDR3500\"" >> include/config.h
547
548         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
549
550 mr3420_v2_config : unconfig wasp_common_config
551         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-MR3420 v2 at:' `date` '\e[0m'
552         @echo "#define SOC_TYPE                QCA_AR9341_SOC" >> include/config.h
553         @echo "#define CONFIG_FOR_TPLINK_MR3420_V2          1" >> include/config.h
554         @echo "#define CONFIG_AP123                         1" >> include/config.h
555         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
556         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
557         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
558         @echo "#define CONFIG_GPIO_RESET_BTN               17" >> include/config.h
559         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
560         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
561         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
562         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-MR3420 v2\"" >> include/config.h
563
564         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
565
566 wr841n_v8_config : unconfig wasp_common_config
567         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v8 at:' `date` '\e[0m'
568         @echo "#define SOC_TYPE                QCA_AR9341_SOC" >> include/config.h
569         @echo "#define CONFIG_FOR_TPLINK_WR841N_V8          1" >> include/config.h
570         @echo "#define CONFIG_AP123                         1" >> include/config.h
571         @echo "#define DDR2_32BIT_SUPPORT                   1" >> include/config.h
572         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
573         @echo "#define CFG_AG7240_NMACS                     2" >> include/config.h
574         @echo "#define CONFIG_GPIO_RESET_BTN               17" >> include/config.h
575         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
576         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
577         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
578         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR841N/D v8\"" >> include/config.h
579
580         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
581
582 wa830re_v2_wa801nd_v2_config : unconfig wasp_common_config
583         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WA830RE/TL-WA801ND v2 at:' `date` '\e[0m'
584         @echo "#define SOC_TYPE                   QCA_AR9341_SOC" >> include/config.h
585         @echo "#define CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2 1" >> include/config.h
586         @echo "#define CONFIG_AP123                            1" >> include/config.h
587         @echo "#define DDR2_32BIT_SUPPORT                      1" >> include/config.h
588         @echo "#define CFG_ATHRS27_PHY                         1" >> include/config.h
589         @echo "#define CFG_AG7240_NMACS                        2" >> include/config.h
590         @echo "#define CONFIG_GPIO_RESET_BTN                  17" >> include/config.h
591         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW        1" >> include/config.h
592         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB         4" >> include/config.h
593         @echo "#define CONFIG_TPLINK_IMAGE_HEADER              1" >> include/config.h
594         @echo "#define CONFIG_BOARD_CUSTOM_STRING              \"TP-Link TL-WA830RE/TL-WA801ND v2\"" >> include/config.h
595
596         @./mkconfig -a db12x mips mips db12x ar7240 ar7240
597
598 ap143_common_config : common_config
599         @echo "#define CONFIG_ATHEROS                       1" >> include/config.h
600         @echo "#define CONFIG_MACH_QCA953x                  1" >> include/config.h
601
602 dr531_config : unconfig ap143_common_config
603         @/bin/echo -e '\e[32m> Configuring for Wallys DR531 at:' `date` '\e[0m'
604         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
605         @echo "#define CONFIG_FOR_WALLYS_DR531              1" >> include/config.h
606         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
607         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
608         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      8" >> include/config.h
609         @echo "#define CONFIG_GPIO_RESET_BTN               17" >> include/config.h
610         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
611         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"Wallys DR531\"" >> include/config.h
612
613         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
614
615 wr820n_CN_config : unconfig ap143_common_config
616         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR820N CN at:' `date` '\e[0m'
617         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
618         @echo "#define CONFIG_FOR_TPLINK_WR820N_CN          1" >> include/config.h
619         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
620         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
621         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
622         @echo "#define CONFIG_GPIO_RESET_BTN               12" >> include/config.h
623         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
624         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
625         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR820N CN\"" >> include/config.h
626
627         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
628
629 wr802n_config : unconfig ap143_common_config
630         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR802N at:' `date` '\e[0m'
631         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
632         @echo "#define CONFIG_FOR_TPLINK_WR802N             1" >> include/config.h
633         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
634         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
635         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
636         @echo "#define CONFIG_GPIO_RESET_BTN               12" >> include/config.h
637         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
638         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
639         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR802N\"" >> include/config.h
640
641         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
642
643 wr841n_v9_config : unconfig ap143_common_config
644         @/bin/echo -e '\e[32m> Configuring for TP-Link TL-WR841N/D v9 at:' `date` '\e[0m'
645         @echo "#define SOC_TYPE               QCA_QCA953X_SOC" >> include/config.h
646         @echo "#define CONFIG_FOR_TPLINK_WR841N_V9          1" >> include/config.h
647         @echo "#define CFG_ATHRS27_PHY                      1" >> include/config.h
648         @echo "#define CFG_ATH_GMAC_NMACS                   2" >> include/config.h
649         @echo "#define CONFIG_DEFAULT_FLASH_SIZE_IN_MB      4" >> include/config.h
650         @echo "#define CONFIG_GPIO_RESET_BTN               12" >> include/config.h
651         @echo "#define CONFIG_GPIO_RESET_BTN_ACTIVE_LOW     1" >> include/config.h
652         @echo "#define CONFIG_TPLINK_IMAGE_HEADER           1" >> include/config.h
653         @echo "#define CONFIG_BOARD_CUSTOM_STRING           \"TP-Link TL-WR841N/D v9\"" >> include/config.h
654
655         @./mkconfig -a ap143 mips mips ap143 ar7240 ar7240
656
657 #########################################################################
658 #########################################################################
659 #########################################################################
660
661 clean:
662         @/bin/echo -e "\e[32m> Making $@...\e[0m"
663         @find . -type f \
664                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
665                 -o -name '*.o'  -o -name '*.a' -o -name .depend \) -print \
666                 | xargs rm -f
667         @rm -f tools/mkimage tools/envcrc
668         @rm -f lib_bootstrap/*.o
669         @rm -f lib_bootstrap/*.a
670         @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map
671
672 clobber:        clean
673         @/bin/echo -e "\e[32m> Making $@...\e[0m"
674         @find . -type f \( -name .depend \
675                 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
676                 -print0 \
677                 | xargs -0 rm -f
678         @rm -f $(OBJS) *.bak tags TAGS include/version_autogenerated.h
679         @rm -fr *.*~
680         @rm -f u-boot u-boot.map u-boot.hex $(ALL)
681         @rm -f tools/crc32.c tools/environment.c
682         @rm -f cpu/mpc824x/bedbug_603e.c
683         @rm -f include/asm/proc include/asm/arch include/asm
684
685 mrproper \
686 distclean:      clobber unconfig
687
688 backup:
689         F=`basename $(TOPDIR)` ; cd .. ; \
690         gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
691
692 #########################################################################