]> git.ipfire.org Git - people/ms/u-boot.git/blame - MAKEALL
Merge branch 'master' of /home/wd/git/u-boot/custodians
[people/ms/u-boot.git] / MAKEALL
CommitLineData
f2352877 1#!/bin/bash
7ebf7443 2
0777eafb
WD
3# Tool mainly for U-Boot Quality Assurance: build one or more board
4# configurations with minimal verbosity, showing only warnings and
5# errors.
6#
7# There are several ways to select which boards to build.
8#
9# Traditionally, architecture names (like "powerpc"), CPU family names
10# (like "mpc83xx") or board names can be specified on the command
11# line; without any arguments, MAKEALL defaults to building all Power
12# Architecture systems (i. e. same as for "MAKEALL powerpc").
13#
cd57b0bb 14# With the introduction of the board.cfg file, it has become possible
0777eafb
WD
15# to provide additional selections. We use standard command line
16# options for this:
17#
18# -a or --arch : Select architecture
19# -c or --cpu : Select CPU family
20# -s or --soc : Select SoC type
21# -v or --vendor: Select board vendor
22#
23# Selections by these options are logically ANDed; if the same option
24# is used repeatedly, such selections are ORed. So "-v FOO -v BAR"
25# will select all configurations where the vendor is either FOO or
26# BAR. Any additional arguments specified on the command line are
27# always build additionally.
28#
29# Examples:
30#
31# - build all Power Architecture boards:
32#
33# MAKEALL -a powerpc
34# or
35# MAKEALL --arch powerpc
36# or
37# MAKEALL powerpc
38#
39# - build all PowerPC boards manufactured by vendor "esd":
40#
41# MAKEALL -a powerpc -v esd
42#
43# - build all PowerPC boards manufactured either by "keymile" or
44# "siemens":
45#
46# MAKEALL -a powerpc -v keymile -v siemens
47#
48# - build all Freescale boards with MPC83xx CPUs, plus all 4xx boards:
49#
50# MAKEALL -c mpc83xx -v freescale 4xx
51#
52#########################################################################
53
54SHORT_OPTS="a:c:v:s:"
55LONG_OPTS="arch:,cpu:,vendor:,soc:"
56
57# Option processing based on util-linux-2.13/getopt-parse.bash
58
071bc923 59# Note that we use `"$@"' to let each command-line parameter expand to a
0777eafb
WD
60# separate word. The quotes around `$@' are essential!
61# We need TEMP as the `eval set --' would nuke the return value of
62# getopt.
63TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \
64 -n 'MAKEALL' -- "$@"`
65
66if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
67
68# Note the quotes around `$TEMP': they are essential!
69eval set -- "$TEMP"
70
71SELECTED=''
72
73while true ; do
74 case "$1" in
75 -a|--arch)
76 # echo "Option ARCH: argument \`$2'"
77 if [ "$opt_a" ] ; then
78 opt_a="${opt_a%)} || \$2 == \"$2\")"
79 else
80 opt_a="(\$2 == \"$2\")"
81 fi
82 SELECTED='y'
83 shift 2 ;;
84 -c|--cpu)
85 # echo "Option CPU: argument \`$2'"
86 if [ "$opt_c" ] ; then
87 opt_c="${opt_c%)} || \$3 == \"$2\")"
88 else
89 opt_c="(\$3 == \"$2\")"
90 fi
91 SELECTED='y'
92 shift 2 ;;
93 -s|--soc)
94 # echo "Option SoC: argument \`$2'"
95 if [ "$opt_s" ] ; then
96 opt_s="${opt_s%)} || \$6 == \"$2\")"
97 else
98 opt_s="(\$6 == \"$2\")"
99 fi
100 SELECTED='y'
101 shift 2 ;;
102 -v|--vendor)
103 # echo "Option VENDOR: argument \`$2'"
104 if [ "$opt_v" ] ; then
105 opt_v="${opt_v%)} || \$5 == \"$2\")"
106 else
107 opt_v="(\$5 == \"$2\")"
108 fi
109 SELECTED='y'
110 shift 2 ;;
111 --)
112 shift ; break ;;
113 *)
114 echo "Internal error!" >&2 ; exit 1 ;;
115 esac
116done
117# echo "Remaining arguments:"
118# for arg do echo '--> '"\`$arg'" ; done
119
120FILTER="\$1 !~ /^#/"
121[ "$opt_a" ] && FILTER="${FILTER} && $opt_a"
122[ "$opt_c" ] && FILTER="${FILTER} && $opt_c"
123[ "$opt_s" ] && FILTER="${FILTER} && $opt_s"
124[ "$opt_v" ] && FILTER="${FILTER} && $opt_v"
125
126if [ "$SELECTED" ] ; then
127 SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
cd57b0bb
PT
128
129 # Make sure some boards from boards.cfg are actually found
130 if [ -z "$SELECTED" ] ; then
131 echo "Error: No boards selected, invalid arguments"
132 exit 1
133 fi
0777eafb
WD
134fi
135
136#########################################################################
137
40a28f08
PT
138# Print statistics when we exit
139trap exit 1 2 3 15
140trap print_stats 0
141
7fa6a2f3
WD
142# Determine number of CPU cores if no default was set
143: ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
144
145if [ "$BUILD_NCPUS" -gt 1 ]
146then
55f786d8 147 JOBS="-j $((BUILD_NCPUS + 1))"
7fa6a2f3
WD
148else
149 JOBS=""
150fi
151
a8c7c708 152
7ebf7443
WD
153if [ "${CROSS_COMPILE}" ] ; then
154 MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
155else
156 MAKE=make
157fi
158
f9328639
MB
159if [ "${MAKEALL_LOGDIR}" ] ; then
160 LOG_DIR=${MAKEALL_LOGDIR}
161else
162 LOG_DIR="LOG"
163fi
887e2ec9 164
f9328639
MB
165if [ ! "${BUILD_DIR}" ] ; then
166 BUILD_DIR="."
167fi
168
4f0645eb 169[ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
7ebf7443
WD
170
171LIST=""
172
40a28f08
PT
173# Keep track of the number of builds and errors
174ERR_CNT=0
175ERR_LIST=""
176TOTAL_CNT=0
f2352877 177RC=0
40a28f08 178
9ec49f8f
MF
179# Helper funcs for parsing boards.cfg
180boards_by_field()
181{
182 awk \
183 -v field="$1" \
184 -v select="$2" \
185 '($1 !~ /^#/ && $field == select) { print $1 }' \
186 boards.cfg
187}
188boards_by_arch() { boards_by_field 2 "$@" ; }
189boards_by_cpu() { boards_by_field 3 "$@" ; }
190
0db5bca8
WD
191#########################################################################
192## MPC5xx Systems
193#########################################################################
194
9ec49f8f 195LIST_5xx="$(boards_by_cpu mpc5xx)"
0db5bca8 196
945af8d7
WD
197#########################################################################
198## MPC5xxx Systems
199#########################################################################
200
2ae18241 201LIST_5xxx="$(boards_by_cpu mpc5xxx)"
945af8d7 202
8993e54b
RJ
203#########################################################################
204## MPC512x Systems
205#########################################################################
206
2ae18241 207LIST_512x="$(boards_by_cpu mpc512x)"
945af8d7 208
7ebf7443
WD
209#########################################################################
210## MPC8xx Systems
211#########################################################################
9ec49f8f 212
2ae18241 213LIST_8xx="$(boards_by_cpu mpc8xx)"
7ebf7443
WD
214
215#########################################################################
216## PPC4xx Systems
217#########################################################################
218
2ae18241 219LIST_4xx="$(boards_by_cpu ppc4xx)"
7ebf7443 220
983fda83
WD
221#########################################################################
222## MPC8220 Systems
223#########################################################################
224
9ec49f8f 225LIST_8220="$(boards_by_cpu mpc8220)"
983fda83 226
7ebf7443
WD
227#########################################################################
228## MPC824x Systems
229#########################################################################
230
2ae18241 231LIST_824x="$(boards_by_cpu mpc824x)"
592c5cab 232
7ebf7443 233#########################################################################
7aa78614 234## MPC8260 Systems (includes 8250, 8255 etc.)
7ebf7443
WD
235#########################################################################
236
2ae18241 237LIST_8260="$(boards_by_cpu mpc8260)"
7ebf7443 238
f046ccd1
EL
239#########################################################################
240## MPC83xx Systems (includes 8349, etc.)
241#########################################################################
242
2ae18241 243LIST_83xx="$(boards_by_cpu mpc83xx)"
f046ccd1 244
42d1f039
WD
245#########################################################################
246## MPC85xx Systems (includes 8540, 8560 etc.)
247#########################################################################
248
2ae18241 249LIST_85xx="$(boards_by_cpu mpc85xx)"
42d1f039 250
822d5536
JL
251#########################################################################
252## MPC86xx Systems
253#########################################################################
254
2ae18241 255LIST_86xx="$(boards_by_cpu mpc86xx)"
822d5536 256
7ebf7443
WD
257#########################################################################
258## 74xx/7xx Systems
259#########################################################################
260
2ae18241 261LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
7ebf7443 262
d9a42c0a
WD
263#########################################################################
264## PowerPC groups
265#########################################################################
266
267LIST_TSEC=" \
268 ${LIST_83xx} \
269 ${LIST_85xx} \
270 ${LIST_86xx} \
271"
272
a47a12be 273LIST_powerpc=" \
fb56579f 274 ${LIST_5xx} \
3deca9d4 275 ${LIST_512x} \
fb56579f
KP
276 ${LIST_5xxx} \
277 ${LIST_8xx} \
278 ${LIST_8220} \
279 ${LIST_824x} \
280 ${LIST_8260} \
281 ${LIST_83xx} \
282 ${LIST_85xx} \
283 ${LIST_86xx} \
284 ${LIST_4xx} \
2ae18241 285 ${LIST_74xx_7xx}\
fb56579f 286"
7ebf7443 287
a47a12be
SR
288# Alias "ppc" -> "powerpc" to not break compatibility with older scripts
289# still using "ppc" instead of "powerpc"
290LIST_ppc=" \
291 ${LIST_powerpc} \
292"
293
7ebf7443
WD
294#########################################################################
295## StrongARM Systems
296#########################################################################
297
9ec49f8f 298LIST_SA="$(boards_by_cpu sa1100)"
7ebf7443
WD
299
300#########################################################################
301## ARM7 Systems
302#########################################################################
303
fb56579f
KP
304LIST_ARM7=" \
305 ap7 \
306 ap720t \
307 armadillo \
308 B2 \
309 ep7312 \
310 evb4510 \
311 impa7 \
312 integratorap \
313 lpc2292sodimm \
314 modnet50 \
315 SMN42 \
74f4304e 316"
7ebf7443
WD
317
318#########################################################################
319## ARM9 Systems
320#########################################################################
321
fb56579f 322LIST_ARM9=" \
43a5f0df 323 a320evb \
fb56579f
KP
324 ap920t \
325 ap922_XA10 \
326 ap926ejs \
327 ap946es \
328 ap966 \
329 cp920t \
330 cp922_XA10 \
331 cp926ejs \
332 cp946es \
333 cp966 \
2819e136 334 da830evm \
89b765c7 335 da850evm \
cf3c142e
MK
336 edb9301 \
337 edb9302 \
338 edb9302a \
339 edb9307 \
340 edb9307a \
341 edb9312 \
342 edb9315 \
343 edb9315a \
ce9c227c 344 edminiv2 \
16b76705 345 guruplug \
10bc241d 346 imx27lite \
18a056a1 347 jadecpu \
fb56579f 348 lpd7a400 \
bbe31092 349 magnesium \
4abc5bff 350 mv88f6281gtw_ge \
fb56579f
KP
351 mx1ads \
352 mx1fs2 \
353 netstar \
ceb70b46
JCPV
354 nhk8815 \
355 nhk8815_onenand \
fb56579f
KP
356 omap1510inn \
357 omap1610h2 \
358 omap1610inn \
a3543d6d 359 omap5912osk \
fb56579f 360 omap730p2 \
e92daeb5 361 openrd_base \
fbc8365a 362 rd6281a \
fb56579f
KP
363 sbc2410x \
364 scb9328 \
55dd4ba5 365 sheevaplug \
fb56579f
KP
366 smdk2400 \
367 smdk2410 \
7e074158 368 spear300 \
080cfee7 369 spear310 \
7da69236 370 spear320 \
566c9c16 371 spear600 \
67fa8c25 372 suen3 \
fb56579f
KP
373 trab \
374 VCMA9 \
375 versatile \
376 versatileab \
377 versatilepb \
378 voiceblue \
379 davinci_dvevm \
380 davinci_schmoogie \
c7f879ec 381 davinci_sffsdr \
fb56579f 382 davinci_sonata \
28b00324 383 davinci_dm355evm \
5df65cf5 384 davinci_dm355leopard \
3fca2929 385 davinci_dm365evm \
6ab176d7 386 davinci_dm6467evm \
6f21347d 387"
7ebf7443 388
74f4304e
WD
389#########################################################################
390## ARM10 Systems
391#########################################################################
fb56579f
KP
392LIST_ARM10=" \
393 integratorcp \
394 cp1026 \
74f4304e
WD
395"
396
8ed96046
WD
397#########################################################################
398## ARM11 Systems
399#########################################################################
0c692673
GL
400LIST_ARM11=" \
401 cp1136 \
402 omap2420h4 \
403 apollon \
404 imx31_litekit \
405 imx31_phycore \
406 imx31_phycore_eet \
407 mx31ads \
8449f287 408 mx31pdk \
d08e5ca3 409 mx31pdk_nand \
0c692673
GL
410 qong \
411 smdk6400 \
5cc48f7e 412 tnetv107x_evm \
74f4304e 413"
8ed96046 414
f904cdbb 415#########################################################################
f56348af 416## ARMV7 Systems
f904cdbb 417#########################################################################
f56348af 418LIST_ARMV7=" \
ed01e45c 419 am3517_evm \
b80e41ac 420 ca9x4_ct_vxp \
c35d7cf0 421 devkit8000 \
8a3f6bb6 422 igep0020 \
1a832dc4 423 igep0030 \
c5fb70c9 424 mx51evk \
f904cdbb 425 omap3_beagle \
9d0fc811 426 omap3_overo \
ad9bc8e5 427 omap3_evm \
2be2c6cc 428 omap3_pandora \
e63e5904 429 omap3_sdp3430 \
7379f45a 430 omap3_zoom1 \
376aee78 431 omap3_zoom2 \
c57cca25 432 omap4_panda \
3e76d62a 433 omap4_sdp4430 \
c474a8eb 434 s5p_goni \
8bc4ee9e 435 smdkc100 \
f904cdbb
DB
436"
437
602cac13
JCPV
438#########################################################################
439## AT91 Systems
440#########################################################################
441
22ee6473
SG
442LIST_at91=" \
443 afeb9260 \
444 at91cap9adk \
445 at91rm9200dk \
446 at91rm9200ek \
447 at91sam9260ek \
448 at91sam9261ek \
449 at91sam9263ek \
d8380c9d 450 at91sam9g10ek \
22ee6473 451 at91sam9g20ek \
5ccc2d99 452 at91sam9m10g45ek \
22ee6473
SG
453 at91sam9rlek \
454 cmc_pu2 \
d8380c9d 455 CPUAT91 \
23b80982
TR
456 CPU9260 \
457 CPU9G20 \
22ee6473 458 csb637 \
77e7273c 459 eb_cpux9k2 \
22ee6473
SG
460 kb9202 \
461 meesc \
462 mp2usb \
463 m501sk \
44d80256 464 otc570 \
22ee6473
SG
465 pm9261 \
466 pm9263 \
b5d289fc 467 pm9g45 \
2dc851e3
AT
468 SBC35_A9G20 \
469 TNY_A9260 \
470 TNY_A9G20 \
602cac13
JCPV
471"
472
7ebf7443
WD
473#########################################################################
474## Xscale Systems
475#########################################################################
476
7c957c0e 477LIST_pxa="$(boards_by_cpu pxa)"
7ebf7443 478
9ec49f8f 479LIST_ixp="$(boards_by_cpu ixp)
fb56579f
KP
480 pdnb3 \
481 scpu \
482"
7ebf7443 483
d9a42c0a
WD
484#########################################################################
485## ARM groups
486#########################################################################
2d5b561e 487
f904cdbb
DB
488LIST_arm=" \
489 ${LIST_SA} \
490 ${LIST_ARM7} \
491 ${LIST_ARM9} \
492 ${LIST_ARM10} \
493 ${LIST_ARM11} \
f56348af 494 ${LIST_ARMV7} \
f904cdbb
DB
495 ${LIST_at91} \
496 ${LIST_pxa} \
497 ${LIST_ixp} \
8ed96046 498"
7ebf7443 499
c021880a 500#########################################################################
b62bdffb 501## MIPS Systems (default = big endian)
c021880a
WD
502#########################################################################
503
fb56579f
KP
504LIST_mips4kc=" \
505 incaip \
0764c164 506 qemu_mips \
2a61eff6
SR
507 vct_platinum \
508 vct_platinum_small \
509 vct_platinum_onenand \
510 vct_platinum_onenand_small \
511 vct_platinumavc \
512 vct_platinumavc_small \
513 vct_platinumavc_onenand \
514 vct_platinumavc_onenand_small \
515 vct_premium \
516 vct_premium_small \
517 vct_premium_onenand \
518 vct_premium_onenand_small \
fb56579f 519"
c021880a 520
fb56579f
KP
521LIST_mips5kc=" \
522 purple \
523"
3e38691e 524
fb56579f
KP
525LIST_au1xx0=" \
526 dbau1000 \
527 dbau1100 \
528 dbau1500 \
529 dbau1550 \
530 dbau1550_el \
531 gth2 \
532"
5da627a4 533
fb56579f
KP
534LIST_mips=" \
535 ${LIST_mips4kc} \
536 ${LIST_mips5kc} \
537 ${LIST_au1xx0} \
538"
c021880a 539
b62bdffb
WD
540#########################################################################
541## MIPS Systems (little endian)
542#########################################################################
543
544LIST_mips4kc_el=""
545
546LIST_mips5kc_el=""
547
fb56579f
KP
548LIST_au1xx0_el=" \
549 dbau1550_el \
b09258c5 550 pb1000 \
fb56579f 551"
b62bdffb 552
fb56579f
KP
553LIST_mips_el=" \
554 ${LIST_mips4kc_el} \
555 ${LIST_mips5kc_el} \
556 ${LIST_au1xx0_el} \
557"
b62bdffb 558
7a8e9bed
WD
559#########################################################################
560## i386 Systems
561#########################################################################
562
6d79c399 563LIST_x86="$(boards_by_arch i386)"
7a8e9bed 564
5c952cf0
WD
565#########################################################################
566## Nios-II Systems
567#########################################################################
568
9ec49f8f 569LIST_nios2="$(boards_by_arch nios2)
8cbb0ddd 570 nios2-generic \
4176c799 571"
5c952cf0 572
857cad37
WD
573#########################################################################
574## MicroBlaze Systems
575#########################################################################
576
9ec49f8f 577LIST_microblaze="$(boards_by_arch microblaze)"
857cad37 578
f8c3b4f3
ZL
579#########################################################################
580## ColdFire Systems
581#########################################################################
582
9ec49f8f 583LIST_coldfire="$(boards_by_arch m68k)
9d79e575 584 astro_mcf5373l \
fb56579f
KP
585 cobra5272 \
586 EB+MCF-EV123 \
587 EB+MCF-EV123_internal \
1552af70 588 M52277EVB \
4a442d31 589 M5235EVB \
aa5f1f9d
TL
590 M5329AFEE \
591 M5373EVB \
05316f8e 592 M54451EVB \
8ae158cd 593 M54455EVB \
57a12720
TL
594 M5475AFE \
595 M5485AFE \
9acb626f 596"
f8c3b4f3 597
6ccec449
WD
598#########################################################################
599## AVR32 Systems
600#########################################################################
601
9ec49f8f 602LIST_avr32="$(boards_by_arch avr32)"
6ccec449 603
ef26a08f
AL
604#########################################################################
605## Blackfin Systems
606#########################################################################
607
36cf8cb4 608LIST_blackfin="$(boards_by_arch blackfin)"
ef26a08f 609
c7144373
JCPV
610#########################################################################
611## SH Systems
612#########################################################################
613
e0f0e527 614LIST_sh2="$(boards_by_cpu sh2)"
3771c69d 615LIST_sh3="$(boards_by_cpu sh3)"
03626be3 616LIST_sh4="$(boards_by_cpu sh4)"
d9a42c0a 617
03626be3 618LIST_sh="$(boards_by_arch sh)"
c7144373 619
c2f02da2
DH
620#########################################################################
621## SPARC Systems
622#########################################################################
623
9ec49f8f 624LIST_sparc="$(boards_by_arch sparc)"
7ebf7443
WD
625
626#-----------------------------------------------------------------------
627
628build_target() {
629 target=$1
630
631 ${MAKE} distclean >/dev/null
d70d8ccc 632 ${MAKE} -s ${target}_config
f9328639
MB
633
634 ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
635 | tee ${LOG_DIR}/$target.ERR
f2352877
PT
636
637 # Check for 'make' errors
638 if [ ${PIPESTATUS[0]} -ne 0 ] ; then
639 RC=1
640 fi
641
40a28f08
PT
642 if [ -s ${LOG_DIR}/$target.ERR ] ; then
643 ERR_CNT=$((ERR_CNT + 1))
644 ERR_LIST="${ERR_LIST} $target"
645 else
646 rm ${LOG_DIR}/$target.ERR
647 fi
648
649 TOTAL_CNT=$((TOTAL_CNT + 1))
f9328639 650
208447f8 651 ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
f9328639 652 | tee -a ${LOG_DIR}/$target.MAKELOG
7ebf7443 653}
9ec49f8f
MF
654build_targets() {
655 for t in "$@" ; do
656 # If a LIST_xxx var exists, use it. But avoid variable
657 # expansion in the eval when a board name contains certain
658 # characters that the shell interprets.
659 case ${t} in
660 *[-+=]*) list= ;;
661 *) list=$(eval echo '${LIST_'$t'}') ;;
662 esac
663 if [ -n "${list}" ] ; then
664 build_targets ${list}
665 else
666 build_target ${t}
667 fi
668 done
669}
7ebf7443
WD
670
671#-----------------------------------------------------------------------
672
40a28f08
PT
673print_stats() {
674 echo ""
675 echo "--------------------- SUMMARY ----------------------------"
676 echo "Boards compiled: ${TOTAL_CNT}"
677 if [ ${ERR_CNT} -gt 0 ] ; then
678 echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
679 fi
680 echo "----------------------------------------------------------"
f2352877
PT
681
682 exit $RC
40a28f08 683}
7ebf7443 684
40a28f08 685#-----------------------------------------------------------------------
9ec49f8f 686
0777eafb
WD
687# Build target groups selected by options, plus any command line args
688set -- ${SELECTED} "$@"
689# run PowerPC by default
9ec49f8f 690[ $# = 0 ] && set -- powerpc
9ec49f8f 691build_targets "$@"