blob: e5da6f18599452f4ec68bff8190bf789dc402a34 [file] [log] [blame]
Peter Tysera5a27b92009-12-06 23:58:28 -06001#!/bin/bash
Wolfgang Denk7b74fec2010-10-17 12:26:48 +02002# Tool mainly for U-Boot Quality Assurance: build one or more board
3# configurations with minimal verbosity, showing only warnings and
4# errors.
Mike Frysingered639982011-04-21 22:01:43 +00005
6usage()
7{
8 # if exiting with 0, write to stdout, else write to stderr
9 local ret=${1:-0}
10 [ "${ret}" -eq 1 ] && exec 1>&2
11 cat <<-EOF
12 Usage: MAKEALL [options] [--] [boards-to-build]
13
14 Options:
15 -a ARCH, --arch ARCH Build all boards with arch ARCH
16 -c CPU, --cpu CPU Build all boards with cpu CPU
17 -v VENDOR, --vendor VENDOR Build all boards with vendor VENDOR
18 -s SOC, --soc SOC Build all boards with soc SOC
Marek Vasutcc3e1cb2011-12-02 21:32:03 +000019 -l, --list List all targets to be built
Marek Vasut4f21ade2012-03-05 15:10:51 +000020 -m, --maintainers List all targets and maintainer email
21 -M, --mails List all targets and all affilated emails
Mike Frysingered639982011-04-21 22:01:43 +000022 -h, --help This help output
23
24 Selections by these options are logically ANDed; if the same option
25 is used repeatedly, such selections are ORed. So "-v FOO -v BAR"
26 will select all configurations where the vendor is either FOO or
27 BAR. Any additional arguments specified on the command line are
28 always build additionally. See the boards.cfg file for more info.
Wolfgang Denk7b74fec2010-10-17 12:26:48 +020029
Mike Frysingered639982011-04-21 22:01:43 +000030 If no boards are specified, then the default is "powerpc".
31
32 Environment variables:
33 BUILD_NCPUS number of parallel make jobs (default: auto)
34 CROSS_COMPILE cross-compiler toolchain prefix (default: "")
35 MAKEALL_LOGDIR output all logs to here (default: ./LOG/)
36 BUILD_DIR output build directory (default: ./)
37
38 Examples:
39 - build all Power Architecture boards:
40 MAKEALL -a powerpc
41 MAKEALL --arch powerpc
42 MAKEALL powerpc
43 - build all PowerPC boards manufactured by vendor "esd":
44 MAKEALL -a powerpc -v esd
45 - build all PowerPC boards manufactured either by "keymile" or "siemens":
46 MAKEALL -a powerpc -v keymile -v siemens
47 - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
48 MAKEALL -c mpc83xx -v freescale 4xx
49 EOF
50 exit ${ret}
51}
52
Marek Vasut4f21ade2012-03-05 15:10:51 +000053SHORT_OPTS="ha:c:v:s:lmM"
54LONG_OPTS="help,arch:,cpu:,vendor:,soc:,list,maintainers,mails"
Wolfgang Denk7b74fec2010-10-17 12:26:48 +020055
56# Option processing based on util-linux-2.13/getopt-parse.bash
57
Wolfgang Denk1136f692010-10-27 22:48:30 +020058# Note that we use `"$@"' to let each command-line parameter expand to a
Wolfgang Denk7b74fec2010-10-17 12:26:48 +020059# separate word. The quotes around `$@' are essential!
60# We need TEMP as the `eval set --' would nuke the return value of
61# getopt.
62TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \
63 -n 'MAKEALL' -- "$@"`
64
Mike Frysingered639982011-04-21 22:01:43 +000065[ $? != 0 ] && usage 1
Wolfgang Denk7b74fec2010-10-17 12:26:48 +020066
67# Note the quotes around `$TEMP': they are essential!
68eval set -- "$TEMP"
69
70SELECTED=''
Marek Vasutcc3e1cb2011-12-02 21:32:03 +000071ONLY_LIST=''
Marek Vasut4f21ade2012-03-05 15:10:51 +000072PRINT_MAINTS=''
73MAINTAINERS_ONLY=''
Wolfgang Denk7b74fec2010-10-17 12:26:48 +020074
75while true ; do
76 case "$1" in
77 -a|--arch)
78 # echo "Option ARCH: argument \`$2'"
79 if [ "$opt_a" ] ; then
80 opt_a="${opt_a%)} || \$2 == \"$2\")"
81 else
82 opt_a="(\$2 == \"$2\")"
83 fi
84 SELECTED='y'
85 shift 2 ;;
86 -c|--cpu)
87 # echo "Option CPU: argument \`$2'"
88 if [ "$opt_c" ] ; then
89 opt_c="${opt_c%)} || \$3 == \"$2\")"
90 else
91 opt_c="(\$3 == \"$2\")"
92 fi
93 SELECTED='y'
94 shift 2 ;;
95 -s|--soc)
96 # echo "Option SoC: argument \`$2'"
97 if [ "$opt_s" ] ; then
98 opt_s="${opt_s%)} || \$6 == \"$2\")"
99 else
100 opt_s="(\$6 == \"$2\")"
101 fi
102 SELECTED='y'
103 shift 2 ;;
104 -v|--vendor)
105 # echo "Option VENDOR: argument \`$2'"
106 if [ "$opt_v" ] ; then
107 opt_v="${opt_v%)} || \$5 == \"$2\")"
108 else
109 opt_v="(\$5 == \"$2\")"
110 fi
111 SELECTED='y'
112 shift 2 ;;
Marek Vasutcc3e1cb2011-12-02 21:32:03 +0000113 -l|--list)
114 ONLY_LIST='y'
115 shift ;;
Marek Vasut4f21ade2012-03-05 15:10:51 +0000116 -m|--maintainers)
117 ONLY_LIST='y'
118 PRINT_MAINTS='y'
119 MAINTAINERS_ONLY='y'
120 shift ;;
121 -M|--mails)
122 ONLY_LIST='y'
123 PRINT_MAINTS='y'
124 shift ;;
Mike Frysingered639982011-04-21 22:01:43 +0000125 -h|--help)
126 usage ;;
Wolfgang Denk7b74fec2010-10-17 12:26:48 +0200127 --)
128 shift ; break ;;
129 *)
130 echo "Internal error!" >&2 ; exit 1 ;;
131 esac
132done
133# echo "Remaining arguments:"
134# for arg do echo '--> '"\`$arg'" ; done
135
136FILTER="\$1 !~ /^#/"
137[ "$opt_a" ] && FILTER="${FILTER} && $opt_a"
138[ "$opt_c" ] && FILTER="${FILTER} && $opt_c"
139[ "$opt_s" ] && FILTER="${FILTER} && $opt_s"
140[ "$opt_v" ] && FILTER="${FILTER} && $opt_v"
141
142if [ "$SELECTED" ] ; then
143 SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
Peter Tyser2f887602010-10-29 17:59:06 -0500144
145 # Make sure some boards from boards.cfg are actually found
146 if [ -z "$SELECTED" ] ; then
147 echo "Error: No boards selected, invalid arguments"
148 exit 1
149 fi
Wolfgang Denk7b74fec2010-10-17 12:26:48 +0200150fi
151
152#########################################################################
153
Peter Tyser23240d22009-09-21 12:04:32 -0500154# Print statistics when we exit
155trap exit 1 2 3 15
156trap print_stats 0
157
Wolfgang Denkde5d6602008-12-09 00:39:08 +0100158# Determine number of CPU cores if no default was set
159: ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
160
161if [ "$BUILD_NCPUS" -gt 1 ]
162then
Peter Tyser8a07f9a2009-09-21 12:04:33 -0500163 JOBS="-j $((BUILD_NCPUS + 1))"
Wolfgang Denkde5d6602008-12-09 00:39:08 +0100164else
165 JOBS=""
166fi
167
wdenkc0aa5c52003-12-06 19:49:23 +0000168
wdenk7ebf7442002-11-02 23:17:16 +0000169if [ "${CROSS_COMPILE}" ] ; then
170 MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
171else
172 MAKE=make
173fi
174
Marian Balakowiczd62379d2006-09-01 19:49:50 +0200175if [ "${MAKEALL_LOGDIR}" ] ; then
176 LOG_DIR=${MAKEALL_LOGDIR}
177else
178 LOG_DIR="LOG"
179fi
Stefan Roese42fbddd2006-09-07 11:51:23 +0200180
Marian Balakowiczd62379d2006-09-01 19:49:50 +0200181if [ ! "${BUILD_DIR}" ] ; then
182 BUILD_DIR="."
183fi
184
Marian Balakowicz7f783cb2006-09-07 12:05:53 +0200185[ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
wdenk7ebf7442002-11-02 23:17:16 +0000186
187LIST=""
188
Peter Tyser23240d22009-09-21 12:04:32 -0500189# Keep track of the number of builds and errors
190ERR_CNT=0
191ERR_LIST=""
192TOTAL_CNT=0
Peter Tysera5a27b92009-12-06 23:58:28 -0600193RC=0
Peter Tyser23240d22009-09-21 12:04:32 -0500194
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400195# Helper funcs for parsing boards.cfg
196boards_by_field()
197{
198 awk \
199 -v field="$1" \
200 -v select="$2" \
201 '($1 !~ /^#/ && $field == select) { print $1 }' \
202 boards.cfg
203}
204boards_by_arch() { boards_by_field 2 "$@" ; }
205boards_by_cpu() { boards_by_field 3 "$@" ; }
Andreas Bießmannbb96a8e2010-11-30 09:45:04 +0000206boards_by_soc() { boards_by_field 6 "$@" ; }
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400207
wdenk7ebf7442002-11-02 23:17:16 +0000208#########################################################################
wdenk359733b2003-03-31 17:27:09 +0000209## MPC5xx Systems
210#########################################################################
211
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400212LIST_5xx="$(boards_by_cpu mpc5xx)"
wdenk359733b2003-03-31 17:27:09 +0000213
214#########################################################################
wdenk21136db2003-07-16 21:53:01 +0000215## MPC5xxx Systems
216#########################################################################
217
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200218LIST_5xxx="$(boards_by_cpu mpc5xxx)"
wdenk21136db2003-07-16 21:53:01 +0000219
220#########################################################################
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200221## MPC512x Systems
222#########################################################################
223
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200224LIST_512x="$(boards_by_cpu mpc512x)"
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200225
226#########################################################################
wdenk7ebf7442002-11-02 23:17:16 +0000227## MPC8xx Systems
228#########################################################################
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400229
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200230LIST_8xx="$(boards_by_cpu mpc8xx)"
wdenk7ebf7442002-11-02 23:17:16 +0000231
232#########################################################################
233## PPC4xx Systems
234#########################################################################
235
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200236LIST_4xx="$(boards_by_cpu ppc4xx)"
wdenk7ebf7442002-11-02 23:17:16 +0000237
238#########################################################################
wdenk337f5652004-10-28 00:09:35 +0000239## MPC8220 Systems
240#########################################################################
241
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400242LIST_8220="$(boards_by_cpu mpc8220)"
wdenk337f5652004-10-28 00:09:35 +0000243
244#########################################################################
wdenk7ebf7442002-11-02 23:17:16 +0000245## MPC824x Systems
246#########################################################################
247
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200248LIST_824x="$(boards_by_cpu mpc824x)"
wdenkdbae5042003-06-21 00:17:24 +0000249
wdenk7ebf7442002-11-02 23:17:16 +0000250#########################################################################
wdenk541a76d2003-05-03 15:50:43 +0000251## MPC8260 Systems (includes 8250, 8255 etc.)
wdenk7ebf7442002-11-02 23:17:16 +0000252#########################################################################
253
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200254LIST_8260="$(boards_by_cpu mpc8260)"
wdenk7ebf7442002-11-02 23:17:16 +0000255
256#########################################################################
Eran Liberty9095d4a2005-07-28 10:08:46 -0500257## MPC83xx Systems (includes 8349, etc.)
258#########################################################################
259
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200260LIST_83xx="$(boards_by_cpu mpc83xx)"
Eran Liberty9095d4a2005-07-28 10:08:46 -0500261
262#########################################################################
wdenk9c53f402003-10-15 23:53:47 +0000263## MPC85xx Systems (includes 8540, 8560 etc.)
264#########################################################################
265
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200266LIST_85xx="$(boards_by_cpu mpc85xx)"
wdenk9c53f402003-10-15 23:53:47 +0000267
268#########################################################################
Jon Loeliger5fe34492007-05-23 14:09:46 -0500269## MPC86xx Systems
270#########################################################################
271
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200272LIST_86xx="$(boards_by_cpu mpc86xx)"
Jon Loeliger5fe34492007-05-23 14:09:46 -0500273
274#########################################################################
wdenk7ebf7442002-11-02 23:17:16 +0000275## 74xx/7xx Systems
276#########################################################################
277
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200278LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
wdenk7ebf7442002-11-02 23:17:16 +0000279
Wolfgang Denk66549bd2008-04-20 15:35:52 -0700280#########################################################################
281## PowerPC groups
282#########################################################################
283
284LIST_TSEC=" \
285 ${LIST_83xx} \
286 ${LIST_85xx} \
287 ${LIST_86xx} \
288"
289
Stefan Roese88fbf932010-04-15 16:07:28 +0200290LIST_powerpc=" \
Kim Phillips8c0c8932007-08-10 15:34:48 -0500291 ${LIST_5xx} \
Jean-Christophe PLAGNIOL-VILLARD0912d312007-11-25 22:39:25 +0100292 ${LIST_512x} \
Kim Phillips8c0c8932007-08-10 15:34:48 -0500293 ${LIST_5xxx} \
294 ${LIST_8xx} \
295 ${LIST_8220} \
296 ${LIST_824x} \
297 ${LIST_8260} \
298 ${LIST_83xx} \
299 ${LIST_85xx} \
300 ${LIST_86xx} \
301 ${LIST_4xx} \
Wolfgang Denk291ba1b2010-10-06 09:05:45 +0200302 ${LIST_74xx_7xx}\
Kim Phillips8c0c8932007-08-10 15:34:48 -0500303"
wdenk7ebf7442002-11-02 23:17:16 +0000304
Stefan Roese88fbf932010-04-15 16:07:28 +0200305# Alias "ppc" -> "powerpc" to not break compatibility with older scripts
306# still using "ppc" instead of "powerpc"
307LIST_ppc=" \
308 ${LIST_powerpc} \
309"
310
wdenk7ebf7442002-11-02 23:17:16 +0000311#########################################################################
312## StrongARM Systems
313#########################################################################
314
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400315LIST_SA="$(boards_by_cpu sa1100)"
wdenk7ebf7442002-11-02 23:17:16 +0000316
317#########################################################################
wdenk7ebf7442002-11-02 23:17:16 +0000318## ARM9 Systems
319#########################################################################
320
Wolfgang Denk10766192011-09-08 05:01:24 +0000321LIST_ARM9="$(boards_by_cpu arm920t) \
322 $(boards_by_cpu arm926ejs) \
323 $(boards_by_cpu arm925t) \
wdenk7eaacc52003-08-29 22:00:43 +0000324"
wdenk7ebf7442002-11-02 23:17:16 +0000325
326#########################################################################
wdenkf8062712005-01-09 23:16:25 +0000327## ARM11 Systems
328#########################################################################
Wolfgang Denk10766192011-09-08 05:01:24 +0000329LIST_ARM11="$(boards_by_cpu arm1136) \
Guennadi Liakhovetskib093d8d2009-03-25 11:36:50 +0100330 imx31_phycore \
331 imx31_phycore_eet \
Magnus Lilja6eeb6f72009-07-01 01:07:55 +0200332 mx31pdk \
Guennadi Liakhovetskib093d8d2009-03-25 11:36:50 +0100333 smdk6400 \
Wolfgang Denkadf20a12005-09-25 01:48:28 +0200334"
wdenkf8062712005-01-09 23:16:25 +0000335
336#########################################################################
Steve Sakoman6329a8f2010-06-17 21:50:01 -0700337## ARMV7 Systems
Dirk Behme2781f802009-01-27 18:19:12 +0100338#########################################################################
Dirk Behme1b787e32011-08-05 20:48:32 +0000339
340LIST_ARMV7="$(boards_by_cpu armv7)"
Dirk Behme2781f802009-01-27 18:19:12 +0100341
342#########################################################################
Jean-Christophe PLAGNIOL-VILLARD9a88fd12008-05-24 12:47:46 +0200343## AT91 Systems
344#########################################################################
345
Thomas Petazzonia5e85762011-08-04 11:08:50 +0000346LIST_at91="$(boards_by_soc at91)"
Jean-Christophe PLAGNIOL-VILLARD9a88fd12008-05-24 12:47:46 +0200347
348#########################################################################
wdenk7ebf7442002-11-02 23:17:16 +0000349## Xscale Systems
350#########################################################################
351
Marek Vasut4ccaaef2010-10-04 00:21:51 +0200352LIST_pxa="$(boards_by_cpu pxa)"
wdenk7ebf7442002-11-02 23:17:16 +0000353
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400354LIST_ixp="$(boards_by_cpu ixp)
Kim Phillips8c0c8932007-08-10 15:34:48 -0500355 pdnb3 \
356 scpu \
357"
wdenk7ebf7442002-11-02 23:17:16 +0000358
Wolfgang Denk66549bd2008-04-20 15:35:52 -0700359#########################################################################
360## ARM groups
361#########################################################################
wdenkbd1575f2003-10-14 19:43:55 +0000362
Dirk Behme2781f802009-01-27 18:19:12 +0100363LIST_arm=" \
364 ${LIST_SA} \
Dirk Behme2781f802009-01-27 18:19:12 +0100365 ${LIST_ARM9} \
366 ${LIST_ARM10} \
367 ${LIST_ARM11} \
Steve Sakoman6329a8f2010-06-17 21:50:01 -0700368 ${LIST_ARMV7} \
Dirk Behme2781f802009-01-27 18:19:12 +0100369 ${LIST_at91} \
370 ${LIST_pxa} \
371 ${LIST_ixp} \
wdenkf8062712005-01-09 23:16:25 +0000372"
wdenk7ebf7442002-11-02 23:17:16 +0000373
wdenkbb1b8262003-03-27 12:09:35 +0000374#########################################################################
Wolfgang Denkbc8c5002005-08-14 00:27:00 +0200375## MIPS Systems (default = big endian)
wdenkbb1b8262003-03-27 12:09:35 +0000376#########################################################################
377
Kim Phillips8c0c8932007-08-10 15:34:48 -0500378LIST_mips4kc=" \
379 incaip \
Vlad Lungu635e76c2008-01-16 19:27:51 +0200380 qemu_mips \
Stefan Roeseee7a6ba2009-01-21 17:25:01 +0100381 vct_platinum \
382 vct_platinum_small \
383 vct_platinum_onenand \
384 vct_platinum_onenand_small \
385 vct_platinumavc \
386 vct_platinumavc_small \
387 vct_platinumavc_onenand \
388 vct_platinumavc_onenand_small \
389 vct_premium \
390 vct_premium_small \
391 vct_premium_onenand \
392 vct_premium_onenand_small \
Kim Phillips8c0c8932007-08-10 15:34:48 -0500393"
wdenkbb1b8262003-03-27 12:09:35 +0000394
Kim Phillips8c0c8932007-08-10 15:34:48 -0500395LIST_au1xx0=" \
396 dbau1000 \
397 dbau1100 \
398 dbau1500 \
399 dbau1550 \
Kim Phillips8c0c8932007-08-10 15:34:48 -0500400 gth2 \
401"
wdenk9b7f3842003-10-09 20:09:04 +0000402
Kim Phillips8c0c8932007-08-10 15:34:48 -0500403LIST_mips=" \
404 ${LIST_mips4kc} \
405 ${LIST_mips5kc} \
406 ${LIST_au1xx0} \
407"
wdenkbb1b8262003-03-27 12:09:35 +0000408
wdenkabda5ca2003-05-31 18:35:21 +0000409#########################################################################
Wolfgang Denkbc8c5002005-08-14 00:27:00 +0200410## MIPS Systems (little endian)
411#########################################################################
412
Daniel Schwierzecka10aa182011-11-24 03:57:56 +0000413LIST_xburst_el=" \
Xiangfu Liu7306ccb2011-10-12 12:24:06 +0800414 qi_lb60 \
415"
Wolfgang Denkbc8c5002005-08-14 00:27:00 +0200416
Kim Phillips8c0c8932007-08-10 15:34:48 -0500417LIST_au1xx0_el=" \
418 dbau1550_el \
Shinya Kuribayashi2437cfb2007-10-27 15:00:25 +0900419 pb1000 \
Kim Phillips8c0c8932007-08-10 15:34:48 -0500420"
Kim Phillips8c0c8932007-08-10 15:34:48 -0500421LIST_mips_el=" \
Daniel Schwierzecka10aa182011-11-24 03:57:56 +0000422 ${LIST_xburst_el} \
Kim Phillips8c0c8932007-08-10 15:34:48 -0500423 ${LIST_au1xx0_el} \
424"
Stefan Kristianssonc69cb3e2011-11-18 19:21:37 +0000425#########################################################################
426## OpenRISC Systems
427#########################################################################
428
429LIST_openrisc="$(boards_by_arch openrisc)"
Wolfgang Denkbc8c5002005-08-14 00:27:00 +0200430
431#########################################################################
Graeme Russcbfce1d2011-04-13 19:43:28 +1000432## x86 Systems
wdenkabda5ca2003-05-31 18:35:21 +0000433#########################################################################
434
Graeme Russcbfce1d2011-04-13 19:43:28 +1000435LIST_x86="$(boards_by_arch x86)"
wdenkabda5ca2003-05-31 18:35:21 +0000436
wdenk3be717f2004-01-03 19:43:48 +0000437#########################################################################
wdenkef3386f2004-10-10 21:27:30 +0000438## Nios-II Systems
439#########################################################################
440
Mike Frysingerda6aa7c2011-06-26 23:00:19 -0400441LIST_nios2="$(boards_by_arch nios2)"
wdenkef3386f2004-10-10 21:27:30 +0000442
443#########################################################################
wdenk20a61222004-07-10 23:48:41 +0000444## MicroBlaze Systems
445#########################################################################
446
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400447LIST_microblaze="$(boards_by_arch microblaze)"
wdenk20a61222004-07-10 23:48:41 +0000448
Zachary P. Landau1c3c0962006-01-26 17:38:46 -0500449#########################################################################
450## ColdFire Systems
451#########################################################################
452
Mike Frysinger6a9c0232011-09-25 19:27:19 +0000453LIST_m68k="$(boards_by_arch m68k)
Kim Phillips8c0c8932007-08-10 15:34:48 -0500454 EB+MCF-EV123 \
455 EB+MCF-EV123_internal \
TsiChungLiew99b037a2008-01-14 17:43:33 -0600456 M52277EVB \
TsiChungLiewb859ef12007-08-16 19:23:50 -0500457 M5235EVB \
TsiChung Liew3cdc00a2008-08-11 13:41:49 +0000458 M54451EVB \
TsiChungLiewfc3ca3b2007-08-16 15:05:11 -0500459 M54455EVB \
Heiko Schocherac1956e2006-04-20 08:42:42 +0200460"
Mike Frysinger6a9c0232011-09-25 19:27:19 +0000461LIST_coldfire=${LIST_m68k}
Zachary P. Landau1c3c0962006-01-26 17:38:46 -0500462
Wolfgang Denk994ad962006-10-24 14:42:37 +0200463#########################################################################
464## AVR32 Systems
465#########################################################################
466
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400467LIST_avr32="$(boards_by_arch avr32)"
Wolfgang Denk994ad962006-10-24 14:42:37 +0200468
Aubrey.Li450c23e2007-03-09 13:40:56 +0800469#########################################################################
470## Blackfin Systems
471#########################################################################
472
Mike Frysingerdd18ab62010-10-19 02:41:26 -0400473LIST_blackfin="$(boards_by_arch blackfin)"
Aubrey.Li450c23e2007-03-09 13:40:56 +0800474
Jean-Christophe PLAGNIOL-VILLARDceee3382007-11-27 09:44:53 +0100475#########################################################################
476## SH Systems
477#########################################################################
478
Nobuhiro Iwamatsu0c4bcc72010-10-20 01:22:25 +0900479LIST_sh2="$(boards_by_cpu sh2)"
Nobuhiro Iwamatsu06ea8cf2010-10-20 01:28:29 +0900480LIST_sh3="$(boards_by_cpu sh3)"
Nobuhiro Iwamatsuc4c62342010-10-20 01:35:28 +0900481LIST_sh4="$(boards_by_cpu sh4)"
Jean-Christophe PLAGNIOL-VILLARDceee3382007-11-27 09:44:53 +0100482
Nobuhiro Iwamatsuc4c62342010-10-20 01:35:28 +0900483LIST_sh="$(boards_by_arch sh)"
Jean-Christophe PLAGNIOL-VILLARDceee3382007-11-27 09:44:53 +0100484
Daniel Hellstrom9d7c6b22008-03-28 09:47:00 +0100485#########################################################################
486## SPARC Systems
487#########################################################################
488
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400489LIST_sparc="$(boards_by_arch sparc)"
wdenk7ebf7442002-11-02 23:17:16 +0000490
Macpaul Line0eb35a2011-10-19 20:41:10 +0000491#########################################################################
492## NDS32 Systems
493#########################################################################
494
495LIST_nds32="$(boards_by_arch nds32)"
496
wdenk7ebf7442002-11-02 23:17:16 +0000497#-----------------------------------------------------------------------
498
Marek Vasut4f21ade2012-03-05 15:10:51 +0000499get_target_location() {
500 local target=$1
501 local BOARD_NAME=""
502 local CONFIG_NAME=""
503 local board=""
504 local vendor=""
505
506 # Automatic mode
507 local line=`egrep -i "^[[:space:]]*${target}[[:space:]]" boards.cfg`
508
509 if [ -z "${line}" ] ; then echo "" ; return ; fi
510
511 set ${line}
512
513 # add default board name if needed
514 [ $# = 3 ] && set ${line} ${1}
515
516 CONFIG_NAME="${1%_config}"
517
518 [ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
519
520 if [ "$4" = "-" ] ; then
521 board=${BOARD_NAME}
522 else
523 board="$4"
524 fi
525
526 [ $# -gt 4 ] && [ "$5" != "-" ] && vendor="$5"
527 [ $# -gt 6 ] && [ "$7" != "-" ] && {
528 tmp="${7%:*}"
529 if [ "$tmp" ] ; then
530 CONFIG_NAME="$tmp"
531 fi
532 }
533
534 # Assign board directory to BOARDIR variable
535 if [ -z "${vendor}" ] ; then
536 BOARDDIR=${board}
537 else
538 BOARDDIR=${vendor}/${board}
539 fi
540
541 echo "${CONFIG_NAME}:${BOARDDIR}"
542}
543
544get_target_maintainers() {
545 local name=`echo $1 | cut -d : -f 1`
546
547 if ! grep -qsi "[[:blank:]]${name}[[:blank:]]" MAINTAINERS ; then
548 echo ""
549 return ;
550 fi
551
552 local line=`tac MAINTAINERS | grep -ni "[[:blank:]]${name}[[:blank:]]" | cut -d : -f 1`
553 local mail=`tac MAINTAINERS | tail -n +${line} | \
554 sed -n ":start /.*@.*/ { b mail } ; n ; b start ; :mail /.*@.*/ { p ; n ; b mail } ; q" | \
555 sed "s/^.*<//;s/>.*$//"`
556 echo "$mail"
557}
558
559list_target() {
560 if [ "$PRINT_MAINTS" != 'y' ] ; then
561 echo "$1"
562 return
563 fi
564
565 echo -n "$1:"
566
567 local loc=`get_target_location $1`
568
569 if [ -z "${loc}" ] ; then echo "ERROR" ; return ; fi
570
571 local maintainers_result=`get_target_maintainers ${loc} | tr " " "\n"`
572
573 if [ "$MAINTAINERS_ONLY" != 'y' ] ; then
574
575 local dir=`echo ${loc} | cut -d ":" -f 2`
576 local cfg=`echo ${loc} | cut -d ":" -f 1`
577 local git_result=`git log --format=%aE board/${dir} \
578 include/configs/${cfg}.h | grep "@"`
579 local git_result_recent=`echo ${git_result} | tr " " "\n" | \
580 head -n 3`
581 local git_result_top=`echo ${git_result} | tr " " "\n" | \
582 sort | uniq -c | sort -nr | head -n 3 | \
583 sed "s/^ \+[0-9]\+ \+//"`
584
585 echo -e "$git_result_recent\n$git_result_top\n$maintainers_result" | \
586 sort -u | tr "\n" " " | sed "s/ $//" ;
587 else
588 echo -e "$maintainers_result" | sort -u | tr "\n" " " | \
589 sed "s/ $//" ;
590 fi
591
592 echo ""
593}
594
wdenk7ebf7442002-11-02 23:17:16 +0000595build_target() {
596 target=$1
597
Marek Vasutcc3e1cb2011-12-02 21:32:03 +0000598 if [ "$ONLY_LIST" == 'y' ] ; then
Marek Vasut4f21ade2012-03-05 15:10:51 +0000599 list_target ${target}
Marek Vasutcc3e1cb2011-12-02 21:32:03 +0000600 return
601 fi
602
wdenk7ebf7442002-11-02 23:17:16 +0000603 ${MAKE} distclean >/dev/null
Kim Phillips5ac3c122010-09-14 14:48:16 -0500604 ${MAKE} -s ${target}_config
Marian Balakowiczd62379d2006-09-01 19:49:50 +0200605
606 ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
607 | tee ${LOG_DIR}/$target.ERR
Peter Tysera5a27b92009-12-06 23:58:28 -0600608
609 # Check for 'make' errors
610 if [ ${PIPESTATUS[0]} -ne 0 ] ; then
611 RC=1
612 fi
613
Peter Tyser23240d22009-09-21 12:04:32 -0500614 if [ -s ${LOG_DIR}/$target.ERR ] ; then
615 ERR_CNT=$((ERR_CNT + 1))
616 ERR_LIST="${ERR_LIST} $target"
617 else
618 rm ${LOG_DIR}/$target.ERR
619 fi
620
621 TOTAL_CNT=$((TOTAL_CNT + 1))
Marian Balakowiczd62379d2006-09-01 19:49:50 +0200622
Scott Woodf8b3e232012-02-20 12:56:25 +0000623 OBJS=${BUILD_DIR}/u-boot
624 if [ -e ${BUILD_DIR}/spl/u-boot-spl ]; then
625 OBJS="${OBJS} ${BUILD_DIR}/spl/u-boot-spl"
626 fi
627
628 ${CROSS_COMPILE}size ${OBJS} | tee -a ${LOG_DIR}/$target.MAKELOG
wdenk7ebf7442002-11-02 23:17:16 +0000629}
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400630build_targets() {
631 for t in "$@" ; do
632 # If a LIST_xxx var exists, use it. But avoid variable
633 # expansion in the eval when a board name contains certain
634 # characters that the shell interprets.
635 case ${t} in
636 *[-+=]*) list= ;;
637 *) list=$(eval echo '${LIST_'$t'}') ;;
638 esac
639 if [ -n "${list}" ] ; then
640 build_targets ${list}
641 else
642 build_target ${t}
643 fi
644 done
645}
wdenk7ebf7442002-11-02 23:17:16 +0000646
647#-----------------------------------------------------------------------
648
Peter Tyser23240d22009-09-21 12:04:32 -0500649print_stats() {
Marek Vasutcc3e1cb2011-12-02 21:32:03 +0000650 if [ "$ONLY_LIST" == 'y' ] ; then return ; fi
Peter Tyser23240d22009-09-21 12:04:32 -0500651 echo ""
652 echo "--------------------- SUMMARY ----------------------------"
653 echo "Boards compiled: ${TOTAL_CNT}"
654 if [ ${ERR_CNT} -gt 0 ] ; then
655 echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
656 fi
657 echo "----------------------------------------------------------"
Peter Tysera5a27b92009-12-06 23:58:28 -0600658
659 exit $RC
Peter Tyser23240d22009-09-21 12:04:32 -0500660}
wdenk7ebf7442002-11-02 23:17:16 +0000661
Peter Tyser23240d22009-09-21 12:04:32 -0500662#-----------------------------------------------------------------------
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400663
Wolfgang Denk7b74fec2010-10-17 12:26:48 +0200664# Build target groups selected by options, plus any command line args
665set -- ${SELECTED} "$@"
666# run PowerPC by default
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400667[ $# = 0 ] && set -- powerpc
Mike Frysingerb374bdb2010-08-19 13:05:06 -0400668build_targets "$@"