Merge branch 'master' of party:/pub/git/u-boot-s5pc1xx
[kernel/u-boot.git] / MAKEALL
1 #!/bin/bash
2
3 # Print statistics when we exit
4 trap exit 1 2 3 15
5 trap print_stats 0
6
7 # Determine number of CPU cores if no default was set
8 : ${BUILD_NCPUS:="`getconf _NPROCESSORS_ONLN`"}
9
10 if [ "$BUILD_NCPUS" -gt 1 ]
11 then
12         JOBS="-j $((BUILD_NCPUS + 1))"
13 else
14         JOBS=""
15 fi
16
17
18 if [ "${CROSS_COMPILE}" ] ; then
19         MAKE="make CROSS_COMPILE=${CROSS_COMPILE}"
20 else
21         MAKE=make
22 fi
23
24 if [ "${MAKEALL_LOGDIR}" ] ; then
25         LOG_DIR=${MAKEALL_LOGDIR}
26 else
27         LOG_DIR="LOG"
28 fi
29
30 if [ ! "${BUILD_DIR}" ] ; then
31         BUILD_DIR="."
32 fi
33
34 [ -d ${LOG_DIR} ] || mkdir ${LOG_DIR} || exit 1
35
36 LIST=""
37
38 # Keep track of the number of builds and errors
39 ERR_CNT=0
40 ERR_LIST=""
41 TOTAL_CNT=0
42 RC=0
43
44 # Helper funcs for parsing boards.cfg
45 boards_by_field()
46 {
47         awk \
48                 -v field="$1" \
49                 -v select="$2" \
50                 '($1 !~ /^#/ && $field == select) { print $1 }' \
51                 boards.cfg
52 }
53 boards_by_arch() { boards_by_field 2 "$@" ; }
54 boards_by_cpu()  { boards_by_field 3 "$@" ; }
55
56 #########################################################################
57 ## MPC5xx Systems
58 #########################################################################
59
60 LIST_5xx="$(boards_by_cpu mpc5xx)"
61
62 #########################################################################
63 ## MPC5xxx Systems
64 #########################################################################
65
66 LIST_5xxx="$(boards_by_cpu mpc5xxx)
67         digsy_mtc       \
68         EVAL5200        \
69         fo300           \
70         galaxy5200      \
71         icecube_5200    \
72         lite5200b       \
73         mcc200          \
74         MVBC_P          \
75         MVSMR           \
76         pcm030          \
77         PM520           \
78         TB5200          \
79         Total5200       \
80         Total5200_Rev2  \
81         TQM5200         \
82         TQM5200_B       \
83         TQM5200S        \
84 "
85
86 #########################################################################
87 ## MPC512x Systems
88 #########################################################################
89
90 LIST_512x="$(boards_by_cpu mpc512x)
91         mpc5121ads      \
92 "
93
94 #########################################################################
95 ## MPC8xx Systems
96 #########################################################################
97
98 LIST_8xx="$(boards_by_cpu mpc8xx)
99         Adder87x        \
100         AdderII         \
101         ADS860          \
102         FADS823         \
103         FADS850SAR      \
104         FADS860T        \
105         FPS850L         \
106         GEN860T         \
107         GEN860T_SC      \
108         ICU862_100MHz   \
109         IVML24          \
110         IVML24_128      \
111         IVML24_256      \
112         IVMS8           \
113         IVMS8_128       \
114         IVMS8_256       \
115         MBX             \
116         MBX860T         \
117         MPC86xADS       \
118         MPC885ADS       \
119         NETPHONE        \
120         NETTA           \
121         NETTA2          \
122         NETTA_ISDN      \
123         NETVIA          \
124         NETVIA_V2       \
125         RPXlite_DW      \
126         SPD823TS        \
127         SXNI855T        \
128         TK885D          \
129         TQM823L         \
130         TQM823L_LCD     \
131         TQM850L         \
132         TQM855L         \
133         TQM860L         \
134         TQM885D         \
135         v37             \
136 "
137
138 #########################################################################
139 ## PPC4xx Systems
140 #########################################################################
141
142 LIST_4xx="$(boards_by_cpu ppc4xx)
143         acadia_nand     \
144         arches          \
145         bamboo_nand     \
146         canyonlands     \
147         canyonlands_nand \
148         CPCI405         \
149         CPCI4052        \
150         CPCI405AB       \
151         CPCI405DT       \
152         devconcenter    \
153         fx12mm          \
154         glacier         \
155         haleakala       \
156         haleakala_nand  \
157         hcu4            \
158         hcu5            \
159         intip           \
160         kilauea         \
161         kilauea_nand    \
162         mcu25           \
163         MIP405T         \
164         ml507           \
165         ml507_flash     \
166         OCRTC           \
167         ORSG            \
168         PPChameleonEVB  \
169         rainier         \
170         sequoia         \
171         sequoia_nand    \
172         v5fx30teval     \
173         v5fx30teval_flash \
174         W7OLMC          \
175         W7OLMG          \
176         walnut          \
177         xilinx-ppc440-generic \
178         xilinx-ppc440-generic_flash \
179         yellowstone     \
180         yosemite        \
181 "
182
183 #########################################################################
184 ## MPC8220 Systems
185 #########################################################################
186
187 LIST_8220="$(boards_by_cpu mpc8220)"
188
189 #########################################################################
190 ## MPC824x Systems
191 #########################################################################
192
193 LIST_824x="$(boards_by_cpu mpc824x)
194         CPC45           \
195         eXalion         \
196         IDS8247         \
197         linkstation_HGLAN       \
198         Sandpoint8240   \
199         Sandpoint8245   \
200 "
201
202 #########################################################################
203 ## MPC8260 Systems (includes 8250, 8255 etc.)
204 #########################################################################
205
206 LIST_8260="$(boards_by_cpu mpc8260)
207         cogent_mpc8260  \
208         CPU86           \
209         CPU87           \
210         ep8248          \
211         ISPAN           \
212         MPC8260ADS      \
213         MPC8272ADS      \
214         PM826           \
215         PM828           \
216         Rattler8248     \
217         TQM8260_AC      \
218         TQM8260_AD      \
219         TQM8260_AE      \
220 "
221
222 #########################################################################
223 ## MPC83xx Systems (includes 8349, etc.)
224 #########################################################################
225
226 LIST_83xx="$(boards_by_cpu mpc83xx)
227         caddy2          \
228         MPC8313ERDB_33  \
229         MPC8313ERDB_NAND_66     \
230         MPC8315ERDB     \
231         MPC8315ERDB_NAND        \
232         MPC832XEMDS     \
233         MPC832XEMDS_ATM \
234         MPC8349ITX      \
235         MPC8349ITXGP    \
236         MPC8360EMDS     \
237         MPC8360EMDS_ATM \
238         MPC8360ERDK_33  \
239         MPC8360ERDK_66  \
240         MPC837XEMDS     \
241         sbc8349         \
242         SIMPC8313_LP    \
243         vme8349         \
244 "
245
246
247 #########################################################################
248 ## MPC85xx Systems (includes 8540, 8560 etc.)
249 #########################################################################
250
251 LIST_85xx="$(boards_by_cpu mpc85xx)
252         MPC8536DS       \
253         MPC8536DS_NAND  \
254         MPC8536DS_SDCARD        \
255         MPC8536DS_SPIFLASH      \
256         MPC8536DS_36BIT \
257         MPC8540EVAL     \
258         MPC8541CDS      \
259         MPC8548CDS      \
260         MPC8555CDS      \
261         MPC8569MDS      \
262         MPC8569MDS_ATM  \
263         MPC8569MDS_NAND \
264         MPC8572DS       \
265         MPC8572DS_36BIT \
266         P2020DS         \
267         P2020DS_36BIT   \
268         P1011RDB        \
269         P1011RDB_NAND   \
270         P1011RDB_SDCARD \
271         P1011RDB_SPIFLASH       \
272         P1020RDB        \
273         P1020RDB_NAND   \
274         P1020RDB_SDCARD \
275         P1020RDB_SPIFLASH       \
276         P2010RDB        \
277         P2010RDB_NAND   \
278         P2010RDB_SDCARD \
279         P2010RDB_SPIFLASH       \
280         P2020RDB        \
281         P2020RDB_NAND   \
282         P2020RDB_SDCARD \
283         P2020RDB_SPIFLASH       \
284         sbc8540         \
285         sbc8548         \
286         sbc8548_PCI_33  \
287         sbc8548_PCI_66  \
288         sbc8548_PCI_33_PCIE \
289         sbc8548_PCI_66_PCIE \
290         sbc8560         \
291         stxssa          \
292         TQM8540         \
293         TQM8541         \
294         TQM8548         \
295         TQM8548_AG      \
296         TQM8548_BE      \
297         TQM8555         \
298         TQM8560         \
299 "
300
301 #########################################################################
302 ## MPC86xx Systems
303 #########################################################################
304
305 LIST_86xx="$(boards_by_cpu mpc86xx)
306         MPC8641HPCN_36BIT \
307         MPC8641HPCN     \
308 "
309
310 #########################################################################
311 ## 74xx/7xx Systems
312 #########################################################################
313
314 LIST_74xx="             \
315         DB64360         \
316         DB64460         \
317         EVB64260        \
318         mpc7448hpc2     \
319         P3G4            \
320         p3m7448         \
321         PCIPPC2         \
322         PCIPPC6         \
323         ZUMA            \
324 "
325
326 LIST_7xx="              \
327         BAB7xx          \
328         CPCI750         \
329         ELPPC           \
330         p3m750          \
331         ppmc7xx         \
332 "
333
334 #########################################################################
335 ## PowerPC groups
336 #########################################################################
337
338 LIST_TSEC="             \
339         ${LIST_83xx}    \
340         ${LIST_85xx}    \
341         ${LIST_86xx}    \
342 "
343
344 LIST_powerpc="          \
345         ${LIST_5xx}     \
346         ${LIST_512x}    \
347         ${LIST_5xxx}    \
348         ${LIST_8xx}     \
349         ${LIST_8220}    \
350         ${LIST_824x}    \
351         ${LIST_8260}    \
352         ${LIST_83xx}    \
353         ${LIST_85xx}    \
354         ${LIST_86xx}    \
355         ${LIST_4xx}     \
356         ${LIST_74xx}    \
357         ${LIST_7xx}     \
358 "
359
360 # Alias "ppc" -> "powerpc" to not break compatibility with older scripts
361 # still using "ppc" instead of "powerpc"
362 LIST_ppc="              \
363         ${LIST_powerpc} \
364 "
365
366 #########################################################################
367 ## StrongARM Systems
368 #########################################################################
369
370 LIST_SA="$(boards_by_cpu sa1100)"
371
372 #########################################################################
373 ## ARM7 Systems
374 #########################################################################
375
376 LIST_ARM7="             \
377         ap7             \
378         ap720t          \
379         armadillo       \
380         B2              \
381         ep7312          \
382         evb4510         \
383         impa7           \
384         integratorap    \
385         lpc2292sodimm   \
386         modnet50        \
387         SMN42           \
388 "
389
390 #########################################################################
391 ## ARM9 Systems
392 #########################################################################
393
394 LIST_ARM9="                     \
395         a320evb                 \
396         ap920t                  \
397         ap922_XA10              \
398         ap926ejs                \
399         ap946es                 \
400         ap966                   \
401         cp920t                  \
402         cp922_XA10              \
403         cp926ejs                \
404         cp946es                 \
405         cp966                   \
406         da830evm                \
407         da850evm                \
408         edb9301                 \
409         edb9302                 \
410         edb9302a                \
411         edb9307                 \
412         edb9307a                \
413         edb9312                 \
414         edb9315                 \
415         edb9315a                \
416         edminiv2                \
417         guruplug                \
418         imx27lite               \
419         jadecpu                 \
420         lpd7a400                \
421         magnesium               \
422         mv88f6281gtw_ge         \
423         mx1ads                  \
424         mx1fs2                  \
425         netstar                 \
426         nhk8815                 \
427         nhk8815_onenand         \
428         omap1510inn             \
429         omap1610h2              \
430         omap1610inn             \
431         omap5912osk             \
432         omap730p2               \
433         openrd_base             \
434         rd6281a                 \
435         sbc2410x                \
436         scb9328                 \
437         sheevaplug              \
438         smdk2400                \
439         smdk2410                \
440         spear300                \
441         spear310                \
442         spear320                \
443         spear600                \
444         suen3                   \
445         trab                    \
446         VCMA9                   \
447         versatile               \
448         versatileab             \
449         versatilepb             \
450         voiceblue               \
451         davinci_dvevm           \
452         davinci_schmoogie       \
453         davinci_sffsdr          \
454         davinci_sonata          \
455         davinci_dm355evm        \
456         davinci_dm355leopard    \
457         davinci_dm365evm        \
458         davinci_dm6467evm       \
459 "
460
461 #########################################################################
462 ## ARM10 Systems
463 #########################################################################
464 LIST_ARM10="            \
465         integratorcp    \
466         cp1026          \
467 "
468
469 #########################################################################
470 ## ARM11 Systems
471 #########################################################################
472 LIST_ARM11="                    \
473         cp1136                  \
474         omap2420h4              \
475         apollon                 \
476         imx31_litekit           \
477         imx31_phycore           \
478         imx31_phycore_eet       \
479         mx31ads                 \
480         mx31pdk                 \
481         mx31pdk_nand            \
482         qong                    \
483         smdk6400                \
484         tnetv107x_evm           \
485 "
486
487 #########################################################################
488 ## ARMV7 Systems
489 #########################################################################
490 LIST_ARMV7="            \
491         am3517_evm              \
492         devkit8000              \
493         mx51evk                 \
494         omap3_beagle            \
495         omap3_overo             \
496         omap3_evm               \
497         omap3_pandora           \
498         omap3_sdp3430           \
499         omap3_zoom1             \
500         omap3_zoom2             \
501         omap4_panda             \
502         omap4_sdp4430           \
503         s5p_goni                \
504         smdkc100                \
505 "
506
507 #########################################################################
508 ## AT91 Systems
509 #########################################################################
510
511 LIST_at91="                     \
512         afeb9260                \
513         at91cap9adk             \
514         at91rm9200dk            \
515         at91rm9200ek            \
516         at91sam9260ek           \
517         at91sam9261ek           \
518         at91sam9263ek           \
519         at91sam9g10ek           \
520         at91sam9g20ek           \
521         at91sam9m10g45ek        \
522         at91sam9rlek            \
523         cmc_pu2                 \
524         CPUAT91                 \
525         CPU9260                 \
526         CPU9G20                 \
527         csb637                  \
528         eb_cpux9k2              \
529         kb9202                  \
530         meesc                   \
531         mp2usb                  \
532         m501sk                  \
533         otc570                  \
534         pm9261                  \
535         pm9263                  \
536         pm9g45                  \
537         SBC35_A9G20             \
538         TNY_A9260               \
539         TNY_A9G20               \
540 "
541
542 #########################################################################
543 ## Xscale Systems
544 #########################################################################
545
546 LIST_pxa="$(boards_by_cpu pxa)
547         polaris         \
548         trizepsiv       \
549         vpac270_nor     \
550         vpac270_onenand \
551 "
552
553 LIST_ixp="$(boards_by_cpu ixp)
554         pdnb3           \
555         scpu            \
556 "
557
558 #########################################################################
559 ## ARM groups
560 #########################################################################
561
562 LIST_arm="                      \
563         ${LIST_SA}              \
564         ${LIST_ARM7}            \
565         ${LIST_ARM9}            \
566         ${LIST_ARM10}           \
567         ${LIST_ARM11}           \
568         ${LIST_ARMV7}   \
569         ${LIST_at91}            \
570         ${LIST_pxa}             \
571         ${LIST_ixp}             \
572 "
573
574 #########################################################################
575 ## MIPS Systems         (default = big endian)
576 #########################################################################
577
578 LIST_mips4kc="          \
579         incaip          \
580         qemu_mips       \
581         vct_platinum    \
582         vct_platinum_small      \
583         vct_platinum_onenand    \
584         vct_platinum_onenand_small      \
585         vct_platinumavc \
586         vct_platinumavc_small   \
587         vct_platinumavc_onenand \
588         vct_platinumavc_onenand_small   \
589         vct_premium     \
590         vct_premium_small       \
591         vct_premium_onenand     \
592         vct_premium_onenand_small       \
593 "
594
595 LIST_mips5kc="          \
596         purple          \
597 "
598
599 LIST_au1xx0="           \
600         dbau1000        \
601         dbau1100        \
602         dbau1500        \
603         dbau1550        \
604         dbau1550_el     \
605         gth2            \
606 "
607
608 LIST_mips="             \
609         ${LIST_mips4kc} \
610         ${LIST_mips5kc} \
611         ${LIST_au1xx0}  \
612 "
613
614 #########################################################################
615 ## MIPS Systems         (little endian)
616 #########################################################################
617
618 LIST_mips4kc_el=""
619
620 LIST_mips5kc_el=""
621
622 LIST_au1xx0_el="        \
623         dbau1550_el     \
624         pb1000          \
625 "
626
627 LIST_mips_el="                  \
628         ${LIST_mips4kc_el}      \
629         ${LIST_mips5kc_el}      \
630         ${LIST_au1xx0_el}       \
631 "
632
633 #########################################################################
634 ## i386 Systems
635 #########################################################################
636
637 LIST_x86="$(boards_by_arch i386)
638         sc520_eNET      \
639 "
640
641 #########################################################################
642 ## Nios-II Systems
643 #########################################################################
644
645 LIST_nios2="$(boards_by_arch nios2)
646         nios2-generic   \
647 "
648
649 #########################################################################
650 ## MicroBlaze Systems
651 #########################################################################
652
653 LIST_microblaze="$(boards_by_arch microblaze)"
654
655 #########################################################################
656 ## ColdFire Systems
657 #########################################################################
658
659 LIST_coldfire="$(boards_by_arch m68k)
660         astro_mcf5373l          \
661         cobra5272               \
662         EB+MCF-EV123            \
663         EB+MCF-EV123_internal   \
664         M52277EVB               \
665         M5235EVB                \
666         M5329AFEE               \
667         M5373EVB                \
668         M54451EVB               \
669         M54455EVB               \
670         M5475AFE                \
671         M5485AFE                \
672 "
673
674 #########################################################################
675 ## AVR32 Systems
676 #########################################################################
677
678 LIST_avr32="$(boards_by_arch avr32)"
679
680 #########################################################################
681 ## Blackfin Systems
682 #########################################################################
683
684 LIST_blackfin="$(boards_by_arch blackfin)
685         bf527-ezkit-v2
686 "
687
688 #########################################################################
689 ## SH Systems
690 #########################################################################
691
692 LIST_sh2="              \
693         rsk7203         \
694 "
695 LIST_sh3="              \
696         mpr2            \
697         ms7720se        \
698 "
699
700 LIST_sh4="              \
701         ms7750se        \
702         ms7722se        \
703         MigoR           \
704         r7780mp         \
705         r2dplus         \
706         sh7763rdp       \
707         sh7785lcr       \
708         ap325rxa        \
709         espt            \
710 "
711
712 LIST_sh="               \
713         ${LIST_sh2}     \
714         ${LIST_sh3}     \
715         ${LIST_sh4}     \
716 "
717
718 #########################################################################
719 ## SPARC Systems
720 #########################################################################
721
722 LIST_sparc="$(boards_by_arch sparc)"
723
724 #-----------------------------------------------------------------------
725
726 build_target() {
727         target=$1
728
729         ${MAKE} distclean >/dev/null
730         ${MAKE} -s ${target}_config
731
732         ${MAKE} ${JOBS} all 2>&1 >${LOG_DIR}/$target.MAKELOG \
733                                 | tee ${LOG_DIR}/$target.ERR
734
735         # Check for 'make' errors
736         if [ ${PIPESTATUS[0]} -ne 0 ] ; then
737                 RC=1
738         fi
739
740         if [ -s ${LOG_DIR}/$target.ERR ] ; then
741                 ERR_CNT=$((ERR_CNT + 1))
742                 ERR_LIST="${ERR_LIST} $target"
743         else
744                 rm ${LOG_DIR}/$target.ERR
745         fi
746
747         TOTAL_CNT=$((TOTAL_CNT + 1))
748
749         ${CROSS_COMPILE}size ${BUILD_DIR}/u-boot \
750                                 | tee -a ${LOG_DIR}/$target.MAKELOG
751 }
752 build_targets() {
753         for t in "$@" ; do
754                 # If a LIST_xxx var exists, use it.  But avoid variable
755                 # expansion in the eval when a board name contains certain
756                 # characters that the shell interprets.
757                 case ${t} in
758                         *[-+=]*) list= ;;
759                         *)       list=$(eval echo '${LIST_'$t'}') ;;
760                 esac
761                 if [ -n "${list}" ] ; then
762                         build_targets ${list}
763                 else
764                         build_target ${t}
765                 fi
766         done
767 }
768
769 #-----------------------------------------------------------------------
770
771 print_stats() {
772         echo ""
773         echo "--------------------- SUMMARY ----------------------------"
774         echo "Boards compiled: ${TOTAL_CNT}"
775         if [ ${ERR_CNT} -gt 0 ] ; then
776                 echo "Boards with warnings or errors: ${ERR_CNT} (${ERR_LIST} )"
777         fi
778         echo "----------------------------------------------------------"
779
780         exit $RC
781 }
782
783 #-----------------------------------------------------------------------
784
785 #----- for now, just run PowerPC by default -----
786 [ $# = 0 ] && set -- powerpc
787
788 build_targets "$@"