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