]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - MAKEALL
at91rm9200ek: add configure target for RAM boot
[karo-tx-uboot.git] / MAKEALL
1 #!/bin/bash
2
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 #
14 # With the introduction of the board.cfg file, it has become possible
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
54 SHORT_OPTS="a:c:v:s:"
55 LONG_OPTS="arch:,cpu:,vendor:,soc:"
56
57 # Option processing based on util-linux-2.13/getopt-parse.bash
58
59 # Note that we use `"$@"' to let each command-line parameter expand to a
60 # separate word. The quotes around `$@' are essential!
61 # We need TEMP as the `eval set --' would nuke the return value of
62 # getopt.
63 TEMP=`getopt -o ${SHORT_OPTS} --long ${LONG_OPTS} \
64      -n 'MAKEALL' -- "$@"`
65
66 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
67
68 # Note the quotes around `$TEMP': they are essential!
69 eval set -- "$TEMP"
70
71 SELECTED=''
72
73 while 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
116 done
117 # echo "Remaining arguments:"
118 # for arg do echo '--> '"\`$arg'" ; done
119
120 FILTER="\$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
126 if [ "$SELECTED" ] ; then
127         SELECTED=$(awk '('"$FILTER"') { print $1 }' boards.cfg)
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
134 fi
135
136 #########################################################################
137
138 # Print statistics when we exit
139 trap exit 1 2 3 15
140 trap print_stats 0
141
142 # Determine number of CPU cores if no default was set
143 : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
144
145 if [ "$BUILD_NCPUS" -gt 1 ]
146 then
147         JOBS="-j $((BUILD_NCPUS + 1))"
148 else
149         JOBS=""
150 fi
151
152
153 if [ "${CROSS_COMPILE}" ] ; then
154         MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
155 else
156         MAKE=make
157 fi
158
159 if [ "${MAKEALL_LOGDIR}" ] ; then
160         LOG_DIR=${MAKEALL_LOGDIR}
161 else
162         LOG_DIR="LOG"
163 fi
164
165 if [ ! "${BUILD_DIR}" ] ; then
166         BUILD_DIR="."
167 fi
168
169 [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
170
171 LIST=""
172
173 # Keep track of the number of builds and errors
174 ERR_CNT=0
175 ERR_LIST=""
176 TOTAL_CNT=0
177 RC=0
178
179 # Helper funcs for parsing boards.cfg
180 boards_by_field()
181 {
182         awk \
183                 -v field="$1" \
184                 -v select="$2" \
185                 '($1 !~ /^#/ && $field == select) { print $1 }' \
186                 boards.cfg
187 }
188 boards_by_arch() { boards_by_field 2 "$@" ; }
189 boards_by_cpu()  { boards_by_field 3 "$@" ; }
190
191 #########################################################################
192 ## MPC5xx Systems
193 #########################################################################
194
195 LIST_5xx="$(boards_by_cpu mpc5xx)"
196
197 #########################################################################
198 ## MPC5xxx Systems
199 #########################################################################
200
201 LIST_5xxx="$(boards_by_cpu mpc5xxx)"
202
203 #########################################################################
204 ## MPC512x Systems
205 #########################################################################
206
207 LIST_512x="$(boards_by_cpu mpc512x)"
208
209 #########################################################################
210 ## MPC8xx Systems
211 #########################################################################
212
213 LIST_8xx="$(boards_by_cpu mpc8xx)"
214
215 #########################################################################
216 ## PPC4xx Systems
217 #########################################################################
218
219 LIST_4xx="$(boards_by_cpu ppc4xx)"
220
221 #########################################################################
222 ## MPC8220 Systems
223 #########################################################################
224
225 LIST_8220="$(boards_by_cpu mpc8220)"
226
227 #########################################################################
228 ## MPC824x Systems
229 #########################################################################
230
231 LIST_824x="$(boards_by_cpu mpc824x)"
232
233 #########################################################################
234 ## MPC8260 Systems (includes 8250, 8255 etc.)
235 #########################################################################
236
237 LIST_8260="$(boards_by_cpu mpc8260)"
238
239 #########################################################################
240 ## MPC83xx Systems (includes 8349, etc.)
241 #########################################################################
242
243 LIST_83xx="$(boards_by_cpu mpc83xx)"
244
245 #########################################################################
246 ## MPC85xx Systems (includes 8540, 8560 etc.)
247 #########################################################################
248
249 LIST_85xx="$(boards_by_cpu mpc85xx)"
250
251 #########################################################################
252 ## MPC86xx Systems
253 #########################################################################
254
255 LIST_86xx="$(boards_by_cpu mpc86xx)"
256
257 #########################################################################
258 ## 74xx/7xx Systems
259 #########################################################################
260
261 LIST_74xx_7xx="$(boards_by_cpu 74xx_7xx)"
262
263 #########################################################################
264 ## PowerPC groups
265 #########################################################################
266
267 LIST_TSEC="             \
268         ${LIST_83xx}    \
269         ${LIST_85xx}    \
270         ${LIST_86xx}    \
271 "
272
273 LIST_powerpc="          \
274         ${LIST_5xx}     \
275         ${LIST_512x}    \
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}     \
285         ${LIST_74xx_7xx}\
286 "
287
288 # Alias "ppc" -> "powerpc" to not break compatibility with older scripts
289 # still using "ppc" instead of "powerpc"
290 LIST_ppc="              \
291         ${LIST_powerpc} \
292 "
293
294 #########################################################################
295 ## StrongARM Systems
296 #########################################################################
297
298 LIST_SA="$(boards_by_cpu sa1100)"
299
300 #########################################################################
301 ## ARM7 Systems
302 #########################################################################
303
304 LIST_ARM7="             \
305         ap7             \
306         ap720t          \
307         armadillo       \
308         B2              \
309         ep7312          \
310         evb4510         \
311         impa7           \
312         integratorap    \
313         lpc2292sodimm   \
314         modnet50        \
315         SMN42           \
316 "
317
318 #########################################################################
319 ## ARM9 Systems
320 #########################################################################
321
322 LIST_ARM9="                     \
323         a320evb                 \
324         ap920t                  \
325         ap922_XA10              \
326         ap926ejs                \
327         ap946es                 \
328         ap966                   \
329         cp920t                  \
330         cp922_XA10              \
331         cp926ejs                \
332         cp946es                 \
333         cp966                   \
334         da830evm                \
335         da850evm                \
336         edb9301                 \
337         edb9302                 \
338         edb9302a                \
339         edb9307                 \
340         edb9307a                \
341         edb9312                 \
342         edb9315                 \
343         edb9315a                \
344         edminiv2                \
345         guruplug                \
346         imx27lite               \
347         jadecpu                 \
348         lpd7a400                \
349         magnesium               \
350         mv88f6281gtw_ge         \
351         mx1ads                  \
352         mx1fs2                  \
353         netstar                 \
354         nhk8815                 \
355         nhk8815_onenand         \
356         omap1510inn             \
357         omap1610h2              \
358         omap1610inn             \
359         omap5912osk             \
360         omap730p2               \
361         openrd_base             \
362         rd6281a                 \
363         sbc2410x                \
364         scb9328                 \
365         sheevaplug              \
366         smdk2400                \
367         smdk2410                \
368         spear300                \
369         spear310                \
370         spear320                \
371         spear600                \
372         suen3                   \
373         trab                    \
374         VCMA9                   \
375         versatile               \
376         versatileab             \
377         versatilepb             \
378         voiceblue               \
379         davinci_dvevm           \
380         davinci_schmoogie       \
381         davinci_sffsdr          \
382         davinci_sonata          \
383         davinci_dm355evm        \
384         davinci_dm355leopard    \
385         davinci_dm365evm        \
386         davinci_dm6467evm       \
387 "
388
389 #########################################################################
390 ## ARM10 Systems
391 #########################################################################
392 LIST_ARM10="            \
393         integratorcp    \
394         cp1026          \
395 "
396
397 #########################################################################
398 ## ARM11 Systems
399 #########################################################################
400 LIST_ARM11="                    \
401         cp1136                  \
402         omap2420h4              \
403         apollon                 \
404         imx31_litekit           \
405         imx31_phycore           \
406         imx31_phycore_eet       \
407         mx31ads                 \
408         mx31pdk                 \
409         mx31pdk_nand            \
410         qong                    \
411         smdk6400                \
412         tnetv107x_evm           \
413 "
414
415 #########################################################################
416 ## ARMV7 Systems
417 #########################################################################
418 LIST_ARMV7="            \
419         am3517_evm              \
420         ca9x4_ct_vxp            \
421         devkit8000              \
422         igep0020                \
423         igep0030                \
424         mx51evk                 \
425         omap3_beagle            \
426         omap3_overo             \
427         omap3_evm               \
428         omap3_pandora           \
429         omap3_sdp3430           \
430         omap3_zoom1             \
431         omap3_zoom2             \
432         omap4_panda             \
433         omap4_sdp4430           \
434         s5p_goni                \
435         smdkc100                \
436 "
437
438 #########################################################################
439 ## AT91 Systems
440 #########################################################################
441
442 LIST_at91="                     \
443         afeb9260                \
444         at91cap9adk             \
445         at91rm9200dk            \
446         at91rm9200ek            \
447         at91sam9260ek           \
448         at91sam9261ek           \
449         at91sam9263ek           \
450         at91sam9g10ek           \
451         at91sam9g20ek           \
452         at91sam9m10g45ek        \
453         at91sam9rlek            \
454         cmc_pu2                 \
455         CPUAT91                 \
456         CPU9260                 \
457         CPU9G20                 \
458         csb637                  \
459         eb_cpux9k2              \
460         kb9202                  \
461         meesc                   \
462         mp2usb                  \
463         m501sk                  \
464         otc570                  \
465         pm9261                  \
466         pm9263                  \
467         pm9g45                  \
468         SBC35_A9G20             \
469         TNY_A9260               \
470         TNY_A9G20               \
471 "
472
473 #########################################################################
474 ## Xscale Systems
475 #########################################################################
476
477 LIST_pxa="$(boards_by_cpu pxa)"
478
479 LIST_ixp="$(boards_by_cpu ixp)
480         pdnb3           \
481         scpu            \
482 "
483
484 #########################################################################
485 ## ARM groups
486 #########################################################################
487
488 LIST_arm="                      \
489         ${LIST_SA}              \
490         ${LIST_ARM7}            \
491         ${LIST_ARM9}            \
492         ${LIST_ARM10}           \
493         ${LIST_ARM11}           \
494         ${LIST_ARMV7}   \
495         ${LIST_at91}            \
496         ${LIST_pxa}             \
497         ${LIST_ixp}             \
498 "
499
500 #########################################################################
501 ## MIPS Systems         (default = big endian)
502 #########################################################################
503
504 LIST_mips4kc="          \
505         incaip          \
506         qemu_mips       \
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       \
519 "
520
521 LIST_mips5kc="          \
522         purple          \
523 "
524
525 LIST_au1xx0="           \
526         dbau1000        \
527         dbau1100        \
528         dbau1500        \
529         dbau1550        \
530         dbau1550_el     \
531         gth2            \
532 "
533
534 LIST_mips="             \
535         ${LIST_mips4kc} \
536         ${LIST_mips5kc} \
537         ${LIST_au1xx0}  \
538 "
539
540 #########################################################################
541 ## MIPS Systems         (little endian)
542 #########################################################################
543
544 LIST_mips4kc_el=""
545
546 LIST_mips5kc_el=""
547
548 LIST_au1xx0_el="        \
549         dbau1550_el     \
550         pb1000          \
551 "
552
553 LIST_mips_el="                  \
554         ${LIST_mips4kc_el}      \
555         ${LIST_mips5kc_el}      \
556         ${LIST_au1xx0_el}       \
557 "
558
559 #########################################################################
560 ## i386 Systems
561 #########################################################################
562
563 LIST_x86="$(boards_by_arch i386)"
564
565 #########################################################################
566 ## Nios-II Systems
567 #########################################################################
568
569 LIST_nios2="$(boards_by_arch nios2)
570         nios2-generic   \
571 "
572
573 #########################################################################
574 ## MicroBlaze Systems
575 #########################################################################
576
577 LIST_microblaze="$(boards_by_arch microblaze)"
578
579 #########################################################################
580 ## ColdFire Systems
581 #########################################################################
582
583 LIST_coldfire="$(boards_by_arch m68k)
584         astro_mcf5373l          \
585         cobra5272               \
586         EB+MCF-EV123            \
587         EB+MCF-EV123_internal   \
588         M52277EVB               \
589         M5235EVB                \
590         M5329AFEE               \
591         M5373EVB                \
592         M54451EVB               \
593         M54455EVB               \
594         M5475AFE                \
595         M5485AFE                \
596 "
597
598 #########################################################################
599 ## AVR32 Systems
600 #########################################################################
601
602 LIST_avr32="$(boards_by_arch avr32)"
603
604 #########################################################################
605 ## Blackfin Systems
606 #########################################################################
607
608 LIST_blackfin="$(boards_by_arch blackfin)"
609
610 #########################################################################
611 ## SH Systems
612 #########################################################################
613
614 LIST_sh2="$(boards_by_cpu sh2)"
615 LIST_sh3="$(boards_by_cpu sh3)"
616 LIST_sh4="$(boards_by_cpu sh4)"
617
618 LIST_sh="$(boards_by_arch sh)"
619
620 #########################################################################
621 ## SPARC Systems
622 #########################################################################
623
624 LIST_sparc="$(boards_by_arch sparc)"
625
626 #-----------------------------------------------------------------------
627
628 build_target() {
629         target=$1
630
631         ${MAKE} distclean >/dev/null
632         ${MAKE} -s ${target}_config
633
634         ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
635                                 | tee ${LOG_DIR}/$target.ERR
636
637         # Check for 'make' errors
638         if [ ${PIPESTATUS[0]} -ne 0 ] ; then
639                 RC=1
640         fi
641
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))
650
651         ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
652                                 | tee -a ${LOG_DIR}/$target.MAKELOG
653 }
654 build_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 }
670
671 #-----------------------------------------------------------------------
672
673 print_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 "----------------------------------------------------------"
681
682         exit $RC
683 }
684
685 #-----------------------------------------------------------------------
686
687 # Build target groups selected by options, plus any command line args
688 set -- ${SELECTED} "$@"
689 # run PowerPC by default
690 [ $# = 0 ] && set -- powerpc
691 build_targets "$@"