The same mechanisms are used for normal and fallback images.
[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="December 10th, 2010"
18 ABUILD_VERSION="0.9.1"
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         mkdir -p ${build_dir}
158         mkdir -p $TARGET/sharedutils
159         [ "$update" = "true" ] && mv coreboot.rom.tmp ${build_dir}/coreboot.rom
160
161         if [ "$CONFIG" != "" ]; then
162                 printf "  Using existing configuration $CONFIG ... "
163                 xml "  <config>$CONFIG</config>"
164                 cp $CONFIG ${build_dir}/config.build
165         else
166                 printf "  Creating config file... "
167                 xml "  <config>autogenerated</config>"
168                 grep "if[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
169                         sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > ${build_dir}/config.build
170                 grep "if[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
171                         sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> ${build_dir}/config.build
172                 grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
173                         sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> ${build_dir}/config.build
174                 echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> ${build_dir}/config.build
175                 echo "CONFIG_CBFS_PREFIX=\"$cbfs_prefix\"" >> ${build_dir}/config.build
176                 if [ "$PAYLOAD" != "/dev/null" ]; then
177                         echo "# CONFIG_PAYLOAD_NONE is not set" >> ${build_dir}/config.build
178                         echo "CONFIG_PAYLOAD_ELF=y" >> ${build_dir}/config.build
179                         echo "CONFIG_PAYLOAD_FILE=\"$PAYLOAD\"" >> ${build_dir}/config.build
180                 fi
181
182                 if [ "$loglevel" != "default" ]; then
183                         printf "(loglevel override) "
184                         echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y" >> ${build_dir}/config.build
185                         echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel" >> ${build_dir}/config.build
186                         echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" >> ${build_dir}/config.build
187                         echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> ${build_dir}/config.build
188                 fi
189
190                 if [ "$update" != "false" ]; then
191                         printf "(update) "
192                         echo "CONFIG_UPDATE_IMAGE=y" >> ${build_dir}/config.build
193                 fi
194
195                 if [ "$ccache" = "true" ]; then
196                         printf "(ccache enabled) "
197                         echo "CONFIG_CCACHE=y" >> ${build_dir}/config.build
198                 fi
199
200                 if [ "$scanbuild" = "true" ]; then
201                         printf "(scan-build enabled) "
202                         echo "CONFIG_SCANBUILD_ENABLE=y" >> ${build_dir}/config.build
203                         echo "CONFIG_SCANBUILD_REPORT_LOCATION=\"$TARGET/scan-build-results-tmp\"" >> ${build_dir}/config.build
204                 fi
205         fi
206
207         #yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
208         yes "" | $MAKE oldconfig DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
209         ret=$?
210         if [ $ret -eq 0 ]; then
211                 printf "ok; "
212                 xml "  <builddir>ok</builddir>"
213                 xml "  <log>"
214                 xmlfile $build_dir/config.log
215                 xml "  </log>"
216                 xml ""
217                 return 0
218         else
219                 # Does this ever happen?
220                 printf "FAILED!\nLog excerpt:\n"
221                 xml "  <builddir>failed</builddir>"
222                 xml "  <log>"
223                 xmlfile $build_dir/config.log
224                 xml "  </log>"
225                 xml ""
226                 tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log
227                 return 1
228         fi
229 }
230
231 function create_buildenv
232 {
233         VENDOR=$1
234         MAINBOARD=$2
235         CONFIG=$3
236
237         create_config $VENDOR $MAINBOARD $CONFIG
238         ret=$?
239
240         # Allow simple "make" in the target directory
241         MAKEFILE=$TARGET/${VENDOR}_${MAINBOARD}/Makefile
242         echo "# autogenerated" > $MAKEFILE
243         echo "TOP=$ROOT" >> $MAKEFILE
244         echo "BUILD=$TARGET" >> $MAKEFILE
245         echo "OBJ=\$(BUILD)/${VENDOR}_${MAINBOARD}" >> $MAKEFILE
246         echo "OBJUTIL=\$(BUILD)/sharedutils" >> $MAKEFILE
247         echo "all:" >> $MAKEFILE
248         echo "  @cp -a config.h config.h.bak" >> $MAKEFILE
249         echo "  @cd \$(TOP); \$(MAKE) oldconfig DOTCONFIG=\$(OBJ)/config.build objutil=\$(OBJUTIL) obj=\$(OBJ)" >> $MAKEFILE
250         echo "  @tail -n+6 config.h > config.new; tail -n+6 config.h.bak > config.old" >> $MAKEFILE
251         echo "  @cmp -s config.new config.old && cp -a config.h.bak config.h || echo \"Config file changed\"" >> $MAKEFILE
252         echo "  @rm config.h.bak config.new config.old" >> $MAKEFILE
253         echo "  @cd \$(TOP); \$(MAKE) DOTCONFIG=\$(OBJ)/config.build objutil=\$(OBJUTIL) obj=\$(OBJ)" >> $MAKEFILE
254
255         return $ret
256 }
257
258 function compile_target
259 {
260         VENDOR=$1
261         MAINBOARD=$2
262
263         printf " Compiling image "
264         test "$cpus" == "" && printf "in parallel .. "
265         test "$cpus" == "1" && printf "on 1 cpu .. "
266         test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus
267
268         CURR=$( pwd )
269         #stime=`perl -e 'print time();' 2>/dev/null || date +%s`
270         build_dir=$TARGET/${VENDOR}_${MAINBOARD}
271         eval $MAKE $silent -j $cpus DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils \
272                 &> ${build_dir}/make.log
273         ret=$?
274         mv .xcompile ${build_dir}/xcompile.build
275         cd $TARGET/${VENDOR}_${MAINBOARD}
276
277         etime=`perl -e 'print time();' 2>/dev/null || date +%s`
278         duration=$(( $etime - $stime ))
279         xml "  <buildtime>${duration}s</buildtime>"
280
281         xml "  <log>"
282         xmlfile make.log
283         xml "  </log>"
284
285         if [ $ret -eq 0 ]; then
286                 xml "  <compile>ok</compile>"
287                 printf "ok\n" > compile.status
288                 printf "ok. (took ${duration}s)\n"
289                 cd $CURR
290                 return 0
291         else
292                 xml "  <compile>failed</compile>"
293                 printf "FAILED after ${duration}s!\nLog excerpt:\n"
294                 tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
295                 cd $CURR
296                 return 1
297         fi
298 }
299
300 function build_broken
301 {
302         CURR=`pwd`
303         status="yes"
304         [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no"
305         [ "$buildbroken" == "true" -o "$status" == "yes" ]
306 }
307
308 function build_target
309 {
310         VENDOR=$1
311         MAINBOARD=$2
312         CONFIG=$3
313         TARCH=$( architecture $VENDOR $MAINBOARD )
314
315         # Allow architecture override in an abuild.info file.
316         # This is used for the Motorola Sandpoint, which is not a real target
317         # but a skeleton target for the Sandpoint X3.
318         [ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
319                 source $ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
320
321         # default setting
322
323         CC="${CROSS_COMPILE}gcc"
324         CROSS_COMPILE=""
325         found_crosscompiler=false
326         if which $TARCH-elf-gcc 2>/dev/null >/dev/null; then
327                 # i386-elf target needs --divide, for i386-linux, that's the default
328                 if [ "$TARCH" = "i386" ]; then
329                         CC="$CC -Wa,--divide"
330                 fi
331                 CROSS_COMPILE="$TARCH-elf-"
332                 CC=gcc
333                 CROSS_TEXT=", using $CROSS_COMPILE$CC"
334                 found_crosscompiler=true
335         fi
336
337         HOSTCC='gcc'
338
339         printf "Building $VENDOR/$MAINBOARD; "
340
341         xml "<mainboard>"
342         xml ""
343         xml "  <vendor>$VENDOR</vendor>"
344         xml "  <device>$MAINBOARD</device>"
345         xml ""
346         xml "  <architecture>$TARCH</architecture>"
347         xml ""
348
349         if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then
350                 printf "$TARCH: ok$CROSS_TEXT\n"
351         else
352                 # FIXME this is basically the same as above.
353                 found_crosscompiler=false
354                 if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
355                         CC="gcc -m32"
356                         found_crosscompiler=true
357                 fi
358                 if [ "$ARCH" == ppc64 -a "$TARCH" == ppc ]; then
359                         CC="gcc -m32"
360                         found_crosscompiler=true
361                 fi
362                 if [ "$found_crosscompiler" == "false" -a "$TARCH" == ppc ];then
363                         for prefix in powerpc-eabi- powerpc-linux- ppc_74xx- \
364                             powerpc-7450-linux-gnu- powerpc-elf-; do
365                                 if ${prefix}gcc --version > /dev/null 2> /dev/null ; then
366                                         found_crosscompiler=true
367                                         CROSS_COMPILE=$prefix
368                                 fi
369                         done
370                 fi
371
372
373                 # TBD: look for suitable cross compiler suite
374                 # cross-$TARCH-gcc and cross-$TARCH-ld
375
376                 # Check result:
377                 if [ $found_crosscompiler == "false" ]; then
378                         printf "$TARCH: skipped, we're $ARCH\n\n"
379                         xml "  <status>notbuilt</status>"
380                         xml ""
381                         xml "</mainboard>"
382
383                         return 0
384                 else
385                         printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n"
386                         xml "  <compiler>"
387                         xml "    <path>`which ${CROSS_COMPILE}gcc`</path>"
388                         xml "    <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
389                         xml "  </compiler>"
390                         xml ""
391                 fi
392         fi
393
394         CC=${CROSS_COMPILE}$CC
395
396         if  [ "$stackprotect" = "true" ]; then
397                 CC="$CC -fno-stack-protector"
398         fi
399
400         build_broken $VENDOR $MAINBOARD || \
401         {
402                 printf " ( broken mainboard/$VENDOR/$MAINBOARD skipped )\n\n"
403                 xml "  <status>knownbroken</status>"
404                 xml ""
405                 xml "</mainboard>"
406                 return 0
407         }
408
409         stime=`perl -e 'print time();' 2>/dev/null || date +%s`
410         create_buildenv $VENDOR $MAINBOARD $CONFIG
411         if [ $? -eq 0  -a  $configureonly -eq 0 ]; then
412                 if [ "$scanbuild" = "true" ]; then
413                         rm -rf $TARGET/scan-build-results-tmp
414                 fi
415                 compile_target $VENDOR $MAINBOARD &&
416                         xml "  <status>ok</status>" ||
417                         xml "<status>broken</status>"
418                 if [ "$scanbuild" = "true" ]; then
419                         rm -rf $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
420                         mv `dirname $TARGET/scan-build-results-tmp/*/index.html` $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
421                 fi
422         fi
423         # Not calculated here because we still print it in compile_target
424         #etime=`perl -e 'print time();' 2>/dev/null || date +%s`
425         #duration=$(( $etime - $stime ))
426         #xml "  <buildtime>${duration}s</buildtime>"
427
428         xml ""
429         xml "</mainboard>"
430
431         printf "\n"
432 }
433
434 function test_target
435 {
436         VENDOR=$1
437         MAINBOARD=$2
438
439         if [ "$hwtest" != "true" ]; then
440                 return 0
441         fi
442
443         # image does not exist. we silently skip the patch.
444         if [ ! -r "$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" ]; then
445                 return 0
446         fi
447
448         which curl &> /dev/null
449         if [ $? != 0 ]; then
450                 printf "curl is not installed but required for test submission.  skipping test.\n\n"
451                 return 0
452         fi
453
454         CURR=`pwd`
455         if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/tested" ]; then
456                 printf "Testing image for board $VENDOR $MAINBOARD skipped (previously submitted).\n\n"
457                 return 0
458         fi
459         # touch $TARGET/${VENDOR}_${MAINBOARD}/tested
460
461         printf "Submitting image for board $VENDOR $MAINBOARD to test system...\n"
462
463         curl -f -F "romfile=@$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" \
464                 -F "mode=abuild" -F "mainboard=${VENDOR}_${MAINBOARD}" -F "submit=Upload" \
465                 "http://qa.coreboot.org/deployment/send.php"
466
467         printf "\n"
468         return 0
469 }
470
471 function remove_target
472 {
473         if [ "$remove" != "true" ]; then
474                 return 0
475         fi
476
477         VENDOR=$1
478         MAINBOARD=$2
479
480         # Save the generated coreboot.rom file of each board.
481         if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" ]; then
482                 cp $TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom \
483                    ${VENDOR}_${MAINBOARD}_coreboot.rom
484         fi
485
486         printf "Removing build dir for board $VENDOR $MAINBOARD...\n"
487         rm -rf $TARGET/${VENDOR}_${MAINBOARD}
488
489         return 0
490 }
491
492 function myhelp
493 {
494         printf "Usage: $0 [-v] [-a] [-b] [-r] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
495         printf "       $0 [-V|--version]\n"
496         printf "       $0 [-h|--help]\n\n"
497
498         printf "Options:\n"
499         printf "    [-v|--verbose]                print more messages\n"
500         printf "    [-a|--all]                    build previously succeeded ports as well\n"
501         printf "    [-b|--broken]                 attempt to build ports that are known broken\n"
502         printf "    [-r|--remove]                 remove output dir after build\n"
503         printf "    [-t|--target <vendor/board>]  attempt to build target vendor/board only\n"
504         printf "    [-p|--payloads <dir>]         use payloads in <dir> to build images\n"
505         printf "    [-V|--version]                print version number and exit\n"
506         printf "    [-h|--help]                   print this help and exit\n"
507         printf "    [-x|--xml]                    write xml log file \n"
508         printf "                                  (defaults to $XMLFILE)\n"
509         printf "    [-T|--test]                   submit image(s) to automated test system\n"
510         printf "    [-c|--cpus <numcpus>]         build on <numcpus> at the same time\n"
511         printf "    [-s|--silent]                 omit compiler calls in logs\n"
512         printf "    [-ns|--nostackprotect]        use gcc -fno-stack-protector option\n"
513         printf "    [-sb|--scan-build]            use clang's static analyzer\n"
514         printf "    [-y|--ccache]                 use ccache\n"
515         printf "    [-C|--config]                 configure-only mode\n"
516         printf "    [-l|--loglevel <num>]         set loglevel\n"
517         printf "    [-u|--update]                 update existing image\n"
518         printf "    [-P|--prefix <name>]          file name prefix in CBFS\n"
519         printf "    [lbroot]                      absolute path to coreboot sources\n"
520         printf "                                  (defaults to $ROOT)\n\n"
521 }
522
523 function myversion
524 {
525         cat << EOF
526
527 coreboot autobuild v$ABUILD_VERSION ($ABUILD_DATE)
528
529 Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
530 Copyright (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
531
532 This program is free software; you may redistribute it under the terms
533 of the GNU General Public License. This program has absolutely no
534 warranty.
535
536 EOF
537 }
538
539 # default options
540 target=""
541 buildall=false
542 verbose=false
543
544 test -f util/sconfig/sconfig.l && ROOT=$( pwd )
545 test -f ../util/sconfig/sconfig.l && ROOT=$( cd ..; pwd )
546 test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
547
548 # parse parameters.. try to find out whether we're running GNU getopt
549 getoptbrand="`getopt -V`"
550 if [ "${getoptbrand:0:6}" == "getopt" ]; then
551         # Detected GNU getopt that supports long options.
552         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 -- "$@"`
553         eval set -- $args
554 else
555         # Detected non-GNU getopt
556         args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*`
557         set -- $args
558 fi
559
560 if [ $? != 0 ]; then
561         myhelp
562         exit 1
563 fi
564
565 while true ; do
566         case "$1" in
567                 -x|--xml)       shift; mode=xml; rm -f $XMLFILE ;;
568                 -t|--target)    shift; target="$1"; shift;;
569                 -a|--all)       shift; buildall=true;;
570                 -b|--broken)    shift; buildbroken=true;;
571                 -r|--remove)    shift; remove=true;;
572                 -v|--verbose)   shift; verbose=true; silent='V=1';;
573                 -V|--version)   shift; myversion; exit 0;;
574                 -h|--help)      shift; myversion; myhelp; exit 0;;
575                 -p|--payloads)  shift; payloads="$1"; shift;;
576                 -T|--test)      shift; hwtest=true;;
577                 -c|--cpus)      shift; cpus="$1"; test "$cpus" == "max" && cpus=""; shift;;
578                 -s|--silent)    shift; silent="-s";;
579                 -ns|--nostackprotect) shift; stackprotect=true;;
580                 -sb|--scan-build) shift; scanbuild=true;;
581                 -y|--ccache)    shift; ccache=true;;
582                 -C|--config)    shift; configureonly=1;;
583                 -l|--loglevel)  shift; loglevel="$1"; shift;;
584                 -u|--update)    shift; update="true";;
585                 -P|--prefix)    shift; cbfs_prefix="$1"; shift;;
586                 --)             shift; break;;
587                 -*)             printf "Invalid option\n\n"; myhelp; exit 1;;
588                 *)              break;;
589         esac
590 done
591
592 # /path/to/freebios2/
593 test -z "$1" || ROOT=$1
594
595 debug "ROOT=$ROOT"
596
597 xml '<?xml version="1.0" encoding="utf-8"?>'
598 xml '<abuild>'
599
600 if [ "$target" != "" ]; then
601         # build a single board
602         VENDOR=`printf $target|cut -f1 -d/`
603         MAINBOARD=`printf $target|cut -f2 -d/`
604         CONFIG=`printf $target|cut -f3 -d/`
605         if [ ! -r $ROOT/src/mainboard/$target ]; then
606                 printf "No such target: $target\n"
607                 xml '</abuild>'
608                 exit 1
609         fi
610         build_target $VENDOR $MAINBOARD $CONFIG
611         test_target $VENDOR $MAINBOARD
612 else
613         # build all boards per default
614         for VENDOR in $( vendors ); do
615                 for MAINBOARD in $( mainboards $VENDOR ); do
616                         build_target $VENDOR $MAINBOARD
617                         test_target $VENDOR $MAINBOARD
618                         remove_target $VENDOR $MAINBOARD
619                 done
620         done
621 fi
622 xml '</abuild>'
623