xref: /rk3399_rockchip-uboot/Makefile (revision a6cccaea5a4743f4e4fb93a3ae9537e7357c783b)
1#
2# (C) Copyright 2000-2004
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
24HOSTARCH := $(shell uname -m | \
25	sed -e s/i.86/i386/ \
26	    -e s/sun4u/sparc64/ \
27	    -e s/arm.*/arm/ \
28	    -e s/sa110/arm/ \
29	    -e s/powerpc/ppc/ \
30	    -e s/macppc/ppc/)
31
32HOSTOS := $(shell uname -s | tr A-Z a-z | \
33	    sed -e 's/\(cygwin\).*/cygwin/')
34
35export	HOSTARCH
36
37# Deal with colliding definitions from tcsh etc.
38VENDOR=
39
40#########################################################################
41
42TOPDIR	:= $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
43export	TOPDIR
44
45ifeq (include/config.mk,$(wildcard include/config.mk))
46# load ARCH, BOARD, and CPU configuration
47include include/config.mk
48export	ARCH CPU BOARD VENDOR
49# load other configuration
50include $(TOPDIR)/config.mk
51
52ifndef CROSS_COMPILE
53ifeq ($(HOSTARCH),ppc)
54CROSS_COMPILE =
55else
56ifeq ($(ARCH),ppc)
57CROSS_COMPILE = ppc_8xx-
58endif
59ifeq ($(ARCH),arm)
60CROSS_COMPILE = arm-linux-
61endif
62ifeq ($(ARCH),i386)
63ifeq ($(HOSTARCH),i386)
64CROSS_COMPILE =
65else
66CROSS_COMPILE = i386-linux-
67endif
68endif
69ifeq ($(ARCH),mips)
70CROSS_COMPILE = mips_4KC-
71endif
72ifeq ($(ARCH),nios)
73CROSS_COMPILE = nios-elf-
74endif
75ifeq ($(ARCH),m68k)
76CROSS_COMPILE = m68k-elf-
77endif
78endif
79endif
80
81export	CROSS_COMPILE
82
83#########################################################################
84# U-Boot objects....order is important (i.e. start must be first)
85
86OBJS  = cpu/$(CPU)/start.o
87ifeq ($(CPU),i386)
88OBJS += cpu/$(CPU)/start16.o
89OBJS += cpu/$(CPU)/reset.o
90endif
91ifeq ($(CPU),ppc4xx)
92OBJS += cpu/$(CPU)/resetvec.o
93endif
94ifeq ($(CPU),mpc85xx)
95OBJS += cpu/$(CPU)/resetvec.o
96endif
97
98LIBS  = lib_generic/libgeneric.a
99LIBS += board/$(BOARDDIR)/lib$(BOARD).a
100LIBS += cpu/$(CPU)/lib$(CPU).a
101LIBS += lib_$(ARCH)/lib$(ARCH).a
102LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a
103LIBS += net/libnet.a
104LIBS += disk/libdisk.a
105LIBS += rtc/librtc.a
106LIBS += dtt/libdtt.a
107LIBS += drivers/libdrivers.a
108LIBS += drivers/sk98lin/libsk98lin.a
109LIBS += post/libpost.a post/cpu/libcpu.a
110LIBS += common/libcommon.a
111.PHONY : $(LIBS)
112
113# Add GCC lib
114PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
115
116# The "tools" are needed early, so put this first
117# Don't include stuff already done in $(LIBS)
118SUBDIRS	= tools \
119	  examples \
120	  post \
121	  post/cpu
122.PHONY : $(SUBDIRS)
123
124#########################################################################
125#########################################################################
126
127ALL = u-boot.srec u-boot.bin System.map
128
129all:		$(ALL)
130
131u-boot.srec:	u-boot
132		$(OBJCOPY) ${OBJCFLAGS} -O srec $< $@
133
134u-boot.bin:	u-boot
135		$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
136
137u-boot.img:	u-boot.bin
138		./tools/mkimage -A $(ARCH) -T firmware -C none \
139		-a $(TEXT_BASE) -e 0 \
140		-n $(shell sed -n -e 's/.*U_BOOT_VERSION//p' include/version.h | \
141			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
142		-d $< $@
143
144u-boot.dis:	u-boot
145		$(OBJDUMP) -d $< > $@
146
147u-boot:		depend $(SUBDIRS) $(OBJS) $(LIBS) $(LDSCRIPT)
148		UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
149		$(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
150			--start-group $(LIBS) $(PLATFORM_LIBS) --end-group \
151			-Map u-boot.map -o u-boot
152
153$(LIBS):
154		$(MAKE) -C `dirname $@`
155
156$(SUBDIRS):
157		$(MAKE) -C $@ all
158
159gdbtools:
160		$(MAKE) -C tools/gdb || exit 1
161
162depend dep:
163		@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir .depend ; done
164
165tags:
166		ctags -w `find $(SUBDIRS) include \
167			\( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
168
169etags:
170		etags -a `find $(SUBDIRS) include \
171			\( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`
172
173System.map:	u-boot
174		@$(NM) $< | \
175		grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
176		sort > System.map
177
178#########################################################################
179else
180all install u-boot u-boot.srec depend dep:
181	@echo "System not configured - see README" >&2
182	@ exit 1
183endif
184
185#########################################################################
186
187unconfig:
188	rm -f include/config.h include/config.mk
189
190#========================================================================
191# PowerPC
192#========================================================================
193
194#########################################################################
195## MPC5xx Systems
196#########################################################################
197
198cmi_mpc5xx_config:	unconfig
199	@./mkconfig $(@:_config=) ppc mpc5xx cmi
200
201PATI_config:unconfig
202	@./mkconfig $(@:_config=) ppc mpc5xx pati mpl
203
204#########################################################################
205## MPC5xxx Systems
206#########################################################################
207MPC5200LITE_config		\
208MPC5200LITE_LOWBOOT_config	\
209MPC5200LITE_LOWBOOT08_config	\
210icecube_5200_DDR_LOWBOOT_config	\
211icecube_5200_DDR_config		\
212IceCube_5200_DDR_config		\
213icecube_5200_config		\
214IceCube_5200_config		\
215IceCube_5100_config:		unconfig
216	@ >include/config.h
217	@[ -z "$(findstring LOWBOOT,$@)" ] || \
218		{ echo "TEXT_BASE = 0xFF000000" >board/icecube/config.tmp ; \
219		  echo "... with LOWBOOT configuration" ; \
220		}
221	@[ -z "$(findstring LOWBOOT08,$@)" ] || \
222		{ echo "TEXT_BASE = 0xFF800000" >board/icecube/config.tmp ; \
223		  echo "... with 8 MB flash only" ; \
224		}
225	@[ -z "$(findstring DDR,$@)" ] || \
226		{ echo "#define CONFIG_MPC5200_DDR"	>>include/config.h ; \
227		  echo "... DDR memory revision" ; \
228		}
229	@[ -z "$(findstring 5200,$@)" ] || \
230		{ echo "#define CONFIG_MPC5200"		>>include/config.h ; \
231		  echo "... with MPC5200 processor" ; \
232		}
233	@[ -z "$(findstring 5100,$@)" ] || \
234		{ echo "#define CONFIG_MGT5100"		>>include/config.h ; \
235		  echo "... with MGT5100 processor" ; \
236		}
237	@./mkconfig -a IceCube ppc mpc5xxx icecube
238
239MINI5200_config	\
240EVAL5200_config	\
241TOP5200_config:	unconfig
242	@ echo "#define CONFIG_$(@:_config=) 1"	>include/config.h
243	@./mkconfig -a TOP5200 ppc mpc5xxx top5200 emk
244
245#########################################################################
246## MPC8xx Systems
247#########################################################################
248
249AdderII_config:	unconfig
250	@./mkconfig $(@:_config=) ppc mpc8xx adderII
251
252ADS860_config     \
253DUET_ADS_config   \
254FADS823_config    \
255FADS850SAR_config \
256MPC86xADS_config  \
257FADS860T_config:	unconfig
258	@./mkconfig $(@:_config=) ppc mpc8xx fads
259
260AMX860_config	:	unconfig
261	@./mkconfig $(@:_config=) ppc mpc8xx amx860 westel
262
263bms2003_config	:	unconfig
264	@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
265
266c2mon_config:		unconfig
267	@./mkconfig $(@:_config=) ppc mpc8xx c2mon
268
269CCM_config:		unconfig
270	@./mkconfig $(@:_config=) ppc mpc8xx CCM siemens
271
272cogent_mpc8xx_config:	unconfig
273	@./mkconfig $(@:_config=) ppc mpc8xx cogent
274
275ELPT860_config:		unconfig
276	@./mkconfig $(@:_config=) ppc mpc8xx elpt860 LEOX
277
278ESTEEM192E_config:	unconfig
279	@./mkconfig $(@:_config=) ppc mpc8xx esteem192e
280
281ETX094_config	:	unconfig
282	@./mkconfig $(@:_config=) ppc mpc8xx etx094
283
284FLAGADM_config:	unconfig
285	@./mkconfig $(@:_config=) ppc mpc8xx flagadm
286
287xtract_GEN860T = $(subst _SC,,$(subst _config,,$1))
288
289GEN860T_SC_config	\
290GEN860T_config: unconfig
291	@ >include/config.h
292	@[ -z "$(findstring _SC,$@)" ] || \
293		{ echo "#define CONFIG_SC" >>include/config.h ; \
294		  echo "With reduced H/W feature set (SC)..." ; \
295		}
296	@./mkconfig -a $(call xtract_GEN860T,$@) ppc mpc8xx gen860t
297
298GENIETV_config:	unconfig
299	@./mkconfig $(@:_config=) ppc mpc8xx genietv
300
301GTH_config:	unconfig
302	@./mkconfig $(@:_config=) ppc mpc8xx gth
303
304hermes_config	:	unconfig
305	@./mkconfig $(@:_config=) ppc mpc8xx hermes
306
307IAD210_config: unconfig
308	@./mkconfig $(@:_config=) ppc mpc8xx IAD210 siemens
309
310xtract_ICU862 = $(subst _100MHz,,$(subst _config,,$1))
311
312ICU862_100MHz_config	\
313ICU862_config: unconfig
314	@ >include/config.h
315	@[ -z "$(findstring _100MHz,$@)" ] || \
316		{ echo "#define CONFIG_100MHz"	>>include/config.h ; \
317		  echo "... with 100MHz system clock" ; \
318		}
319	@./mkconfig -a $(call xtract_ICU862,$@) ppc mpc8xx icu862
320
321IP860_config	:	unconfig
322	@./mkconfig $(@:_config=) ppc mpc8xx ip860
323
324IVML24_256_config \
325IVML24_128_config \
326IVML24_config:	unconfig
327	@ >include/config.h
328	@[ -z "$(findstring IVML24_config,$@)" ] || \
329		 { echo "#define CONFIG_IVML24_16M"	>>include/config.h ; \
330		 }
331	@[ -z "$(findstring IVML24_128_config,$@)" ] || \
332		 { echo "#define CONFIG_IVML24_32M"	>>include/config.h ; \
333		 }
334	@[ -z "$(findstring IVML24_256_config,$@)" ] || \
335		 { echo "#define CONFIG_IVML24_64M"	>>include/config.h ; \
336		 }
337	@./mkconfig -a IVML24 ppc mpc8xx ivm
338
339IVMS8_256_config \
340IVMS8_128_config \
341IVMS8_config:	unconfig
342	@ >include/config.h
343	@[ -z "$(findstring IVMS8_config,$@)" ] || \
344		 { echo "#define CONFIG_IVMS8_16M"	>>include/config.h ; \
345		 }
346	@[ -z "$(findstring IVMS8_128_config,$@)" ] || \
347		 { echo "#define CONFIG_IVMS8_32M"	>>include/config.h ; \
348		 }
349	@[ -z "$(findstring IVMS8_256_config,$@)" ] || \
350		 { echo "#define CONFIG_IVMS8_64M"	>>include/config.h ; \
351		 }
352	@./mkconfig -a IVMS8 ppc mpc8xx ivm
353
354KUP4K_config	:	unconfig
355	@./mkconfig $(@:_config=) ppc mpc8xx kup4k
356
357LANTEC_config	:	unconfig
358	@./mkconfig $(@:_config=) ppc mpc8xx lantec
359
360lwmon_config:		unconfig
361	@./mkconfig $(@:_config=) ppc mpc8xx lwmon
362
363MBX_config	\
364MBX860T_config:	unconfig
365	@./mkconfig $(@:_config=) ppc mpc8xx mbx8xx
366
367MHPC_config:		unconfig
368	@./mkconfig $(@:_config=) ppc mpc8xx mhpc eltec
369
370MVS1_config :		unconfig
371	@./mkconfig $(@:_config=) ppc mpc8xx mvs1
372
373xtract_NETVIA = $(subst _V2,,$(subst _config,,$1))
374
375NETVIA_V2_config \
376NETVIA_config:		unconfig
377	@ >include/config.h
378	@[ -z "$(findstring NETVIA_config,$@)" ] || \
379		 { echo "#define CONFIG_NETVIA_VERSION 1" >>include/config.h ; \
380		  echo "... Version 1" ; \
381		 }
382	@[ -z "$(findstring NETVIA_V2_config,$@)" ] || \
383		 { echo "#define CONFIG_NETVIA_VERSION 2" >>include/config.h ; \
384		  echo "... Version 2" ; \
385		 }
386	@./mkconfig -a $(call xtract_NETVIA,$@) ppc mpc8xx netvia
387
388NX823_config:		unconfig
389	@./mkconfig $(@:_config=) ppc mpc8xx nx823
390
391pcu_e_config:		unconfig
392	@./mkconfig $(@:_config=) ppc mpc8xx pcu_e siemens
393
394QS850_config:	unconfig
395	@./mkconfig $(@:_config=) ppc mpc8xx qs850 snmc
396
397QS823_config:	unconfig
398	@./mkconfig $(@:_config=) ppc mpc8xx qs850 snmc
399
400QS860T_config:	unconfig
401	@./mkconfig $(@:_config=) ppc mpc8xx qs860t snmc
402
403R360MPI_config:	unconfig
404	@./mkconfig $(@:_config=) ppc mpc8xx r360mpi
405
406RBC823_config:	unconfig
407	@./mkconfig $(@:_config=) ppc mpc8xx rbc823
408
409RPXClassic_config:	unconfig
410	@./mkconfig $(@:_config=) ppc mpc8xx RPXClassic
411
412RPXlite_config:		unconfig
413	@./mkconfig $(@:_config=) ppc mpc8xx RPXlite
414
415rmu_config:	unconfig
416	@./mkconfig $(@:_config=) ppc mpc8xx rmu
417
418RRvision_config:	unconfig
419	@./mkconfig $(@:_config=) ppc mpc8xx RRvision
420
421RRvision_LCD_config:	unconfig
422	@echo "#define CONFIG_LCD" >include/config.h
423	@echo "#define CONFIG_SHARP_LQ104V7DS01" >>include/config.h
424	@./mkconfig -a RRvision ppc mpc8xx RRvision
425
426SM850_config	:	unconfig
427	@./mkconfig $(@:_config=) ppc mpc8xx tqm8xx
428
429SPD823TS_config:	unconfig
430	@./mkconfig $(@:_config=) ppc mpc8xx spd8xx
431
432svm_sc8xx_config:	unconfig
433	@ >include/config.h
434	@./mkconfig $(@:_config=) ppc mpc8xx svm_sc8xx
435
436SXNI855T_config:	unconfig
437	@./mkconfig $(@:_config=) ppc mpc8xx sixnet
438
439# EMK MPC8xx based modules
440TOP860_config:		unconfig
441	@./mkconfig $(@:_config=) ppc mpc8xx top860 emk
442
443# Play some tricks for configuration selection
444# All boards can come with 50 MHz (default), 66MHz, 80MHz or 100 MHz clock,
445# but only 855 and 860 boards may come with FEC
446# and 823 boards may have LCD support
447xtract_8xx = $(subst _66MHz,,$(subst _80MHz,,$(subst _100MHz,,$(subst _133MHz,,$(subst _LCD,,$(subst _config,,$1))))))
448
449FPS850L_config		\
450FPS860L_config		\
451NSCU_config		\
452TQM823L_config		\
453TQM823L_66MHz_config	\
454TQM823L_80MHz_config	\
455TQM823L_LCD_config	\
456TQM823L_LCD_66MHz_config \
457TQM823L_LCD_80MHz_config \
458TQM850L_config		\
459TQM850L_66MHz_config	\
460TQM850L_80MHz_config	\
461TQM855L_config		\
462TQM855L_66MHz_config	\
463TQM855L_80MHz_config	\
464TQM860L_config		\
465TQM860L_66MHz_config	\
466TQM860L_80MHz_config	\
467TQM862L_config		\
468TQM862L_66MHz_config	\
469TQM862L_80MHz_config	\
470TQM823M_config		\
471TQM823M_66MHz_config	\
472TQM823M_80MHz_config	\
473TQM850M_config		\
474TQM850M_66MHz_config	\
475TQM850M_80MHz_config	\
476TQM855M_config		\
477TQM855M_66MHz_config	\
478TQM855M_80MHz_config	\
479TQM860M_config		\
480TQM860M_66MHz_config	\
481TQM860M_80MHz_config	\
482TQM862M_config		\
483TQM862M_66MHz_config	\
484TQM862M_80MHz_config	\
485TQM862M_100MHz_config	\
486TQM866M_config:		unconfig
487	@ >include/config.h
488	@[ -z "$(findstring _66MHz,$@)" ] || \
489		{ echo "#define CONFIG_66MHz"		>>include/config.h ; \
490		  echo "... with 66MHz system clock" ; \
491		}
492	@[ -z "$(findstring _80MHz,$@)" ] || \
493		{ echo "#define CONFIG_80MHz"		>>include/config.h ; \
494		  echo "... with 80MHz system clock" ; \
495		}
496	@[ -z "$(findstring _100MHz,$@)" ] || \
497		{ echo "#define CONFIG_100MHz"		>>include/config.h ; \
498		  echo "... with 100MHz system clock" ; \
499		}
500	@[ -z "$(findstring _133MHz,$@)" ] || \
501		{ echo "#define CONFIG_133MHz"		>>include/config.h ; \
502		  echo "... with 133MHz system clock" ; \
503		}
504	@[ -z "$(findstring _LCD,$@)" ] || \
505		{ echo "#define CONFIG_LCD"		>>include/config.h ; \
506		  echo "#define CONFIG_NEC_NL6448BC20"	>>include/config.h ; \
507		  echo "... with LCD display" ; \
508		}
509	@./mkconfig -a $(call xtract_8xx,$@) ppc mpc8xx tqm8xx
510
511TTTech_config:	unconfig
512	@echo "#define CONFIG_LCD" >include/config.h
513	@echo "#define CONFIG_SHARP_LQ104V7DS01" >>include/config.h
514	@./mkconfig -a TQM823L ppc mpc8xx tqm8xx
515
516v37_config:	unconfig
517	@echo "#define CONFIG_LCD" >include/config.h
518	@echo "#define CONFIG_SHARP_LQ084V1DG21" >>include/config.h
519	@./mkconfig $(@:_config=) ppc mpc8xx v37
520
521wtk_config:	unconfig
522	@echo "#define CONFIG_LCD" >include/config.h
523	@echo "#define CONFIG_SHARP_LQ065T9DR51U" >>include/config.h
524	@./mkconfig -a TQM823L ppc mpc8xx tqm8xx
525
526#########################################################################
527## PPC4xx Systems
528#########################################################################
529xtract_4xx = $(subst _MODEL_BA,,$(subst _MODEL_ME,,$(subst _MODEL_HI,,$(subst _config,,$1))))
530
531ADCIOP_config:	unconfig
532	@./mkconfig $(@:_config=) ppc ppc4xx adciop esd
533
534AR405_config:	unconfig
535	@./mkconfig $(@:_config=) ppc ppc4xx ar405 esd
536
537ASH405_config:	unconfig
538	@./mkconfig $(@:_config=) ppc ppc4xx ash405 esd
539
540BUBINGA405EP_config:unconfig
541	@./mkconfig $(@:_config=) ppc ppc4xx bubinga405ep
542
543CANBT_config:	unconfig
544	@./mkconfig $(@:_config=) ppc ppc4xx canbt esd
545
546CPCI405_config	\
547CPCI4052_config	\
548CPCI405AB_config:	unconfig
549	@./mkconfig $(@:_config=) ppc ppc4xx cpci405 esd
550	@echo "BOARD_REVISION = $(@:_config=)"	>>include/config.mk
551
552CPCI440_config:	unconfig
553	@./mkconfig $(@:_config=) ppc ppc4xx cpci440 esd
554
555CPCIISER4_config:	unconfig
556	@./mkconfig $(@:_config=) ppc ppc4xx cpciiser4 esd
557
558CRAYL1_config:unconfig
559	@./mkconfig $(@:_config=) ppc ppc4xx L1 cray
560
561DASA_SIM_config: unconfig
562	@./mkconfig $(@:_config=) ppc ppc4xx dasa_sim esd
563
564DP405_config:	unconfig
565	@./mkconfig $(@:_config=) ppc ppc4xx dp405 esd
566
567DU405_config:	unconfig
568	@./mkconfig $(@:_config=) ppc ppc4xx du405 esd
569
570EBONY_config:unconfig
571	@./mkconfig $(@:_config=) ppc ppc4xx ebony
572
573ERIC_config:unconfig
574	@./mkconfig $(@:_config=) ppc ppc4xx eric
575
576EXBITGEN_config:unconfig
577	@./mkconfig $(@:_config=) ppc ppc4xx exbitgen
578
579HUB405_config:	unconfig
580	@./mkconfig $(@:_config=) ppc ppc4xx hub405 esd
581
582MIP405_config:unconfig
583	@./mkconfig $(@:_config=) ppc ppc4xx mip405 mpl
584
585MIP405T_config:unconfig
586	@echo "#define CONFIG_MIP405T" >include/config.h
587	@echo "Enable subset config for MIP405T"
588	@./mkconfig -a MIP405 ppc ppc4xx mip405 mpl
589
590ML2_config:unconfig
591	@./mkconfig $(@:_config=) ppc ppc4xx ml2
592
593OCRTC_config		\
594ORSG_config:	unconfig
595	@./mkconfig $(@:_config=) ppc ppc4xx ocrtc esd
596
597PCI405_config:	unconfig
598	@./mkconfig $(@:_config=) ppc ppc4xx pci405 esd
599
600PIP405_config:unconfig
601	@./mkconfig $(@:_config=) ppc ppc4xx pip405 mpl
602
603PLU405_config:	unconfig
604	@./mkconfig $(@:_config=) ppc ppc4xx plu405 esd
605
606PMC405_config:	unconfig
607	@./mkconfig $(@:_config=) ppc ppc4xx pmc405 esd
608
609PPChameleonEVB_MODEL_BA_config	\
610PPChameleonEVB_MODEL_ME_config	\
611PPChameleonEVB_MODEL_HI_config	\
612PPChameleonEVB_config:	unconfig
613	@ >include/config.h
614	@[ -z "$(findstring _MODEL_BA,$@)" ] || \
615		{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 0" >>include/config.h ; \
616		  echo "... BASIC model" ; \
617		}
618	@[ -z "$(findstring _MODEL_ME,$@)" ] || \
619		{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 1" >>include/config.h ; \
620		  echo "... MEDIUM model" ; \
621		}
622	@[ -z "$(findstring _MODEL_HI,$@)" ] || \
623		{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 2" >>include/config.h ; \
624		  echo "... HIGH-END model" ; \
625		}
626	@./mkconfig -a $(call xtract_4xx,$@) ppc ppc4xx PPChameleonEVB dave
627
628VOH405_config:	unconfig
629	@./mkconfig $(@:_config=) ppc ppc4xx voh405 esd
630
631W7OLMC_config	\
632W7OLMG_config: unconfig
633	@./mkconfig $(@:_config=) ppc ppc4xx w7o
634
635WALNUT405_config:unconfig
636	@./mkconfig $(@:_config=) ppc ppc4xx walnut405
637
638#########################################################################
639## MPC824x Systems
640#########################################################################
641xtract_82xx = $(subst _ROMBOOT,,$(subst _L2,,$(subst _266MHz,,$(subst _300MHz,,$(subst _config,,$1)))))
642
643A3000_config: unconfig
644	@./mkconfig $(@:_config=) ppc mpc824x a3000
645
646BMW_config: unconfig
647	@./mkconfig $(@:_config=) ppc mpc824x bmw
648
649CPC45_config	\
650CPC45_ROMBOOT_config:	unconfig
651	@./mkconfig $(call xtract_82xx,$@) ppc mpc824x cpc45
652	@cd ./include ;				\
653	if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
654		echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
655		echo "... booting from 8-bit flash" ; \
656	else \
657		echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
658		echo "... booting from 64-bit flash" ; \
659	fi; \
660	echo "export CONFIG_BOOT_ROM" >> config.mk;
661
662CU824_config: unconfig
663	@./mkconfig $(@:_config=) ppc mpc824x cu824
664
665MOUSSE_config: unconfig
666	@./mkconfig $(@:_config=) ppc mpc824x mousse
667
668MUSENKI_config: unconfig
669	@./mkconfig $(@:_config=) ppc mpc824x musenki
670
671MVBLUE_config:	unconfig
672	@./mkconfig $(@:_config=) ppc mpc824x mvblue
673
674OXC_config: unconfig
675	@./mkconfig $(@:_config=) ppc mpc824x oxc
676
677PN62_config: unconfig
678	@./mkconfig $(@:_config=) ppc mpc824x pn62
679
680Sandpoint8240_config: unconfig
681	@./mkconfig $(@:_config=) ppc mpc824x sandpoint
682
683Sandpoint8245_config: unconfig
684	@./mkconfig $(@:_config=) ppc mpc824x sandpoint
685
686SL8245_config: unconfig
687	@./mkconfig $(@:_config=) ppc mpc824x sl8245
688
689utx8245_config: unconfig
690	@./mkconfig $(@:_config=) ppc mpc824x utx8245
691
692#########################################################################
693## MPC8260 Systems
694#########################################################################
695
696atc_config:	unconfig
697	@./mkconfig $(@:_config=) ppc mpc8260 atc
698
699cogent_mpc8260_config:	unconfig
700	@./mkconfig $(@:_config=) ppc mpc8260 cogent
701
702CPU86_config	\
703CPU86_ROMBOOT_config: unconfig
704	@./mkconfig $(call xtract_82xx,$@) ppc mpc8260 cpu86
705	@cd ./include ;				\
706	if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
707		echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
708		echo "... booting from 8-bit flash" ; \
709	else \
710		echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
711		echo "... booting from 64-bit flash" ; \
712	fi; \
713	echo "export CONFIG_BOOT_ROM" >> config.mk;
714
715ep8260_config:	unconfig
716	@./mkconfig $(@:_config=) ppc mpc8260 ep8260
717
718gw8260_config:	unconfig
719	@./mkconfig $(@:_config=) ppc mpc8260 gw8260
720
721hymod_config:	unconfig
722	@./mkconfig $(@:_config=) ppc mpc8260 hymod
723
724IPHASE4539_config:	unconfig
725	@./mkconfig $(@:_config=) ppc mpc8260 iphase4539
726
727MPC8260ADS_config:	unconfig
728	@./mkconfig $(@:_config=) ppc mpc8260 mpc8260ads
729
730MPC8266ADS_config:	unconfig
731	@./mkconfig $(@:_config=) ppc mpc8260 mpc8266ads
732
733PM825_config	\
734PM825_ROMBOOT_config: unconfig
735	@echo "#define CONFIG_PCI"	>include/config.h
736	@./mkconfig -a PM826 ppc mpc8260 pm826
737	@cd ./include ;				\
738	if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
739		echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
740		echo "... booting from 8-bit flash" ; \
741	else \
742		echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
743		echo "... booting from 64-bit flash" ; \
744	fi; \
745	echo "export CONFIG_BOOT_ROM" >> config.mk; \
746
747PM826_config	\
748PM826_ROMBOOT_config: unconfig
749	@./mkconfig $(call xtract_82xx,$@) ppc mpc8260 pm826
750	@cd ./include ;				\
751	if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
752		echo "CONFIG_BOOT_ROM = y" >> config.mk ; \
753		echo "... booting from 8-bit flash" ; \
754	else \
755		echo "CONFIG_BOOT_ROM = n" >> config.mk ; \
756		echo "... booting from 64-bit flash" ; \
757	fi; \
758	echo "export CONFIG_BOOT_ROM" >> config.mk; \
759
760ppmc8260_config:	unconfig
761	@./mkconfig $(@:_config=) ppc mpc8260 ppmc8260
762
763RPXsuper_config:	unconfig
764	@./mkconfig $(@:_config=) ppc mpc8260 rpxsuper
765
766rsdproto_config:	unconfig
767	@./mkconfig $(@:_config=) ppc mpc8260 rsdproto
768
769sacsng_config:	unconfig
770	@./mkconfig $(@:_config=) ppc mpc8260 sacsng
771
772sbc8260_config:	unconfig
773	@./mkconfig $(@:_config=) ppc mpc8260 sbc8260
774
775SCM_config:		unconfig
776	@./mkconfig $(@:_config=) ppc mpc8260 SCM siemens
777
778TQM8255_AA_config \
779TQM8260_AA_config \
780TQM8260_AB_config \
781TQM8260_AC_config \
782TQM8260_AD_config \
783TQM8260_AE_config \
784TQM8260_AF_config \
785TQM8260_AG_config \
786TQM8260_AH_config \
787TQM8265_AA_config:  unconfig
788	@case "$@" in \
789	TQM8255_AA_config) CTYPE=MPC8255; CFREQ=300; CACHE=no;  BMODE=8260;;  \
790	TQM8260_AA_config) CTYPE=MPC8260; CFREQ=200; CACHE=no;  BMODE=8260;; \
791	TQM8260_AB_config) CTYPE=MPC8260; CFREQ=200; CACHE=yes; BMODE=60x;;  \
792	TQM8260_AC_config) CTYPE=MPC8260; CFREQ=200; CACHE=yes; BMODE=60x;;  \
793	TQM8260_AD_config) CTYPE=MPC8260; CFREQ=300; CACHE=no;  BMODE=60x;;  \
794	TQM8260_AE_config) CTYPE=MPC8260; CFREQ=266; CACHE=no;  BMODE=8260;; \
795	TQM8260_AF_config) CTYPE=MPC8260; CFREQ=300; CACHE=no;  BMODE=60x;;  \
796	TQM8260_AG_config) CTYPE=MPC8260; CFREQ=300; CACHE=no;  BMODE=8260;; \
797	TQM8260_AH_config) CTYPE=MPC8260; CFREQ=300; CACHE=yes; BMODE=60x;;  \
798	TQM8265_AA_config) CTYPE=MPC8265; CFREQ=300; CACHE=no;  BMODE=60x;;  \
799	esac; \
800	>include/config.h ; \
801	if [ "$${CTYPE}" != "MPC8260" ] ; then \
802		echo "#define CONFIG_$${CTYPE}"	>>include/config.h ; \
803	fi; \
804	echo "#define CONFIG_$${CFREQ}MHz"	>>include/config.h ; \
805	echo "... with $${CFREQ}MHz system clock" ; \
806	if [ "$${CACHE}" == "yes" ] ; then \
807		echo "#define CONFIG_L2_CACHE"	>>include/config.h ; \
808		echo "... with L2 Cache support" ; \
809	else \
810		echo "#undef CONFIG_L2_CACHE"	>>include/config.h ; \
811		echo "... without L2 Cache support" ; \
812	fi; \
813	if [ "$${BMODE}" == "60x" ] ; then \
814		echo "#define CONFIG_BUSMODE_60x" >>include/config.h ; \
815		echo "... with 60x Bus Mode" ; \
816	else \
817		echo "#undef CONFIG_BUSMODE_60x"  >>include/config.h ; \
818		echo "... without 60x Bus Mode" ; \
819	fi
820	@./mkconfig -a TQM8260 ppc mpc8260 tqm8260
821
822ZPC1900_config: unconfig
823	@./mkconfig $(@:_config=) ppc mpc8260 zpc1900
824
825#========================================================================
826# M68K
827#========================================================================
828#########################################################################
829## Coldfire
830#########################################################################
831
832M5272C3_config :		unconfig
833	@./mkconfig $(@:_config=) m68k coldfire m5272c3
834
835M5282EVB_config :		unconfig
836	@./mkconfig $(@:_config=) m68k coldfire m5282evb
837
838#########################################################################
839## MPC85xx Systems
840#########################################################################
841
842MPC8540ADS_config:      unconfig
843	@./mkconfig $(@:_config=) ppc mpc85xx mpc8540ads
844
845MPC8560ADS_config:      unconfig
846	@./mkconfig $(@:_config=) ppc mpc85xx mpc8560ads
847
848#########################################################################
849## 74xx/7xx Systems
850#########################################################################
851
852AmigaOneG3SE_config:	unconfig
853	@./mkconfig $(@:_config=) ppc 74xx_7xx AmigaOneG3SE MAI
854
855BAB7xx_config: unconfig
856	@./mkconfig $(@:_config=) ppc 74xx_7xx bab7xx eltec
857
858DB64360_config:  unconfig
859	@./mkconfig DB64360 ppc 74xx_7xx db64360 Marvell
860
861DB64460_config:  unconfig
862	@./mkconfig DB64460 ppc 74xx_7xx db64460 Marvell
863
864debris_config: unconfig
865	@./mkconfig $(@:_config=) ppc mpc824x debris etin
866
867ELPPC_config: unconfig
868	@./mkconfig $(@:_config=) ppc 74xx_7xx elppc eltec
869
870EVB64260_config	\
871EVB64260_750CX_config:	unconfig
872	@./mkconfig EVB64260 ppc 74xx_7xx evb64260
873
874P3G4_config: unconfig
875	@./mkconfig $(@:_config=) ppc 74xx_7xx evb64260
876
877PCIPPC2_config \
878PCIPPC6_config: unconfig
879	@./mkconfig $(@:_config=) ppc 74xx_7xx pcippc2
880
881ZUMA_config:	unconfig
882	@./mkconfig $(@:_config=) ppc 74xx_7xx evb64260
883
884#========================================================================
885# ARM
886#========================================================================
887#########################################################################
888## StrongARM Systems
889#########################################################################
890
891at91rm9200dk_config	:	unconfig
892	@./mkconfig $(@:_config=) arm at91rm9200 at91rm9200dk
893
894lart_config	:	unconfig
895	@./mkconfig $(@:_config=) arm sa1100 lart
896
897dnp1110_config	:	unconfig
898	@./mkconfig $(@:_config=) arm sa1100 dnp1110
899
900shannon_config	:	unconfig
901	@./mkconfig $(@:_config=) arm sa1100 shannon
902
903#########################################################################
904## ARM92xT Systems
905#########################################################################
906
907xtract_trab = $(subst _bigram,,$(subst _bigflash,,$(subst _old,,$(subst _config,,$1))))
908
909omap1510inn_config :	unconfig
910	@./mkconfig $(@:_config=) arm arm925t omap1510inn
911
912omap1610inn_config :	unconfig
913	@./mkconfig $(@:_config=) arm arm926ejs omap1610inn
914
915smdk2400_config	:	unconfig
916	@./mkconfig $(@:_config=) arm arm920t smdk2400
917
918smdk2410_config	:	unconfig
919	@./mkconfig $(@:_config=) arm arm920t smdk2410
920
921# TRAB default configuration:	8 MB Flash, 32 MB RAM
922trab_config \
923trab_bigram_config \
924trab_bigflash_config \
925trab_old_config:	unconfig
926	@ >include/config.h
927	@[ -z "$(findstring _bigram,$@)" ] || \
928		{ echo "#define CONFIG_FLASH_8MB"  >>include/config.h ; \
929		  echo "#define CONFIG_RAM_32MB"   >>include/config.h ; \
930		  echo "... with 8 MB Flash, 32 MB RAM" ; \
931		}
932	@[ -z "$(findstring _bigflash,$@)" ] || \
933		{ echo "#define CONFIG_FLASH_16MB" >>include/config.h ; \
934		  echo "#define CONFIG_RAM_16MB"   >>include/config.h ; \
935		  echo "... with 16 MB Flash, 16 MB RAM" ; \
936		  echo "TEXT_BASE = 0x0CF40000" >board/trab/config.tmp ; \
937		}
938	@[ -z "$(findstring _old,$@)" ] || \
939		{ echo "#define CONFIG_FLASH_8MB"  >>include/config.h ; \
940		  echo "#define CONFIG_RAM_16MB"   >>include/config.h ; \
941		  echo "... with 8 MB Flash, 16 MB RAM" ; \
942		  echo "TEXT_BASE = 0x0CF40000" >board/trab/config.tmp ; \
943		}
944	@./mkconfig -a $(call xtract_trab,$@) arm arm920t trab
945
946VCMA9_config	:	unconfig
947	@./mkconfig $(@:_config=) arm arm920t vcma9 mpl
948
949#########################################################################
950## ARM720T Systems
951#########################################################################
952
953impa7_config	:	unconfig
954	@./mkconfig $(@:_config=) arm arm720t impa7
955
956ep7312_config	:	unconfig
957	@./mkconfig $(@:_config=) arm arm720t ep7312
958
959#########################################################################
960## XScale Systems
961#########################################################################
962
963cradle_config	:	unconfig
964	@./mkconfig $(@:_config=) arm pxa cradle
965
966csb226_config	:	unconfig
967	@./mkconfig $(@:_config=) arm pxa csb226
968
969innokom_config	:	unconfig
970	@./mkconfig $(@:_config=) arm pxa innokom
971
972ixdp425_config	:	unconfig
973	@./mkconfig $(@:_config=) arm ixp ixdp425
974
975lubbock_config	:	unconfig
976	@./mkconfig $(@:_config=) arm pxa lubbock
977
978logodl_config	:	unconfig
979	@./mkconfig $(@:_config=) arm pxa logodl
980
981wepep250_config	:	unconfig
982	@./mkconfig $(@:_config=) arm pxa wepep250
983
984#========================================================================
985# i386
986#========================================================================
987#########################################################################
988## AMD SC520 CDP
989#########################################################################
990sc520_cdp_config	:	unconfig
991	@./mkconfig $(@:_config=) i386 i386 sc520_cdp
992
993sc520_spunk_config	:	unconfig
994	@./mkconfig $(@:_config=) i386 i386 sc520_spunk
995
996sc520_spunk_rel_config	:	unconfig
997	@./mkconfig $(@:_config=) i386 i386 sc520_spunk
998
999#========================================================================
1000# MIPS
1001#========================================================================
1002#########################################################################
1003## MIPS32 4Kc
1004#########################################################################
1005
1006xtract_incaip = $(subst _100MHz,,$(subst _133MHz,,$(subst _150MHz,,$(subst _config,,$1))))
1007
1008incaip_100MHz_config	\
1009incaip_133MHz_config	\
1010incaip_150MHz_config	\
1011incaip_config: unconfig
1012	@ >include/config.h
1013	@[ -z "$(findstring _100MHz,$@)" ] || \
1014		{ echo "#define CPU_CLOCK_RATE 100000000" >>include/config.h ; \
1015		  echo "... with 100MHz system clock" ; \
1016		}
1017	@[ -z "$(findstring _133MHz,$@)" ] || \
1018		{ echo "#define CPU_CLOCK_RATE 133000000" >>include/config.h ; \
1019		  echo "... with 133MHz system clock" ; \
1020		}
1021	@[ -z "$(findstring _150MHz,$@)" ] || \
1022		{ echo "#define CPU_CLOCK_RATE 150000000" >>include/config.h ; \
1023		  echo "... with 150MHz system clock" ; \
1024		}
1025	@./mkconfig -a $(call xtract_incaip,$@) mips mips incaip
1026
1027#########################################################################
1028## MIPS64 5Kc
1029#########################################################################
1030
1031purple_config :		unconfig
1032	@./mkconfig $(@:_config=) mips mips purple
1033
1034#========================================================================
1035# Nios
1036#========================================================================
1037#########################################################################
1038## Nios32
1039#########################################################################
1040
1041DK1C20_safe_32_config		\
1042DK1C20_standard_32_config	\
1043DK1C20_config:	unconfig
1044	@ >include/config.h
1045	@[ -z "$(findstring _safe_32,$@)" ] || \
1046		{ echo "#define CONFIG_NIOS_SAFE_32 1" >>include/config.h ; \
1047		  echo "... NIOS 'safe_32' configuration" ; \
1048		}
1049	@[ -z "$(findstring _standard_32,$@)" ] || \
1050		{ echo "#define CONFIG_NIOS_STANDARD_32 1" >>include/config.h ; \
1051		  echo "... NIOS 'standard_32' configuration" ; \
1052		}
1053	@[ -z "$(findstring DK1C20_config,$@)" ] || \
1054		{ echo "#define CONFIG_NIOS_STANDARD_32 1" >>include/config.h ; \
1055		  echo "... NIOS 'standard_32' configuration (DEFAULT)" ; \
1056		}
1057	@./mkconfig -a DK1C20 nios nios dk1c20 altera
1058
1059DK1S10_safe_32_config		\
1060DK1S10_standard_32_config	\
1061DK1S10_config:	unconfig
1062	@ >include/config.h
1063	@[ -z "$(findstring _safe_32,$@)" ] || \
1064		{ echo "#define CONFIG_NIOS_SAFE_32 1" >>include/config.h ; \
1065		  echo "... NIOS 'safe_32' configuration" ; \
1066		}
1067	@[ -z "$(findstring _standard_32,$@)" ] || \
1068		{ echo "#define CONFIG_NIOS_STANDARD_32 1" >>include/config.h ; \
1069		  echo "... NIOS 'standard_32' configuration" ; \
1070		}
1071	@[ -z "$(findstring DK1S10_config,$@)" ] || \
1072		{ echo "#define CONFIG_NIOS_STANDARD_32 1" >>include/config.h ; \
1073		  echo "... NIOS 'standard_32' configuration (DEFAULT)" ; \
1074		}
1075	@./mkconfig -a DK1S10 nios nios dk1s10 altera
1076
1077
1078#########################################################################
1079## MIPS32 AU1X00
1080#########################################################################
1081dbau1000_config		: 	unconfig
1082	@ >include/config.h
1083	@echo "#define CONFIG_DBAU1000 1" >>include/config.h
1084	@./mkconfig -a dbau1x00 mips mips dbau1x00
1085
1086dbau1100_config		: 	unconfig
1087	@ >include/config.h
1088	@echo "#define CONFIG_DBAU1100 1" >>include/config.h
1089	@./mkconfig -a dbau1x00 mips mips dbau1x00
1090
1091dbau1500_config		: 	unconfig
1092	@ >include/config.h
1093	@echo "#define CONFIG_DBAU1500 1" >>include/config.h
1094	@./mkconfig -a dbau1x00 mips mips dbau1x00
1095
1096#########################################################################
1097#########################################################################
1098
1099clean:
1100	find . -type f \
1101		\( -name 'core' -o -name '*.bak' -o -name '*~' \
1102		-o -name '*.o'  -o -name '*.a'  \) -print \
1103		| xargs rm -f
1104	rm -f examples/hello_world examples/timer \
1105	      examples/eepro100_eeprom examples/sched \
1106	      examples/mem_to_mem_idma2intr examples/82559_eeprom
1107
1108	rm -f tools/img2srec tools/mkimage tools/envcrc tools/gen_eth_addr
1109	rm -f tools/easylogo/easylogo tools/bmp_logo
1110	rm -f tools/gdb/astest tools/gdb/gdbcont tools/gdb/gdbsend
1111	rm -f tools/env/fw_printenv tools/env/fw_setenv
1112	rm -f board/cray/L1/bootscript.c board/cray/L1/bootscript.image
1113	rm -f board/trab/trab_fkt board/*/config.tmp
1114
1115clobber:	clean
1116	find . -type f \
1117		\( -name .depend -o -name '*.srec' -o -name '*.bin' \) \
1118		-print \
1119		| xargs rm -f
1120	rm -f $(OBJS) *.bak tags TAGS
1121	rm -fr *.*~
1122	rm -f u-boot u-boot.map $(ALL)
1123	rm -f tools/crc32.c tools/environment.c tools/env/crc32.c
1124	rm -f tools/inca-swap-bytes cpu/mpc824x/bedbug_603e.c
1125	rm -f include/asm/proc include/asm/arch include/asm
1126
1127mrproper \
1128distclean:	clobber unconfig
1129
1130backup:
1131	F=`basename $(TOPDIR)` ; cd .. ; \
1132	gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
1133
1134#########################################################################
1135