Remove lib/ramtest.c-include from all CAR boards.
[coreboot.git] / util / abuild / abuild
1 #!/bin/bash
2 #
3 #  coreboot autobuild
4 #
5 #  This script builds coreboot images for all available targets.
6 #
7 #  (C) 2004 by Stefan Reinauer <stepan@openbios.org>
8 #  (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
9 #
10 #  This file is subject to the terms and conditions of the GNU General
11 #  Public License. See the file COPYING in the main directory of this
12 #  archive for more details.
13 #
14
15 #set -x # Turn echo on....
16
17 ABUILD_DATE="January 29th, 2010"
18 ABUILD_VERSION="0.9"
19
20 # Where shall we place all the build trees?
21 TARGET=coreboot-builds
22 XMLFILE=$( pwd )/abuild.xml
23
24 # path to payload. Should be more generic
25 PAYLOAD=/dev/null
26
27 # Lines of error context to be printed in FAILURE case
28 CONTEXT=6
29
30 TESTSUBMISSION="http://qa.coreboot.org/deployment/send.php"
31
32 # Number of CPUs to compile on per default
33 cpus=1
34
35 # Configure-only mode
36 configureonly=0
37
38 # One might want to adjust these in case of cross compiling
39 for i in make gmake gnumake nonexistant_make; do
40         $i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
41 done
42 if [ "$i" = "nonexistant_make" ]; then
43         echo No GNU Make found.
44         exit 1
45 fi
46 MAKE=$i
47
48 # this can be changed to xml by -x
49 mode=text
50
51 # silent mode.. no compiler calls, only warnings in the log files.
52 # this is disabled per default but can be enabled with -s
53 silent=
54
55 # clang mode enabled by -sb option.
56 scanbuild=false
57
58 # use ccache
59 ccache=false
60
61 # stackprotect mode enabled by -ns option.
62 stackprotect=false
63
64 # loglevel changed with -l / --loglevel option
65 loglevel=default
66
67 # update existing image
68 update=false
69
70 # CBFS prefix
71 cbfs_prefix=fallback
72
73 ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
74         -e s/i86pc/i386/ \
75         -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
76         -e "s/Power Macintosh/ppc/"`
77
78 trap interrupt INT
79
80 function interrupt
81 {
82         printf "\n$0: execution interrupted manually.\n"
83         if [ "$mode" == "xml" ]; then
84                 printf "$0: deleting incomplete xml output file.\n"
85         fi
86         exit 1
87 }
88
89 function debug
90 {
91         test "$verbose" == "true" && printf "$*\n"
92 }
93
94 function xml
95 {
96         test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
97         return 0
98 }
99
100 function xmlfile
101 {
102         test "$mode" == "xml" && {
103                 printf '<![CDATA[\n'
104                 cat $1
105                 printf ']]>\n'
106         } >> $XMLFILE
107 }
108
109
110
111 function vendors
112 {
113         # make this a function so we can easily select
114         # without breaking readability
115         ls -1 "$ROOT/src/mainboard" | grep -v Kconfig | grep -v Makefile
116 }
117
118 function mainboards
119 {
120         # make this a function so we can easily select
121         # without breaking readability
122
123         VENDOR=$1
124
125         ls -1 $ROOT/src/mainboard/$VENDOR | grep -v Kconfig
126 }
127
128 function architecture
129 {
130         VENDOR=$1
131         MAINBOARD=$2
132         ARCH=`cat $ROOT/src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
133                 grep "select ARCH_"|cut -f2- -d_`
134         echo $ARCH | sed s/X86/i386/
135 }
136
137 function create_config
138 {
139         VENDOR=$1
140         MAINBOARD=$2
141         CONFIG=$3
142
143         build_dir=$TARGET/${VENDOR}_${MAINBOARD}
144
145         # get a working payload for the board if we have one.
146         # the --payload option expects a directory containing
147         # a shell script payload.sh
148         #   Usage: payload.sh [VENDOR] [DEVICE]
149         # the script returns an absolute path to the payload binary.
150
151         if [ -f $payloads/payload.sh ]; then
152                 PAYLOAD=`sh $payloads/payload.sh $VENDOR $MAINBOARD`
153                 printf "Using payload $PAYLOAD\n"
154         fi
155
156         [ "$update" = "true" ] && mv ${build_dir}/coreboot.rom coreboot.rom.tmp
157         $MAKE distclean obj=${build_dir}
158         mkdir -p ${build_dir}
159         mkdir -p $TARGET/sharedutils
160         [ "$update" = "true" ] && mv coreboot.rom.tmp ${build_dir}/coreboot.rom
161
162         if [ "$CONFIG" != "" ]; then
163                 printf "  Using existing configuration $CONFIG ... "
164                 xml "  <config>$CONFIG</config>"
165                 cp $CONFIG .config
166         else
167                 printf "  Creating config file... "
168                 xml "  <config>autogenerated</config>"
169                 grep "if[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
170                         sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > .config
171                 grep "if[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
172                         sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
173                 grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
174                         sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
175                 echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> .config
176                 echo "CONFIG_CBFS_PREFIX=\"$cbfs_prefix\"" >> .config
177                 if [ "$PAYLOAD" != "/dev/null" ]; then
178                         echo "# CONFIG_PAYLOAD_NONE is not set" >> .config
179                         echo "CONFIG_PAYLOAD_ELF=y" >> .config
180                         echo "CONFIG_FALLBACK_PAYLOAD_FILE=\"$PAYLOAD\"" >> .config
181                 fi
182
183                 if [ "$loglevel" != "default" ]; then
184                         printf "(loglevel override) "
185                         echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y" >> .config
186                         echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel" >> .config
187                         echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" >> .config
188                         echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config
189                 fi
190
191                 if [ "$update" != "false" ]; then
192                         printf "(update) "
193                         echo "CONFIG_UPDATE_IMAGE=y" >> .config
194                 fi
195
196                 if [ "$ccache" = "true" ]; then
197                         printf "(ccache enabled) "
198                         echo "CONFIG_CCACHE=y" >> .config
199                 fi
200
201                 if [ "$scanbuild" = "true" ]; then
202                         printf "(scan-build enabled) "
203                         echo "CONFIG_SCANBUILD_ENABLE=y" >> .config
204                         echo "CONFIG_SCANBUILD_REPORT_LOCATION=\"$TARGET/scan-build-results-tmp\"" >> .config
205                 fi
206                 echo "CONFIG_USBDEBUG=y" >> .config
207         fi
208
209         #yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
210         yes "" | $MAKE oldconfig obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
211         ret=$?
212         mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in
213         if [ $ret -eq 0 ]; then
214                 printf "ok; "
215                 xml "  <builddir>ok</builddir>"
216                 xml "  <log>"
217                 xmlfile $build_dir/config.log
218                 xml "  </log>"
219                 xml ""
220                 return 0
221         else
222                 # Does this ever happen?
223                 printf "FAILED!\nLog excerpt:\n"
224                 xml "  <builddir>failed</builddir>"
225                 xml "  <log>"
226                 xmlfile $build_dir/config.log
227                 xml "  </log>"
228                 xml ""
229                 tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log
230                 return 1
231         fi
232 }
233
234 function create_buildenv
235 {
236         VENDOR=$1
237         MAINBOARD=$2
238         CONFIG=$3
239
240         create_config $VENDOR $MAINBOARD $CONFIG
241         ret=$?
242
243         # Allow simple "make" in the target directory
244         MAKEFILE=$TARGET/${VENDOR}_${MAINBOARD}/Makefile
245         echo "# autogenerated makefile" > $MAKEFILE
246         echo "TOP=$ROOT" >> $MAKEFILE
247         echo "OUT=$TARGET/${VENDOR}_${MAINBOARD}" >> $MAKEFILE
248         echo "all:" >> $MAKEFILE
249         echo "  cp config.build \$(TOP)/.config" >> $MAKEFILE
250         echo "  cd \$(TOP); \$(MAKE) oldconfig obj=\$(OUT)" >> $MAKEFILE
251         echo "  cd \$(TOP); \$(MAKE) obj=\$(OUT)" >> $MAKEFILE
252
253         return $ret
254 }
255
256 function compile_target
257 {
258         VENDOR=$1
259         MAINBOARD=$2
260
261         printf " Compiling image "
262         test "$cpus" == "" && printf "in parallel .. "
263         test "$cpus" == "1" && printf "on 1 cpu .. "
264         test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus
265
266         CURR=$( pwd )
267         #stime=`perl -e 'print time();' 2>/dev/null || date +%s`
268         build_dir=$TARGET/${VENDOR}_${MAINBOARD}
269         eval $MAKE $silent -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils \
270                 &> ${build_dir}/make.log
271         ret=$?
272         mv .config ${build_dir}/config.build
273         mv .xcompile ${build_dir}/xcompile.build
274         cd $TARGET/${VENDOR}_${MAINBOARD}
275
276         etime=`perl -e 'print time();' 2>/dev/null || date +%s`
277         duration=$(( $etime - $stime ))
278         xml "  <buildtime>${duration}s</buildtime>"
279
280         xml "  <log>"
281         xmlfile make.log
282         xml "  </log>"
283
284         if [ $ret -eq 0 ]; then
285                 xml "  <compile>ok</compile>"
286                 printf "ok\n" > compile.status
287                 printf "ok. (took ${duration}s)\n"
288                 cd $CURR
289                 return 0
290         else
291                 xml "  <compile>failed</compile>"
292                 printf "FAILED after ${duration}s!\nLog excerpt:\n"
293                 tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
294                 cd $CURR
295                 return 1
296         fi
297 }
298
299 function built_successfully
300 {
301         CURR=`pwd`
302         status="fail"
303         if [ -d "$TARGET/${VENDOR}_${MAINBOARD}" ]; then
304                 cd $TARGET/${VENDOR}_${MAINBOARD}
305                 if [ -r compile.status ] ; then
306                         status=`cat compile.status`
307                 fi
308                 cd $CURR
309         fi
310         [ "$buildall" != "true" -a "$status" == "ok" ]
311 }
312
313 function build_broken
314 {
315         CURR=`pwd`
316         status="yes"
317         [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no"
318         [ "$buildbroken" == "true" -o "$status" == "yes" ]
319 }
320
321 function build_target
322 {
323         VENDOR=$1
324         MAINBOARD=$2
325         CONFIG=$3
326         TARCH=$( architecture $VENDOR $MAINBOARD )
327
328         # Allow architecture override in an abuild.info file.
329         # This is used for the Motorola Sandpoint, which is not a real target
330         # but a skeleton target for the Sandpoint X3.
331         [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
332                 source $ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
333
334         # default setting
335
336         CC="${CROSS_COMPILE}gcc"
337         CROSS_COMPILE=""
338         found_crosscompiler=false
339         if which $TARCH-elf-gcc 2>/dev/null >/dev/null; then
340                 # i386-elf target needs --divide, for i386-linux, that's the default
341                 if [ "$TARCH" = "i386" ]; then
342                         CC="$CC -Wa,--divide"
343                 fi
344                 CROSS_COMPILE="$TARCH-elf-"
345                 CC=gcc
346                 CROSS_TEXT=", using $CROSS_COMPILE$CC"
347                 found_crosscompiler=true
348         fi
349
350         HOSTCC='gcc'
351
352         printf "Building $VENDOR/$MAINBOARD; "
353
354         xml "<mainboard>"
355         xml ""
356         xml "  <vendor>$VENDOR</vendor>"
357         xml "  <device>$MAINBOARD</device>"
358         xml ""
359         xml "  <architecture>$TARCH</architecture>"
360         xml ""
361
362         if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then
363                 printf "$TARCH: ok$CROSS_TEXT\n"
364         else
365                 # FIXME this is basically the same as above.
366                 found_crosscompiler=false
367                 if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
368                         CC="gcc -m32"
369                         found_crosscompiler=true
370                 fi
371                 if [ "$ARCH" == ppc64 -a "$TARCH" == ppc ]; then
372                         CC="gcc -m32"
373                         found_crosscompiler=true
374                 fi
375                 if [ "$found_crosscompiler" == "false" -a "$TARCH" == ppc ];then
376                         for prefix in powerpc-eabi- powerpc-linux- ppc_74xx- \
377                             powerpc-7450-linux-gnu- powerpc-elf-; do
378                                 if ${prefix}gcc --version > /dev/null 2> /dev/null ; then
379                                         found_crosscompiler=true
380                                         CROSS_COMPILE=$prefix
381                                 fi
382                         done
383                 fi
384
385
386                 # TBD: look for suitable cross compiler suite
387                 # cross-$TARCH-gcc and cross-$TARCH-ld
388
389                 # Check result:
390                 if [ $found_crosscompiler == "false" ]; then
391                         printf "$TARCH: skipped, we're $ARCH\n\n"
392                         xml "  <status>notbuilt</status>"
393                         xml ""
394                         xml "</mainboard>"
395
396                         return 0
397                 else
398                         printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n"
399                         xml "  <compiler>"
400                         xml "    <path>`which ${CROSS_COMPILE}gcc`</path>"
401                         xml "    <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
402                         xml "  </compiler>"
403                         xml ""
404                 fi
405         fi
406
407         CC=${CROSS_COMPILE}$CC
408
409         if  [ "$stackprotect" = "true" ]; then
410                 CC="$CC -fno-stack-protector"
411         fi
412
413         built_successfully $VENDOR $MAINBOARD && test $update = "false" && \
414         {
415                 printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n"
416                 xml "  <status>previouslyok</status>"
417                 xml ""
418                 xml "</mainboard>"
419                 return 0
420         }
421
422         build_broken $VENDOR $MAINBOARD || \
423         {
424                 printf " ( broken mainboard/$VENDOR/$MAINBOARD skipped )\n\n"
425                 xml "  <status>knownbroken</status>"
426                 xml ""
427                 xml "</mainboard>"
428                 return 0
429         }
430
431         stime=`perl -e 'print time();' 2>/dev/null || date +%s`
432         create_buildenv $VENDOR $MAINBOARD $CONFIG
433         if [ $? -eq 0  -a  $configureonly -eq 0 ]; then
434                 if [ "$scanbuild" = "true" ]; then
435                         rm -rf $TARGET/scan-build-results-tmp
436                 fi
437                 compile_target $VENDOR $MAINBOARD &&
438                         xml "  <status>ok</status>" ||
439                         xml "<status>broken</status>"
440                 if [ "$scanbuild" = "true" ]; then
441                         rm -rf $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
442                         mv `dirname $TARGET/scan-build-results-tmp/*/index.html` $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
443                 fi
444         fi
445         # Not calculated here because we still print it in compile_target
446         #etime=`perl -e 'print time();' 2>/dev/null || date +%s`
447         #duration=$(( $etime - $stime ))
448         #xml "  <buildtime>${duration}s</buildtime>"
449
450         xml ""
451         xml "</mainboard>"
452
453         printf "\n"
454 }
455
456 function test_target
457 {
458         VENDOR=$1
459         MAINBOARD=$2
460
461         if [ "$hwtest" != "true" ]; then
462                 return 0
463         fi
464
465         # image does not exist. we silently skip the patch.
466         if [ ! -r "$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" ]; then
467                 return 0
468         fi
469
470         which curl &> /dev/null
471         if [ $? != 0 ]; then
472                 printf "curl is not installed but required for test submission.  skipping test.\n\n"
473                 return 0
474         fi
475
476         CURR=`pwd`
477         if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/tested" ]; then
478                 printf "Testing image for board $VENDOR $MAINBOARD skipped (previously submitted).\n\n"
479                 return 0
480         fi
481         # touch $TARGET/${VENDOR}_${MAINBOARD}/tested
482
483         printf "Submitting image for board $VENDOR $MAINBOARD to test system...\n"
484
485         curl -f -F "romfile=@$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" \
486                 -F "mode=abuild" -F "mainboard=${VENDOR}_${MAINBOARD}" -F "submit=Upload" \
487                 "http://qa.coreboot.org/deployment/send.php"
488
489         printf "\n"
490         return 0
491 }
492
493 function remove_target
494 {
495         if [ "$remove" != "true" ]; then
496                 return 0
497         fi
498
499         VENDOR=$1
500         MAINBOARD=$2
501
502         # Save the generated coreboot.rom file of each board.
503         if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" ]; then
504                 cp $TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom \
505                    ${VENDOR}_${MAINBOARD}_coreboot.rom
506         fi
507
508         printf "Removing build dir for board $VENDOR $MAINBOARD...\n"
509         rm -rf $TARGET/${VENDOR}_${MAINBOARD}
510
511         return 0
512 }
513
514 function myhelp
515 {
516         printf "Usage: $0 [-v] [-a] [-b] [-r] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
517         printf "       $0 [-V|--version]\n"
518         printf "       $0 [-h|--help]\n\n"
519
520         printf "Options:\n"
521         printf "    [-v|--verbose]                print more messages\n"
522         printf "    [-a|--all]                    build previously succeeded ports as well\n"
523         printf "    [-b|--broken]                 attempt to build ports that are known broken\n"
524         printf "    [-r|--remove]                 remove output dir after build\n"
525         printf "    [-t|--target <vendor/board>]  attempt to build target vendor/board only\n"
526         printf "    [-p|--payloads <dir>]         use payloads in <dir> to build images\n"
527         printf "    [-V|--version]                print version number and exit\n"
528         printf "    [-h|--help]                   print this help and exit\n"
529         printf "    [-x|--xml]                    write xml log file \n"
530         printf "                                  (defaults to $XMLFILE)\n"
531         printf "    [-T|--test]                   submit image(s) to automated test system\n"
532         printf "    [-c|--cpus <numcpus>]         build on <numcpus> at the same time\n"
533         printf "    [-s|--silent]                 omit compiler calls in logs\n"
534         printf "    [-ns|--nostackprotect]        use gcc -fno-stack-protector option\n"
535         printf "    [-sb|--scan-build]            use clang's static analyzer\n"
536         printf "    [-y|--ccache]                 use ccache\n"
537         printf "    [-C|--config]                 configure-only mode\n"
538         printf "    [-l|--loglevel <num>]         set loglevel\n"
539         printf "    [-u|--update]                 update existing image\n"
540         printf "    [-P|--prefix <name>]          file name prefix in CBFS\n"
541         printf "    [lbroot]                      absolute path to coreboot sources\n"
542         printf "                                  (defaults to $ROOT)\n\n"
543 }
544
545 function myversion
546 {
547         cat << EOF
548
549 coreboot autobuild v$ABUILD_VERSION ($ABUILD_DATE)
550
551 Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
552 Copyright (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
553
554 This program is free software; you may redistribute it under the terms
555 of the GNU General Public License. This program has absolutely no
556 warranty.
557
558 EOF
559 }
560
561 # default options
562 target=""
563 buildall=false
564 verbose=false
565
566 test -f util/sconfig/sconfig.l && ROOT=$( pwd )
567 test -f ../util/sconfig/sconfig.l && ROOT=$( cd ..; pwd )
568 test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
569
570 # parse parameters.. try to find out whether we're running GNU getopt
571 getoptbrand="`getopt -V`"
572 if [ "${getoptbrand:0:6}" == "getopt" ]; then
573         # Detected GNU getopt that supports long options.
574         args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache -o Vvhat:bp:Tc:sxCl:rP:uy -- "$@"`
575         eval set -- $args
576 else
577         # Detected non-GNU getopt
578         args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*`
579         set -- $args
580 fi
581
582 if [ $? != 0 ]; then
583         myhelp
584         exit 1
585 fi
586
587 while true ; do
588         case "$1" in
589                 -x|--xml)       shift; mode=xml; rm -f $XMLFILE ;;
590                 -t|--target)    shift; target="$1"; shift;;
591                 -a|--all)       shift; buildall=true;;
592                 -b|--broken)    shift; buildbroken=true;;
593                 -r|--remove)    shift; remove=true;;
594                 -v|--verbose)   shift; verbose=true; silent='V=1';;
595                 -V|--version)   shift; myversion; exit 0;;
596                 -h|--help)      shift; myversion; myhelp; exit 0;;
597                 -p|--payloads)  shift; payloads="$1"; shift;;
598                 -T|--test)      shift; hwtest=true;;
599                 -c|--cpus)      shift; cpus="$1"; test "$cpus" == "max" && cpus=""; shift;;
600                 -s|--silent)    shift; silent="-s";;
601                 -ns|--nostackprotect) shift; stackprotect=true;;
602                 -sb|--scan-build) shift; scanbuild=true;;
603                 -y|--ccache)    shift; ccache=true;;
604                 -C|--config)    shift; configureonly=1;;
605                 -l|--loglevel)  shift; loglevel="$1"; shift;;
606                 -u|--update)    shift; update="true";;
607                 -P|--prefix)    shift; cbfs_prefix="$1"; shift;;
608                 --)             shift; break;;
609                 -*)             printf "Invalid option\n\n"; myhelp; exit 1;;
610                 *)              break;;
611         esac
612 done
613
614 # /path/to/freebios2/
615 test -z "$1" || ROOT=$1
616
617 debug "ROOT=$ROOT"
618
619 xml '<?xml version="1.0" encoding="utf-8"?>'
620 xml '<abuild>'
621
622 if [ "$target" != "" ]; then
623         # build a single board
624         VENDOR=`printf $target|cut -f1 -d/`
625         MAINBOARD=`printf $target|cut -f2 -d/`
626         CONFIG=`printf $target|cut -f3 -d/`
627         if [ ! -r $ROOT/src/mainboard/$target ]; then
628                 printf "No such target: $target\n"
629                 xml '</abuild>'
630                 exit 1
631         fi
632         build_target $VENDOR $MAINBOARD $CONFIG
633         test_target $VENDOR $MAINBOARD
634 else
635         # build all boards per default
636         for VENDOR in $( vendors ); do
637                 for MAINBOARD in $( mainboards $VENDOR ); do
638                         build_target $VENDOR $MAINBOARD
639                         test_target $VENDOR $MAINBOARD
640                         remove_target $VENDOR $MAINBOARD
641                 done
642         done
643 fi
644 xml '</abuild>'
645