Show some information about bootstrap part of the image
[oweals/u-boot_mod.git] / u-boot / Makefile
1 #
2 # Copyright (C) 2016 Piotr Dymacz <piotr@dymacz.pl>
3 #
4 # (C) Copyright 2000-2006 Wolfgang Denk,
5 # DENX Software Engineering, wd@denx.de.
6 #
7 # SPDX-License-Identifier: GPL-2.0
8 #
9
10 VERSION      = 1
11 PATCHLEVEL   = 1
12 SUBLEVEL     = 4
13 EXTRAVERSION = -$(shell git rev-parse --short=8 HEAD)
14 ISREPODIRTY  = $(shell if git diff-files | read dummy; then echo 1; else echo 0; fi)
15 VERSION_FILE = include/version_autogenerated.h
16
17 MKCONFIG = $(BUILD_TOPDIR)/u-boot/mkconfig
18 MKIMAGE  = $(BUILD_TOPDIR)/u-boot/tools/mkimage
19 LZMA     = $(BUILD_TOPDIR)/host_util/$(HOSTOS)-$(HOSTARCH)/lzma
20
21 # Show in version string if we are not building from clean repository
22 ifeq ($(ISREPODIRTY),1)
23   U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-dirty"
24 else
25   U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)"-clean"
26 endif
27
28 # ===============================================================
29
30 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
31 export TOPDIR
32
33 # Some variables passed as arguments in cmd
34 ifneq ($(IMG_SIZE),)
35   CONFIG_MAX_UBOOT_SIZE = $(IMG_SIZE)
36   export CONFIG_MAX_UBOOT_SIZE
37 endif
38
39 ifeq ($(IMG_LZMA),1)
40   COMPRESSED_UBOOT = 1
41   export COMPRESSED_UBOOT
42 endif
43
44 ifeq ($(IMG_RAM),1)
45   CONFIG_SKIP_LOWLEVEL_INIT = 1
46   export CONFIG_SKIP_LOWLEVEL_INIT
47 endif
48
49 ifneq ($(DEVICE_VENDOR),)
50   DEVICE_VENDOR = $(DEVICE_VENDOR)
51   export DEVICE_VENDOR
52 endif
53
54 # Never use LZMA compression
55 # for a RAM version of image
56 ifdef CONFIG_SKIP_LOWLEVEL_INIT
57   unexport COMPRESSED_UBOOT
58   COMPRESSED_UBOOT =
59 endif
60
61 ifndef CROSS_COMPILE
62   $(error "CROSS_COMPILE is not defined!")
63 endif
64 export CROSS_COMPILE
65
66 ifndef STAGING_DIR
67   $(error "STAGING_DIR is not defined!")
68 endif
69 export STAGING_DIR
70
71 # Endianness
72 ifndef ENDIANNESS
73   ENDIANNESS=-EB
74 endif
75 export ENDIANNESS
76
77 # =======================
78 # CUSTOM HELPER FUNCTIONS
79 # =======================
80
81 define echo_green
82   echo -e "\e[92m$(1)\e[0m"
83 endef
84
85 define echo_red
86   echo -e "\e[91m$(1)\e[0m"
87 endef
88
89 define echo_yellow
90   echo -e "\e[93m$(1)\e[0m"
91 endef
92
93 define ih_name
94 u-boot_mod $(if $(filter $(IMG_RAM),1),RAM,$(if $(filter $(IMG_LZMA),1),LZMA FLASH,FLASH)) image
95 endef
96
97 # $(1): name
98 # $(2): path
99 define echo_size
100 @echo "$(1): `wc -c < $(strip $(2))` Bytes"
101 endef
102
103 # $(1): define name
104 # $(2): define value
105 define define_add
106   len=$$((5 - ($$(expr length $(1))/8))); \
107   tab=`printf '%*s' "$$len" | tr ' ' "\t"`; \
108   echo -ne "#define $(strip $(1))$${tab}" >> include/config.h; \
109   echo -e  '$(strip $(2))' >> include/config.h
110 endef
111
112 # $(1): define name
113 define undef_add
114   echo -e '#undef $(strip $(1))' >> include/config.h
115 endef
116
117 # $(1): path
118 define include_add
119   echo -e '#include <$(strip $(1))>' >> include/config.h
120 endef
121
122 # $(1): name
123 define board_name
124 $(if $(1),$(strip $(1)),OEM/Unknown)
125 endef
126
127 # $(1): size
128 define flash_size
129 $(if $(1),$(strip $(1)),4)
130 endef
131
132 # $(1): vendor, board name/model
133 # $(2): default FLASH size in MB
134 # $(3): reset button GPIO number
135 # $(4): 1 if reset button is active low
136 # $(5): SOC_TYPE
137 define config_init
138   $(call echo_green,Preparing configuration for target: $@)
139   echo
140
141   $(call echo_yellow,  Device vendor/model:\t$(call board_name,$(1)))
142   $(if $(DEVICE_VENDOR), \
143     $(call echo_yellow,  Custom recovery web:\tyes ($(DEVICE_VENDOR))), \
144     $(call echo_yellow,  Custom recovery web:\tno) \
145   )
146
147   $(if $(CONFIG_MAX_UBOOT_SIZE), \
148     $(call echo_yellow,  Image size limit:\t$$(($(CONFIG_MAX_UBOOT_SIZE) / 1024)) KB),
149     $(call echo_yellow,  Image size limit:\tnot specified)
150   )
151
152   $(call echo_yellow,  Default FLASH size:\t$(call flash_size,$(2)) MB)
153
154   $(if $(3),
155     $(call echo_yellow,  GPIO reset button:\t$(strip $(3))), \
156     $(call echo_yellow,  GPIO reset button:\tnot specified) \
157   )
158
159   $(if $(filter $(4),1),
160     $(call echo_yellow,  Button active low:\tyes), \
161     $(call echo_yellow,  Button active low:\tno) \
162   )
163
164   $(if $(filter $(COMPRESSED_UBOOT),1), \
165     $(call echo_yellow,  LZMA compression:\tyes), \
166     $(call echo_yellow,  LZMA compression:\tno) \
167   )
168
169   $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \
170     $(call echo_yellow,  RAM-loadable only:\tyes), \
171     $(call echo_yellow,  RAM-loadable only:\tno) \
172   )
173
174   $(if $(3),$(call define_add,CONFIG_GPIO_RESET_BTN,$(strip $(3))))
175   $(if $(filter $(4),1),$(call define_add,CONFIG_GPIO_RESET_BTN_ACTIVE_LOW,1))
176   $(if $(CONFIG_MAX_UBOOT_SIZE), \
177     $(call define_add,CONFIG_MAX_UBOOT_SIZE,$(CONFIG_MAX_UBOOT_SIZE))
178     $(call define_add,CONFIG_MAX_UBOOT_SIZE_HEX,$(shell printf '0x%X' $(CONFIG_MAX_UBOOT_SIZE)))
179   )
180
181   $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \
182     $(call define_add,CONFIG_SKIP_LOWLEVEL_INIT,1) \
183   )
184   $(if $(filter $(CONFIG_SKIP_LOWLEVEL_INIT),1), \
185     $(call undef_add,COMPRESSED_UBOOT) \
186   )
187
188   $(if $(5), \
189     $(call define_add,SOC_TYPE,$(5)) \
190   )
191
192   $(call define_add,CONFIG_BOARD_CUSTOM_STRING,"$(call board_name,$(1))")
193   $(call define_add,CONFIG_DEFAULT_FLASH_SIZE_IN_MB,$(call flash_size,$(2)))
194
195   echo
196 endef
197
198 # ===============================================================
199
200 # First, check if configuration was done
201 ifneq (include/config.mk, $(wildcard include/config.mk))
202 all install u-boot u-boot.srec depend dep:
203         $(error "System was not configured!")
204 else
205 # Load ARCH, BOARD, and CPU configuration
206 include include/config.mk
207 export ARCH CPU BOARD VENDOR SOC
208
209 # Load other configuration
210 include $(TOPDIR)/config.mk
211
212 # ===============================================================
213 # U-Boot objects....order is important (i.e. start must be first)
214 OBJS = cpu/$(CPU)/start.o
215
216 LIBS  = lib_generic/libgeneric.a
217 LIBS += common/libcommon.a
218
219 LIBS += lib_$(ARCH)/lib$(ARCH).a
220 LIBS += drivers/libdrivers.a
221 LIBS += net/libnet.a
222 LIBS += rtc/librtc.a
223 LIBS += httpd/libhttpd.a
224 LIBS += $(BOARDLIBS)
225
226 LIBS_SHARED = board/$(BOARDDIR)/lib$(BOARD).a
227 ifdef SOC
228   LIBS_SHARED += cpu/$(CPU)/$(SOC)/lib$(SOC).a
229 endif
230 LIBS_SHARED += cpu/$(CPU)/lib$(CPU).a
231
232 ifdef COMPRESSED_UBOOT
233   OBJS_BOOTSTRAP = cpu/$(CPU)/start_bootstrap.o
234   LIBS_BOOTSTRAP = lib_bootstrap/libbootstrap.a
235   PHONY_LIBS = $(LIBS_BOOTSTRAP) $(LIBS_SHARED)
236 else
237   PHONY_LIBS = $(LIBS) $(LIBS_SHARED)
238 endif
239 .PHONY: $(PHONY_LIBS)
240
241 # Add GCC lib
242 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
243
244 # The "tools" are needed early, so put this first
245 # Don't include stuff already done in $(LIBS)
246 SUBDIRS = tools
247
248 .PHONY: $(SUBDIRS)
249
250 # ===============================================================
251
252 ALL = u-boot.srec u-boot.bin System.map
253
254 ifdef COMPRESSED_UBOOT
255 all: $(ALL) tuboot.bin
256 else
257 all: $(ALL) u-boot.img
258 endif
259
260 u-boot.hex: u-boot
261         $(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
262
263 u-boot.srec: u-boot
264         $(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
265
266 u-boot.bin: u-boot
267         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
268
269 u-boot.img: u-boot.bin
270         @echo
271         $(call echo_green,Preparing regular U-Boot image $@...)
272         $(MKIMAGE) -A $(ARCH) -T firmware -C none -a $(TEXT_BASE) \
273                    -e 0 -n '$(call ih_name)' -d $< $@
274
275 u-boot.dis: u-boot
276         $(OBJDUMP) -d $< > $@
277
278 u-boot: depend version $(SUBDIRS) $(OBJS) $(LIBS) $(LIBS_SHARED) $(LDSCRIPT)
279         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) $(LIBS_SHARED) | \
280                    sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p' | \
281                    sort | uniq`; \
282         $(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
283               --start-group $(LIBS) $(LIBS_SHARED) \
284               --end-group $(PLATFORM_LIBS) \
285               -Map u-boot.map -o u-boot
286
287 $(LIBS_SHARED):
288         $(MAKE) -C `dirname $@`
289
290 $(LIBS):
291         $(MAKE) -C `dirname $@`
292
293 $(SUBDIRS):
294         $(MAKE) -C $@ all
295
296 # For LZMA compressed image
297 ifdef COMPRESSED_UBOOT
298 tuboot.bin: System.map bootstrap.bin u-boot.lzimg
299         @echo
300         $(call echo_green,Merging bootstrap.bin with u-boot.lzimg...)
301         $(call echo_size,    Bootstrap size,bootstrap.bin)
302         $(call echo_size,   LZMA image size,u-boot.lzimg)
303         @cat bootstrap.bin > $@
304         @cat u-boot.lzimg >> $@
305         $(call echo_size,  Total image size,$@)
306
307 u-boot.lzimg: $(obj)u-boot.bin System.map
308         @echo
309         @rm -rf u-boot.bin.lzma
310         @$(call echo_green,Compressing U-Boot image $<...)
311         @$(LZMA) --best --keep $(obj)u-boot.bin
312         $(call echo_green,Preparing LZMA compressed U-Boot image $@...)
313         $(MKIMAGE) -A $(ARCH) -T firmware -C lzma \
314                    -a 0x$(shell grep "T _start" $(TOPDIR)/System.map | \
315                     awk '{ printf "%s", $$1 }') \
316                    -e 0x$(shell grep "T _start" $(TOPDIR)/System.map | \
317                     awk '{ printf "%s", $$1 }') \
318                    -n '$(call ih_name)' -d $(obj)u-boot.bin.lzma $@
319
320 bootstrap.bin: bootstrap
321         $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
322
323 bootstrap: depend version $(SUBDIRS) $(OBJS_BOOTSTRAP) $(LIBS_BOOTSTRAP) $(LIBS_SHARED) $(LDSCRIPT_BOOTSTRAP)
324         UNDEF_SYM=`$(OBJDUMP) -x $(LIBS_BOOTSTRAP) | \
325                    sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p' | \
326                    sort | uniq`; \
327         $(LD) $(LDFLAGS_BOOTSTRAP) $$UNDEF_SYM $(OBJS_BOOTSTRAP) \
328               --start-group $(LIBS_BOOTSTRAP) $(LIBS_SHARED) \
329               --end-group $(PLATFORM_LIBS) \
330               -Map bootstrap.map -o bootstrap
331
332 $(LIBS_BOOTSTRAP):
333         $(MAKE) -C `dirname $@`
334 endif # ifdef COMPRESSED_UBOOT
335
336 version:
337         @echo -n "#define U_BOOT_VERSION \"U-Boot $(U_BOOT_VERSION)\"" > $(VERSION_FILE)
338
339 depend dep:
340         @for dir in $(SUBDIRS); do $(MAKE) -C $$dir .depend; done
341
342 System.map: u-boot
343         @$(NM) $< | \
344                grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
345                sort > System.map
346 endif # include/config.mk
347
348 # =====================
349 # COMMON/SHARED TARGETS
350 # =====================
351
352 unconfig:
353         @$(call echo_green,Removing configuration...)
354         @rm -f include/config.h include/config.mk board/*/config.tmp
355
356 config_common:
357         @ >include/config.h
358         @$(call include_add,soc/soc_list.h)
359         @$(call define_add,CONFIG_MAX_BUTTON_PRESSING,10)
360         @$(call define_add,CONFIG_DELAY_TO_AUTORUN_HTTPD,3)
361         @$(call define_add,CONFIG_DELAY_TO_AUTORUN_CONSOLE,5)
362         @$(call define_add,CONFIG_DELAY_TO_AUTORUN_NETCONSOLE,7)
363
364 ar933x_common: unconfig config_common
365         @$(call define_add,CFG_AG7240_NMACS,2)
366         @$(call define_add,CFG_ATHRS26_PHY,1)
367         @$(call define_add,CONFIG_MACH_HORNET,1)
368
369 ar934x_common: unconfig config_common
370         @$(call define_add,CONFIG_WASP,1)
371         @$(call define_add,CONFIG_WASP_SUPPORT,1)
372
373 qca953x_common: unconfig config_common
374         @$(call define_add,CONFIG_ATHEROS,1)
375         @$(call define_add,CONFIG_MACH_QCA953x,1)
376
377 # =============================
378 # TARGETS IN ALPHABETICAL ORDER
379 # =============================
380
381 8devices_carambola2: ar933x_common
382         @$(call config_init,8devices Carambola 2,16,11,1,QCA_AR933X_SOC)
383         @$(call define_add,CONFIG_FOR_8DEVICES_CARAMBOLA2,1)
384         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
385
386 d-link_dir-505: ar933x_common
387         @$(call config_init,D-Link DIR-505,8,11,1,QCA_AR933X_SOC)
388         @$(call define_add,CONFIG_FOR_DLINK_DIR505_A1,1)
389         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
390
391 dragino_v2_ms14: ar933x_common
392         @$(call config_init,Dragino v2 (MS14),16,11,1,QCA_AR933X_SOC)
393         @$(call define_add,CONFIG_FOR_DRAGINO_V2,1)
394         @$(call define_add,WEBFAILSAFE_DISABLE_ART_UPGRADE,1)
395         @$(call define_add,WEBFAILSAFE_DISABLE_UBOOT_UPGRADE,1)
396         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
397
398 gainstrong_oolite_v1_dev: ar933x_common
399         @$(call config_init,Gainstrong Oolite v1 (dev board),16,11,,QCA_AR933X_SOC)
400         @$(call define_add,CONFIG_FOR_GS_OOLITE_V1_DEV,1)
401         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
402
403 gl-innovations_gl-inet-6416: ar933x_common
404         @$(call config_init,GL-Innovations GL.iNet 6416,8,11,,QCA_AR933X_SOC)
405         @$(call define_add,CONFIG_FOR_GL_INET,1)
406         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
407
408 tp-link_tl-mr10u: ar933x_common
409         @$(call config_init,TP-Link TL-MR10U,4,11,,QCA_AR933X_SOC)
410         @$(call define_add,CONFIG_FOR_TPLINK_MR10U_V1,1)
411         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
412
413 tp-link_tl-mr13u: ar933x_common
414         @$(call config_init,TP-Link TL-MR13U,4,11,,QCA_AR933X_SOC)
415         @$(call define_add,CONFIG_FOR_TPLINK_MR13U_V1,1)
416         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
417
418 tp-link_tl-mr3020: ar933x_common
419         @$(call config_init,TP-Link TL-MR3020,4,11,,QCA_AR933X_SOC)
420         @$(call define_add,CONFIG_FOR_TPLINK_MR3020_V1,1)
421         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
422
423 tp-link_tl-mr3040: ar933x_common
424         @$(call config_init,TP-Link TL-MR3040,4,11,,QCA_AR933X_SOC)
425         @$(call define_add,CONFIG_FOR_TPLINK_MR3040_V1V2,1)
426         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
427
428 tp-link_tl-mr3220_v2: ar933x_common
429         @$(call config_init,TP-Link TL-MR3220 v2,4,11,,QCA_AR933X_SOC)
430         @$(call define_add,CONFIG_FOR_TPLINK_MR3220_V2,1)
431         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
432
433 tp-link_tl-mr3420_v2: ar934x_common
434         @$(call config_init,TP-Link TL-MR3420 v2,4,17,1,QCA_AR9341_SOC)
435         @$(call define_add,CONFIG_FOR_TPLINK_MR3420_V2,1)
436         @$(call define_add,CFG_ATHRS27_PHY,1)
437         @$(call define_add,CFG_AG7240_NMACS,2)
438         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
439
440 tp-link_tl-wa830re_v2_tl-wa801nd_v2: ar934x_common
441         @$(call config_init,TP-Link TL-WA830RE/TL-WA801ND v2,4,17,1,QCA_AR9341_SOC)
442         @$(call define_add,CONFIG_FOR_TPLINK_WA830RE_V2_WA801ND_V2,1)
443         @$(call define_add,CFG_ATHRS27_PHY,1)
444         @$(call define_add,CFG_AG7240_NMACS,2)
445         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
446
447 tp-link_tl-wdr3500: ar934x_common
448         @$(call config_init,TP-Link TL-WDR3500,8,16,1,QCA_AR9344_SOC)
449         @$(call define_add,CONFIG_FOR_TPLINK_WDR3500_V1,1)
450         @$(call define_add,CFG_ATHRS27_PHY,1)
451         @$(call define_add,CFG_AG7240_NMACS,2)
452         @$(call define_add,CONFIG_PCI,1)
453         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
454
455 tp-link_tl-wdr3600_tl-43x0: ar934x_common
456         @$(call config_init,TP-Link TL-WDR3600/43x0,8,16,1,QCA_AR9344_SOC)
457         @$(call define_add,CONFIG_FOR_TPLINK_WDR3600_WDR43X0_V1,1)
458         @$(call define_add,CFG_ATHRS17_PHY,1)
459         @$(call define_add,CFG_AG7240_NMACS,1)
460         @$(call define_add,CONFIG_PCI,1)
461         @$(call define_add,CFG_DUAL_PHY_SUPPORT,1)
462         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
463
464 tp-link_tl-wr703n: ar933x_common
465         @$(call config_init,TP-Link TL-WR703N,4,11,,QCA_AR933X_SOC)
466         @$(call define_add,CONFIG_FOR_TPLINK_WR703N_V1,1)
467         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
468
469 tp-link_tl-wr710n: ar933x_common
470         @$(call config_init,TP-Link TL-WR710N,8,11,,QCA_AR933X_SOC)
471         @$(call define_add,CONFIG_FOR_TPLINK_WR710N_V1,1)
472         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
473
474 tp-link_tl-wr720n_v3_CN: ar933x_common
475         @$(call config_init,TP-Link TL-WR720N v3 CN,4,11,,QCA_AR933X_SOC)
476         @$(call define_add,CONFIG_FOR_TPLINK_WR720N_V3,1)
477         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
478
479 tp-link_tl-wr740n_v4: ar933x_common
480         @$(call config_init,TP-Link TL-WR74xN/D v4,4,11,,QCA_AR933X_SOC)
481         @$(call define_add,CONFIG_FOR_TPLINK_WR740N_V4,1)
482         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
483
484 tp-link_tl-wr802n: qca953x_common
485         @$(call config_init,TP-Link TL-WR802N,4,12,1,QCA_QCA953X_SOC)
486         @$(call define_add,CONFIG_FOR_TPLINK_WR802N,1)
487         @$(call define_add,CFG_ATHRS27_PHY,1)
488         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
489         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
490
491 tp-link_tl-wr820n_CN: qca953x_common
492         @$(call config_init,TP-Link TL-WR820N CN,4,12,1,QCA_QCA953X_SOC)
493         @$(call define_add,CONFIG_FOR_TPLINK_WR820N_CN,1)
494         @$(call define_add,CFG_ATHRS27_PHY,1)
495         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
496         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
497
498 tp-link_tl-wr841n_v8: ar934x_common
499         @$(call config_init,TP-Link TL-WR841N/D v8,4,17,1,QCA_AR9341_SOC)
500         @$(call define_add,CONFIG_FOR_TPLINK_WR841N_V8,1)
501         @$(call define_add,CFG_ATHRS27_PHY,1)
502         @$(call define_add,CFG_AG7240_NMACS,2)
503         @$(MKCONFIG) -a db12x mips mips db12x ar7240 ar7240
504
505 tp-link_tl-wr841n_v9: qca953x_common
506         @$(call config_init,TP-Link TL-WR841N/D v9,4,12,1,QCA_QCA953X_SOC)
507         @$(call define_add,CONFIG_FOR_TPLINK_WR841N_V9,1)
508         @$(call define_add,CFG_ATHRS27_PHY,1)
509         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
510         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
511
512 unwireddevices_unwired-one: ar933x_common
513         @$(call config_init,Black Swift aka Unwired One,16,11,1,QCA_AR933X_SOC)
514         @$(call define_add,CONFIG_FOR_BLACK_SWIFT_BOARD,1)
515         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
516
517 village-telco_mesh-potato_v2: ar933x_common
518         @$(call config_init,Village Telco Mesh Potato 2,16,11,1,QCA_AR933X_SOC)
519         @$(call define_add,CONFIG_FOR_MESH_POTATO_V2,1)
520         @$(call define_add,WEBFAILSAFE_DISABLE_ART_UPGRADE,1)
521         @$(call define_add,WEBFAILSAFE_DISABLE_UBOOT_UPGRADE,1)
522         @$(MKCONFIG) -a ap121 mips mips ap121 ar7240 ar7240
523
524 wallys_dr531: qca953x_common
525         @$(call config_init,Wallys DR531,8,17,1,QCA_QCA953X_SOC)
526         @$(call define_add,CONFIG_FOR_WALLYS_DR531,1)
527         @$(call define_add,CFG_ATHRS27_PHY,1)
528         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
529         @$(call define_add,CONFIG_PCI,1)
530         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
531
532 zbtlink_zbt-we1526: qca953x_common
533         @$(call config_init,Zbtlink ZBT-WE1526,16,17,1,QCA_QCA953X_SOC)
534         @$(call define_add,CONFIG_FOR_ZBTLINK_ZBT_WE1526,1)
535         @$(call define_add,CFG_ATHRS27_PHY,1)
536         @$(call define_add,CFG_ATH_GMAC_NMACS,2)
537         @$(MKCONFIG) -a ap143 mips mips ap143 ar7240 ar7240
538
539 # =============
540 # CLEAN TARGETS
541 # =============
542
543 clean:
544         @$(call echo_green,Making $@...)
545         @find . -type f \
546                 \( -name 'core' -o -name '*.bak' -o -name '*~' \
547                 -o -name '*.o'  -o -name '*.a' -o -name .depend \) -print \
548                 | xargs rm -f
549         @rm -f tools/mkimage tools/envcrc
550         @rm -f lib_bootstrap/*.o
551         @rm -f lib_bootstrap/*.a
552         @rm -f bootstrap bootstrap.bin tuboot.bin u-boot.lzimg u-boot.bin.lzma bootstrap.map
553
554 clobber: clean
555         @$(call echo_green,Making $@...)
556         @find . -type f \( -name .depend \
557                 -o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
558                 -print0 \
559                 | xargs -0 rm -f
560         @rm -f $(OBJS) *.bak include/version_autogenerated.h
561         @rm -fr *.*~
562         @rm -f u-boot u-boot.map u-boot.hex $(ALL)
563         @rm -f tools/crc32.c tools/environment.c
564         @rm -f include/asm/proc include/asm/arch include/asm
565
566 distclean: clobber unconfig