blob: cddcb576483725b1683b1ed3786be823a19dd07b [file] [log] [blame]
Stefan Reinauer9f12caa2004-10-19 07:00:47 +00001#!/bin/bash
2#
Stefan Reinauerf8ee1802008-01-18 15:08:58 +00003# coreboot autobuild
Stefan Reinauer9f12caa2004-10-19 07:00:47 +00004#
Stefan Reinauerf8ee1802008-01-18 15:08:58 +00005# This script builds coreboot images for all available targets.
Stefan Reinauer9f12caa2004-10-19 07:00:47 +00006#
7# (C) 2004 by Stefan Reinauer <stepan@openbios.org>
Stefan Reinauer68003b82010-01-30 10:44:28 +00008# (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
Martin Rothddb7a9d2014-12-08 01:57:52 -07009# (C) 2013-2014 Sage Electronic Engineering, LLC
Patrick Georgi2d242792014-05-21 22:48:35 +020010# (C) 2014 Patrick Georgi <patrick@georgi-clan.de>
Stefan Reinauer9f12caa2004-10-19 07:00:47 +000011#
12# This file is subject to the terms and conditions of the GNU General
13# Public License. See the file COPYING in the main directory of this
14# archive for more details.
Stefan Reinauer14e22772010-04-27 06:56:47 +000015#
Stefan Reinauer9f12caa2004-10-19 07:00:47 +000016
Eric Biedermanc1492102004-11-05 08:50:54 +000017#set -x # Turn echo on....
Stefan Reinauer23c3d932004-10-21 21:41:57 +000018
Martin Roth21ca9be2015-10-13 12:27:56 -060019ABUILD_DATE="Oct 13, 2015"
20ABUILD_VERSION="0.9.4"
Stefan Reinauer3a140572006-10-25 19:02:34 +000021
Patrick Georgi3db85f32011-11-05 13:21:14 +010022TOP=$PWD
23
Stefan Reinauer23c3d932004-10-21 21:41:57 +000024# Where shall we place all the build trees?
Patrick Georgiaab0cce2013-12-19 20:43:29 +010025TARGET=${COREBOOT_BUILD_DIR:-coreboot-builds}
Patrick Georgi3db85f32011-11-05 13:21:14 +010026XMLFILE=$TOP/abuild.xml
27REAL_XMLFILE=$XMLFILE
Stefan Reinauer9f12caa2004-10-19 07:00:47 +000028
Patrick Georgid03d69b2013-12-19 20:13:23 +010029export KCONFIG_OVERWRITECONFIG=1
30
Stefan Reinauer23c3d932004-10-21 21:41:57 +000031# path to payload. Should be more generic
Eric Biederman018d8dd2004-11-04 11:04:33 +000032PAYLOAD=/dev/null
Stefan Reinauer23c3d932004-10-21 21:41:57 +000033
Marc Jones66a68a22013-05-31 13:33:30 -060034# path to coreboot XGCC
35XGCCPATH="`pwd`/util/crossgcc/xgcc/bin/"
36
37# Add XGCC to the path.
38if [ -d "$XGCCPATH" ] && [[ ":$PATH:" != *":$XGCCPATH:"* ]]; then
39 PATH="$XGCCPATH:$PATH"
40fi
41
Stefan Reinauer23c3d932004-10-21 21:41:57 +000042# Lines of error context to be printed in FAILURE case
Stefan Reinauerabdf8482010-03-30 14:02:19 +000043CONTEXT=6
Stefan Reinauer23c3d932004-10-21 21:41:57 +000044
Stefan Reinauercc44b062009-03-11 15:00:50 +000045# Configure-only mode
46configureonly=0
47
Patrick Georgif9d19f22011-06-01 19:29:48 +000048# Did any board fail to build?
49failed=0
50
Patrick Georgi58955512013-12-05 19:53:04 +010051# default: single CPU build
52cpus=1
53
Stefan Reinauer23c3d932004-10-21 21:41:57 +000054# One might want to adjust these in case of cross compiling
Patrick Georgia84a99b2009-05-26 14:03:51 +000055for i in make gmake gnumake nonexistant_make; do
56 $i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
57done
58if [ "$i" = "nonexistant_make" ]; then
59 echo No GNU Make found.
60 exit 1
61fi
62MAKE=$i
Stefan Reinauer9f12caa2004-10-19 07:00:47 +000063
Patrick Georgi6f0e1602013-12-05 19:36:31 +010064# this can be changed to junit by -J
Stefan Reinauer192b7bc2006-05-27 00:22:02 +000065mode=text
66
Stefan Reinauer02a4e7f2008-05-27 18:29:26 +000067# silent mode.. no compiler calls, only warnings in the log files.
68# this is disabled per default but can be enabled with -s
69silent=
70
Martin Rothddb7a9d2014-12-08 01:57:52 -070071# quiet mode: only print pass, failure, and 'skipped' messages
72quiet=false
73
Patrick Georgid2296772009-03-11 15:43:02 +000074# clang mode enabled by -sb option.
75scanbuild=false
76
Stefan Reinauer9f12caa2004-10-19 07:00:47 +000077ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
Stefan Reinauercc44b062009-03-11 15:00:50 +000078 -e s/i86pc/i386/ \
Stefan Reinauer9f12caa2004-10-19 07:00:47 +000079 -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
80 -e "s/Power Macintosh/ppc/"`
81
Stefan Reinauer3a140572006-10-25 19:02:34 +000082trap interrupt INT
83
84function interrupt
85{
86 printf "\n$0: execution interrupted manually.\n"
Patrick Georgi6f0e1602013-12-05 19:36:31 +010087 if [ "$mode" == "junit" ]; then
Stefan Reinauer3a140572006-10-25 19:02:34 +000088 printf "$0: deleting incomplete xml output file.\n"
89 fi
90 exit 1
91}
92
Stefan Reinauer173f13b2004-11-05 11:57:00 +000093function debug
94{
Stefan Reinauer3a140572006-10-25 19:02:34 +000095 test "$verbose" == "true" && printf "$*\n"
Stefan Reinauer173f13b2004-11-05 11:57:00 +000096}
Eric Biederman692f2c72004-11-05 19:55:06 +000097
Patrick Georgi140a9902011-06-03 21:56:13 +020098function junit
99{
100 test "$mode" == "junit" && printf "$*\n" >> $XMLFILE
101 return 0
102}
103
104function junitfile
105{
106 test "$mode" == "junit" && {
107 printf '<![CDATA[\n'
108 cat $1
109 printf ']]>\n'
110 } >> $XMLFILE
111}
Stefan Reinauer192b7bc2006-05-27 00:22:02 +0000112
Patrick Georgic2050f02015-10-31 00:35:44 +0100113# Return mainboard descriptors.
114# By default all mainboards are listed, but when passing a two-level path
115# below src/mainboard, such as emulation/qemu-i440fx, or emulation/*, it
116# returns all board descriptors in that hierarchy.
117function get_mainboards
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000118{
Patrick Georgic2050f02015-10-31 00:35:44 +0100119 local search_space=${1-*/*}
120 grep -h "^[[:space:]]*config\>[[:space:]]*\<BOARD_" \
Patrick Georgif6dc5442015-10-31 09:13:26 +0100121 ${ROOT}/src/mainboard/${search_space}/Kconfig.name 2>/dev/null | \
Patrick Georgic2050f02015-10-31 00:35:44 +0100122 sed "s,^.*\<BOARD_\([A-Z0-9_]*\)\>.*$,\1,"
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000123}
124
Patrick Georgic2050f02015-10-31 00:35:44 +0100125# Given a mainboard descriptor, return its directory below src/mainboard
126function mainboard_directory
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000127{
Patrick Georgic2050f02015-10-31 00:35:44 +0100128 local MAINBOARD=$1
Stefan Reinauer14e22772010-04-27 06:56:47 +0000129
Patrick Georgic2050f02015-10-31 00:35:44 +0100130 grep -l "^[[:space:]]*config\>[[:space:]]*\<BOARD_${MAINBOARD}\>" \
131 ${ROOT}/src/mainboard/*/*/Kconfig.name | \
132 sed "s:^$ROOT/src/mainboard/\(.*\)/Kconfig.name$:\1:"
133}
Stefan Reinauer14e22772010-04-27 06:56:47 +0000134
Patrick Georgic2050f02015-10-31 00:35:44 +0100135# Given a mainboard descriptor, return its vendor (CONFIG_VENDOR_*)
136function mainboard_vendor
137{
138 local MAINBOARD=$1
139
140 local kconfig_file=$( \
141 grep -l "^[[:space:]]*config\>[[:space:]]*\<BOARD_${MAINBOARD}\>" \
142 ${ROOT}/src/mainboard/*/*/Kconfig.name | \
143 sed "s:^\(${ROOT}/src/mainboard/.*\)/.*/\(Kconfig.name\)$:\1/\2:" )
144 if [ ! -f "$kconfig_file" ]; then
145 exit 1
146 fi
147 grep "^[[:space:]]*config\>[[:space:]]*\<VENDOR_" $kconfig_file | \
148 sed "s,^.*\<VENDOR_\([A-Z0-9_]*\)\>.*$,\1,"
149}
150
151# Accepts directory names (eg. emulation/qemu-i440fx) and mainboard
152# descriptors (eg. EMULATION_QEMU_X86_I440F} and returns the latter
153# format.
154# If a directory contains multiple boards, returns them all.
155function normalize_target
156{
Patrick Georgif6dc5442015-10-31 09:13:26 +0100157 local targets=$(get_mainboards $1)
158 if [ -n "$targets" ]; then
159 echo $targets
160 return
Patrick Georgic2050f02015-10-31 00:35:44 +0100161 fi
Patrick Georgif6dc5442015-10-31 09:13:26 +0100162
163 local targets=$(echo $1 | tr ',' ' ')
164 for i in $targets; do
165 if [ -n "$(mainboard_directory $i)" ]; then
166 echo $i
167 else
168 echo "$i is not a valid target" >&2
169 exit 1
170 fi
171 done
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000172}
173
Stefan Reinauer68003b82010-01-30 10:44:28 +0000174function create_config
175{
Patrick Georgic2050f02015-10-31 00:35:44 +0100176 local MAINBOARD=$1
Stefan Reinauer68003b82010-01-30 10:44:28 +0000177
Patrick Georgic2050f02015-10-31 00:35:44 +0100178 local build_dir=$TARGET/${MAINBOARD}
179 local config_file=${build_dir}/config.build
180 local board_srcdir=$(mainboard_directory ${MAINBOARD})
Stefan Reinauer68003b82010-01-30 10:44:28 +0000181
182 # get a working payload for the board if we have one.
Stefan Reinauer14e22772010-04-27 06:56:47 +0000183 # the --payload option expects a directory containing
Stefan Reinauer68003b82010-01-30 10:44:28 +0000184 # a shell script payload.sh
Patrick Georgic2050f02015-10-31 00:35:44 +0100185 # Usage: payload.sh [BOARD]
Stefan Reinauer68003b82010-01-30 10:44:28 +0000186 # the script returns an absolute path to the payload binary.
187
188 if [ -f $payloads/payload.sh ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100189 local PAYLOAD=`sh $payloads/payload.sh $MAINBOARD`
Patrick Georgi80d25262012-09-24 20:52:42 +0200190 if [ $? -gt 0 ]; then
191 echo "problem with payload"
192 exit 1
193 fi
Alexandru Gagniuc0f0d4972014-12-10 16:49:23 -0600194 if [ "$quiet" == "false" ]; then printf "Using payload $PAYLOAD\n"; fi
Patrick Georgic31e3ac2012-10-07 15:05:42 +0200195 elif [ "$payloads" = "none" ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100196 local PAYLOAD=none
Stefan Reinauer68003b82010-01-30 10:44:28 +0000197 fi
198
Stefan Reinauer68003b82010-01-30 10:44:28 +0000199 mkdir -p ${build_dir}
Patrick Georgia2acbc72010-04-16 22:48:57 +0000200 mkdir -p $TARGET/sharedutils
Stefan Reinauer68003b82010-01-30 10:44:28 +0000201
Patrick Georgic2050f02015-10-31 00:35:44 +0100202 if [ "$quiet" == "false" ]; then printf " Creating config file for $MAINBOARD... \n"; fi
203 printf "CONFIG_VENDOR_$(mainboard_vendor ${MAINBOARD})=y\n" > ${config_file}
204 printf "CONFIG_BOARD_${MAINBOARD}=y\n" >> ${config_file}
205 grep "select[\t ]*ARCH" ${ROOT}/src/mainboard/${board_srcdir}/Kconfig | \
206 sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> ${config_file}
207 printf "CONFIG_MAINBOARD_DIR=\"${board_srcdir}\"\n" >> ${config_file}
Patrick Georgie6adabd2015-10-30 22:59:30 +0100208 if [ "$PAYLOAD" = "none" ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100209 printf "CONFIG_PAYLOAD_NONE=y\n" >> ${config_file}
Patrick Georgie6adabd2015-10-30 22:59:30 +0100210 elif [ "$PAYLOAD" != "/dev/null" ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100211 printf "# CONFIG_PAYLOAD_NONE is not set\n" >> ${config_file}
212 printf "# CONFIG_PAYLOAD_SEABIOS is not set\n" >> ${config_file}
213 printf "CONFIG_PAYLOAD_ELF=y\n" >> ${config_file}
214 printf "CONFIG_PAYLOAD_FILE=\"$PAYLOAD\"\n" >> ${config_file}
Stefan Reinauer68003b82010-01-30 10:44:28 +0000215 fi
216
Patrick Georgic2050f02015-10-31 00:35:44 +0100217 if [ "$quiet" == "false" ]; then printf " $MAINBOARD ($customizing)\n"; fi
218 printf "$configoptions" >> ${config_file}
Patrick Georgie6adabd2015-10-30 22:59:30 +0100219
Patrick Georgic2050f02015-10-31 00:35:44 +0100220 yes "" 2>/dev/null | $MAKE oldconfig $silent DOTCONFIG=${config_file} obj=${build_dir} objutil=$TARGET/sharedutils &> ${build_dir}/config.log
Stefan Reinauer68003b82010-01-30 10:44:28 +0000221 ret=$?
Stefan Reinauer68003b82010-01-30 10:44:28 +0000222 if [ $ret -eq 0 ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100223 if [ "$quiet" == "false" ]; then printf " $MAINBOARD config created.\n"; fi
Stefan Reinauer68003b82010-01-30 10:44:28 +0000224 return 0
225 else
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000226 # Does this ever happen?
Patrick Georgic2050f02015-10-31 00:35:44 +0100227 if [ "$quiet" == "false" ]; then printf "$MAINBOARD config creation FAILED!\nLog excerpt:\n"; fi
Stefan Reinauer68003b82010-01-30 10:44:28 +0000228 tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log
229 return 1
230 fi
231}
232
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000233function create_buildenv
234{
Patrick Georgic2050f02015-10-31 00:35:44 +0100235 local MAINBOARD=$1
Stefan Reinauer0ed0b7c2010-03-30 15:49:14 +0000236
Patrick Georgic2050f02015-10-31 00:35:44 +0100237 create_config $MAINBOARD
Stefan Reinauer0ed0b7c2010-03-30 15:49:14 +0000238 ret=$?
Stefan Reinauer86dbe152010-03-25 14:18:57 +0000239
240 # Allow simple "make" in the target directory
Patrick Georgic2050f02015-10-31 00:35:44 +0100241 local MAKEFILE=$TARGET/${MAINBOARD}/Makefile
Stefan Reinauere7a30ee2010-12-11 22:07:07 +0000242 echo "# autogenerated" > $MAKEFILE
Stefan Reinauer86dbe152010-03-25 14:18:57 +0000243 echo "TOP=$ROOT" >> $MAKEFILE
Stefan Reinauere7a30ee2010-12-11 22:07:07 +0000244 echo "BUILD=$TARGET" >> $MAKEFILE
Patrick Georgic2050f02015-10-31 00:35:44 +0100245 echo "OBJ=\$(BUILD)/${MAINBOARD}" >> $MAKEFILE
Stefan Reinauere7a30ee2010-12-11 22:07:07 +0000246 echo "OBJUTIL=\$(BUILD)/sharedutils" >> $MAKEFILE
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000247 echo "all:" >> $MAKEFILE
Stefan Reinauere7a30ee2010-12-11 22:07:07 +0000248 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
Stefan Reinauer0ed0b7c2010-03-30 15:49:14 +0000254
255 return $ret
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000256}
257
258function compile_target
Stefan Reinauer14e22772010-04-27 06:56:47 +0000259{
Patrick Georgidf7cee22015-10-30 23:49:32 +0100260 local MAINBOARD=$1
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000261
Patrick Georgidf7cee22015-10-30 23:49:32 +0100262 if [ "$quiet" == "false" ]; then printf " Compiling $MAINBOARD image$cpuconfig...\n"; fi
Stefan Reinauer02a4e7f2008-05-27 18:29:26 +0000263
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000264 CURR=$( pwd )
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000265 #stime=`perl -e 'print time();' 2>/dev/null || date +%s`
Patrick Georgidf7cee22015-10-30 23:49:32 +0100266 build_dir=$TARGET/${MAINBOARD}
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200267 eval $BUILDPREFIX $MAKE $silent DOTCONFIG=${build_dir}/config.build obj=${build_dir} objutil=$TARGET/sharedutils \
Patrick Georgiabf2ad72010-02-07 21:43:48 +0000268 &> ${build_dir}/make.log
269 ret=$?
Patrick Georgi8e264652011-11-05 12:47:13 +0100270 cp .xcompile ${build_dir}/xcompile.build
Patrick Georgidf7cee22015-10-30 23:49:32 +0100271 cd $TARGET/${MAINBOARD}
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000272
Patrick Georgi68882a32010-02-10 18:08:22 +0000273 etime=`perl -e 'print time();' 2>/dev/null || date +%s`
Stefan Reinauerd8913a42005-12-04 20:35:56 +0000274 duration=$(( $etime - $stime ))
Patrick Georgidf7cee22015-10-30 23:49:32 +0100275 junit " <testcase classname='board${testclass/#/.}' name='$MAINBOARD' time='$duration' >"
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000276
Stefan Reinauere38a1932005-12-04 20:42:37 +0000277 if [ $ret -eq 0 ]; then
Patrick Georgi140a9902011-06-03 21:56:13 +0200278 junit "<system-out>"
279 junitfile make.log
280 junit "</system-out>"
Stefan Reinauer3a140572006-10-25 19:02:34 +0000281 printf "ok\n" > compile.status
Patrick Georgidf7cee22015-10-30 23:49:32 +0100282 printf "$MAINBOARD built successfully. (took ${duration}s)\n"
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000283 else
Patrick Georgib0bc63b2014-05-21 22:47:05 +0200284 ret=1
Patrick Georgi140a9902011-06-03 21:56:13 +0200285 junit "<failure type='BuildFailed'>"
286 junitfile make.log
287 junit "</failure>"
Patrick Georgi8bf5c152015-04-22 18:24:01 +0200288 printf "failed\n" > compile.status
Patrick Georgidf7cee22015-10-30 23:49:32 +0100289 printf "$MAINBOARD build FAILED after ${duration}s!\nLog excerpt:\n"
Patrick Georgia84a99b2009-05-26 14:03:51 +0000290 tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
Patrick Georgif9d19f22011-06-01 19:29:48 +0000291 failed=1
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000292 fi
Patrick Georgib0bc63b2014-05-21 22:47:05 +0200293 cd $CURR
294 if [ $clean_work = "true" ]; then
Patrick Georgidf7cee22015-10-30 23:49:32 +0100295 rm -rf $TARGET/${MAINBOARD}
Patrick Georgib0bc63b2014-05-21 22:47:05 +0200296 fi
297 return $ret
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000298}
299
300function build_target
301{
Patrick Georgic2050f02015-10-31 00:35:44 +0100302 local MAINBOARD=$1
303 local board_srcdir=$(mainboard_directory ${MAINBOARD})
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000304
Patrick Georgic2050f02015-10-31 00:35:44 +0100305 if [ "`cat $TARGET/${MAINBOARD}/compile.status 2>/dev/null`" = "ok" -a \
Patrick Georgi1a5301d2012-11-22 14:19:43 +0100306 "$buildall" = "false" ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100307 printf "Skipping $MAINBOARD; (already successful)\n"
Patrick Georgi1a5301d2012-11-22 14:19:43 +0100308 return
309 fi
310
Stefan Reinauercc44b062009-03-11 15:00:50 +0000311 HOSTCC='gcc'
Eric Biederman709850a2004-11-05 10:48:04 +0000312
Patrick Georgic2050f02015-10-31 00:35:44 +0100313 if [ $chromeos = true -a `grep -c "^[[:space:]]*select[[:space:]]*MAINBOARD_HAS_CHROMEOS\>" ${ROOT}/src/mainboard/${board_srcdir}/Kconfig` -eq 0 ]; then
314 echo "${MAINBOARD} doesn't support Chrome OS, skipping."
Patrick Georgif43b06d2015-07-31 16:26:19 +0200315 return
316 fi
317
Patrick Georgic2050f02015-10-31 00:35:44 +0100318 if [ -f src/mainboard/${board_srcdir}/abuild.disabled ]; then
319 echo "${MAINBOARD} disabled:"
320 cat src/mainboard/${board_srcdir}/abuild.disabled
Patrick Georgi3ac3c4eb2015-07-14 20:20:13 +0200321 return
322 fi
323
Patrick Georgic2050f02015-10-31 00:35:44 +0100324 if [ "$quiet" == "false" ]; then printf "Building $MAINBOARD\n"; fi
325 mkdir -p $TARGET/${MAINBOARD} $TARGET/abuild
Patrick Georgiad273222014-05-21 23:00:32 +0200326 ABSPATH=`cd $TARGET/abuild; pwd`
Patrick Georgic2050f02015-10-31 00:35:44 +0100327 XMLFILE=$ABSPATH/${MAINBOARD}.xml
Patrick Georgi5ab5a392015-10-31 08:53:30 +0100328 rm -f ${XMLFILE}
Stefan Reinauer192b7bc2006-05-27 00:22:02 +0000329
Patrick Georgid2296772009-03-11 15:43:02 +0000330
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000331 stime=`perl -e 'print time();' 2>/dev/null || date +%s`
Patrick Georgic2050f02015-10-31 00:35:44 +0100332 create_buildenv $MAINBOARD
Patrick Georgi02802df2014-10-18 11:57:11 +0200333
Patrick Georgic2050f02015-10-31 00:35:44 +0100334 required_arches=`egrep "^CONFIG_ARCH_(BOOTBLOCK|R.MSTAGE|VERSTAGE)" $TARGET/${MAINBOARD}/config.build | \
Patrick Georgi511f8232014-10-31 16:48:00 +0100335 sed "s,^CONFIG_ARCH_[^_]*_\([^=]*\)=.*$,\1," |sort -u |tr 'A-Z\n\r' 'a-z '`
Patrick Georgi1dda3722014-12-29 15:06:16 +0100336 missing_arches=`printf 'include .xcompile\nall: ; @echo $(foreach arch,'"$required_arches"',$(if $(filter $(arch),$(SUBARCH_SUPPORTED)),,$(arch)))' | make --no-print-directory -f -`
Patrick Georgi02802df2014-10-18 11:57:11 +0200337 if [ -n "$missing_arches" ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100338 printf "skipping $MAINBOARD because we're missing compilers for ($missing_arches)\n"
Patrick Georgi02802df2014-10-18 11:57:11 +0200339 return
340 fi
341
Stefan Reinauercc44b062009-03-11 15:00:50 +0000342 if [ $? -eq 0 -a $configureonly -eq 0 ]; then
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200343 BUILDPREFIX=
Patrick Georgi1cd76e72010-04-19 20:39:22 +0000344 if [ "$scanbuild" = "true" ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100345 scanbuild_out=$TARGET/${MAINBOARD}-scanbuild
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200346 rm -rf ${scanbuild_out}
347 BUILDPREFIX="scan-build -o ${scanbuild_out}tmp"
Patrick Georgi1cd76e72010-04-19 20:39:22 +0000348 fi
Patrick Georgic2050f02015-10-31 00:35:44 +0100349 compile_target ${MAINBOARD}
Patrick Georgid2296772009-03-11 15:43:02 +0000350 if [ "$scanbuild" = "true" ]; then
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200351 mv ${scanbuild_out}tmp/* ${scanbuild_out}
352 rmdir ${scanbuild_out}tmp
Patrick Georgid2296772009-03-11 15:43:02 +0000353 fi
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000354 fi
Stefan Reinauerabdf8482010-03-30 14:02:19 +0000355 # Not calculated here because we still print it in compile_target
356 #etime=`perl -e 'print time();' 2>/dev/null || date +%s`
357 #duration=$(( $etime - $stime ))
Stefan Reinauer2f285ae2004-11-05 14:06:24 +0000358
Patrick Georgi140a9902011-06-03 21:56:13 +0200359 junit "</testcase>"
Stefan Reinauer3a140572006-10-25 19:02:34 +0000360}
361
Uwe Hermann4e006402009-04-15 16:07:27 +0000362function remove_target
363{
364 if [ "$remove" != "true" ]; then
365 return 0
366 fi
367
Patrick Georgi35261c02015-10-30 23:25:23 +0100368 local MAINBOARD=$1
Uwe Hermann4e006402009-04-15 16:07:27 +0000369
370 # Save the generated coreboot.rom file of each board.
Patrick Georgi35261c02015-10-30 23:25:23 +0100371 if [ -r "$TARGET/${MAINBOARD}/coreboot.rom" ]; then
372 cp $TARGET/${MAINBOARD}/coreboot.rom \
373 ${MAINBOARD}_coreboot.rom
Uwe Hermann4e006402009-04-15 16:07:27 +0000374 fi
375
Patrick Georgi35261c02015-10-30 23:25:23 +0100376 printf "Removing build dir for board $MAINBOARD...\n"
377 rm -rf $TARGET/${MAINBOARD}
Uwe Hermann4e006402009-04-15 16:07:27 +0000378
379 return 0
380}
381
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000382function myhelp
383{
Patrick Georgi86980bb2015-07-31 16:14:43 +0200384cat << __END_OF_HELP
385Usage: $0 [-v] [-a] [-b] [-r] [-t <vendor/board>] [-p <dir>] [lbroot]
386 $0 [-V|--version]
387 $0 [-h|--help]
Stefan Reinauerca631202006-11-10 13:30:28 +0000388
Patrick Georgi86980bb2015-07-31 16:14:43 +0200389Options:\n"
390 [-v|--verbose] print more messages
391 [-q|--quiet] print fewer messages
392 [-a|--all] build previously succeeded ports as well
393 [-r|--remove] remove output dir after build
394 [-t|--target <vendor/board>] attempt to build target vendor/board only
395 [-p|--payloads <dir>] use payloads in <dir> to build images
396 [-V|--version] print version number and exit
397 [-h|--help] print this help and exit
398 [-J|--junit] write JUnit formatted xml log file
399 (defaults to $XMLFILE)
400 [-T|--test] submit image(s) to automated test system
401 [-c|--cpus <numcpus>] build on <numcpus> at the same time
402 [-s|--silent] omit compiler calls in logs
403 [-y|--ccache] use ccache
404 [-C|--config] configure-only mode
405 [-l|--loglevel <num>] set loglevel
406 [-u|--update] update existing image
407 [-P|--prefix <name>] file name prefix in CBFS
408 [-B|--blobs] Allow using binary files
409 [-z|--clean] Remove build results when finished
410 [-o|--outdir <path>] store build results in path
411 (defaults to $TARGET)
412 [-L|--clang] Use clang
413 [-x|--chromeos] Build with CHROMEOS enabled
Patrick Georgif43b06d2015-07-31 16:26:19 +0200414 Skip boards without Chrome OS support
Martin Roth21ca9be2015-10-13 12:27:56 -0600415 [-X|--xmlfile <name>] set JUnit XML log file filename
Patrick Georgi86980bb2015-07-31 16:14:43 +0200416 [--scan-build] use clang's static analyzer
417 [cbroot] absolute path to coreboot sources
418 (defaults to $ROOT)
419
420__END_OF_HELP
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000421}
422
Stefan Reinauer14e22772010-04-27 06:56:47 +0000423function myversion
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000424{
425 cat << EOF
426
Stefan Reinauerf8ee1802008-01-18 15:08:58 +0000427coreboot autobuild v$ABUILD_VERSION ($ABUILD_DATE)
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000428
Stefan Reinauer192b7bc2006-05-27 00:22:02 +0000429Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
Stefan Reinauer68003b82010-01-30 10:44:28 +0000430Copyright (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
Stefan Reinauer3a140572006-10-25 19:02:34 +0000431
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000432This program is free software; you may redistribute it under the terms
433of the GNU General Public License. This program has absolutely no
434warranty.
435
436EOF
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000437}
438
439# default options
440target=""
441buildall=false
Stefan Reinauer173f13b2004-11-05 11:57:00 +0000442verbose=false
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000443
Patrick Georgi7e8c9aa2010-04-08 11:37:43 +0000444test -f util/sconfig/sconfig.l && ROOT=$( pwd )
445test -f ../util/sconfig/sconfig.l && ROOT=$( cd ..; pwd )
Stefan Reinauer68003b82010-01-30 10:44:28 +0000446test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
Stefan Reinauer0d4a08e2009-07-01 12:26:11 +0000447
Patrick Georgi92cfe182012-04-05 11:17:01 +0200448# Look if we have getopt. If not, build it.
449export PATH=$PATH:util/abuild
450getopt - > /dev/null 2>/dev/null || gcc -o util/abuild/getopt util/abuild/getopt.c
451
Patrick Georgi43105d62011-11-05 14:44:41 +0100452# command line for xargs parallelization. Thus overwrite -c X
453cmdline="$* -c 1"
454
Stefan Reinauer02a4e7f2008-05-27 18:29:26 +0000455# parse parameters.. try to find out whether we're running GNU getopt
Stefan Reinauer39d4e5f2008-05-28 08:40:23 +0000456getoptbrand="`getopt -V`"
457if [ "${getoptbrand:0:6}" == "getopt" ]; then
458 # Detected GNU getopt that supports long options.
Patrick Georgi85f4b3c2015-10-30 23:05:56 +0100459 args=`getopt -l version,verbose,quiet,help,all,target:,payloads:,cpus:,silent,junit,config,loglevel:,remove,prefix:,update,scan-build,ccache,blobs,clang,clean,outdir:,chromeos,xmlfile: -o Vvqhat:p:c:sJCl:rP:uyBLzo:xX: -- "$@"` || exit 1
Warren Turkal0e8f2042010-09-27 21:14:19 +0000460 eval set -- $args
Stefan Reinauer02a4e7f2008-05-27 18:29:26 +0000461else
462 # Detected non-GNU getopt
Patrick Georgi85f4b3c2015-10-30 23:05:56 +0100463 args=`getopt Vvqhat:p:c:sJCl:rP:uyBLzo:xX: $*`
Stefan Reinauer02a4e7f2008-05-27 18:29:26 +0000464 set -- $args
465fi
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000466
467if [ $? != 0 ]; then
468 myhelp
469 exit 1
470fi
471
Patrick Georgif43b06d2015-07-31 16:26:19 +0200472chromeos=false
Patrick Georgib0bc63b2014-05-21 22:47:05 +0200473clean_work=false
Patrick Georgi64d9a772012-05-01 15:14:46 +0200474customizing=""
475configoptions=""
Patrick Georgi098c4a82015-09-15 16:57:04 +0200476# testclass needs to be undefined if not used for variable expansion to work
477unset testclass
Eric Biedermanc1492102004-11-05 08:50:54 +0000478while true ; do
Eric Biedermanca883c92004-11-05 11:24:57 +0000479 case "$1" in
Patrick Georgi140a9902011-06-03 21:56:13 +0200480 -J|--junit) shift; mode=junit; rm -f $XMLFILE ;;
Stefan Reinauer2f285ae2004-11-05 14:06:24 +0000481 -t|--target) shift; target="$1"; shift;;
Eric Biedermanc1492102004-11-05 08:50:54 +0000482 -a|--all) shift; buildall=true;;
Warren Turkal0e8f2042010-09-27 21:14:19 +0000483 -r|--remove) shift; remove=true;;
Patrick Georgi0ab9d122010-03-25 19:01:27 +0000484 -v|--verbose) shift; verbose=true; silent='V=1';;
Martin Rothddb7a9d2014-12-08 01:57:52 -0700485 -q|--quiet) shift; quiet=true;;
Stefan Reinauerd4c68462004-11-05 11:47:41 +0000486 -V|--version) shift; myversion; exit 0;;
Stefan Reinauer3a140572006-10-25 19:02:34 +0000487 -h|--help) shift; myversion; myhelp; exit 0;;
Stefan Reinauer7fe2b7c2006-09-15 17:00:11 +0000488 -p|--payloads) shift; payloads="$1"; shift;;
Patrick Georgi64d9a772012-05-01 15:14:46 +0200489 -c|--cpus) shift
490 export MAKEFLAGS="-j $1"
Patrick Georgi58955512013-12-05 19:53:04 +0100491 cpus=$1
Martin Rothddb7a9d2014-12-08 01:57:52 -0700492 test "$MAKEFLAGS" == "-j max" && export MAKEFLAGS="-j" && cpuconfig=" in parallel"
493 test "$1" == "1" && cpuconfig=" on 1 cpu"
494 expr "$1" : '-\?[0-9]\+$' > /dev/null && test 0$1 -gt 1 && cpuconfig=" on $1 cpus in parallel"
Patrick Georgi64d9a772012-05-01 15:14:46 +0200495 shift;;
Stefan Reinauer02a4e7f2008-05-27 18:29:26 +0000496 -s|--silent) shift; silent="-s";;
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200497 --scan-build) shift
Patrick Georgi64d9a772012-05-01 15:14:46 +0200498 scanbuild=true
499 customizing="${customizing}, scan-build"
Patrick Georgi64d9a772012-05-01 15:14:46 +0200500 ;;
501 -y|--ccache) shift
502 customizing="${customizing}, ccache"
503 configoptions="${configoptions}CONFIG_CCACHE=y\n"
504 ;;
Stefan Reinauercc44b062009-03-11 15:00:50 +0000505 -C|--config) shift; configureonly=1;;
Patrick Georgi64d9a772012-05-01 15:14:46 +0200506 -l|--loglevel) shift
507 customizing="${customizing}, loglevel $1"
Patrick Georgi64d9a772012-05-01 15:14:46 +0200508 configoptions="${configoptions}CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$1=y\n"
509 configoptions="${configoptions}CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$1\n"
510 shift;;
511 -u|--update) shift
512 customizing="${customizing}, update"
513 configoptions="${configoptions}CONFIG_UPDATE_IMAGE=y\n"
514 ;;
515 -P|--prefix) shift
516 customizing="${customizing}, cbfs prefix $1"
517 configoptions="${configoptions}CONFIG_CBFS_PREFIX=\"$1\""
518 shift;;
519 -B|--blobs) shift
520 customizing="${customizing}, blobs"
521 configoptions="${configoptions}CONFIG_USE_BLOBS=y\n"
522 ;;
Patrick Georgie9fe6542014-05-14 13:43:58 +0200523 -L|--clang) shift
524 customizing="${customizing}, clang"
Patrick Georgi02ac6c32014-11-28 23:08:51 +0100525 configoptions="${configoptions}CONFIG_COMPILER_LLVM_CLANG=y\n# CONFIG_COMPILER_GCC is not set\n"
Patrick Georgie9fe6542014-05-14 13:43:58 +0200526 ;;
Patrick Georgib0bc63b2014-05-21 22:47:05 +0200527 -z|--clean) shift
528 customizing="${customizing}, clean"
529 clean_work=true
530 ;;
Patrick Georgiad273222014-05-21 23:00:32 +0200531 -o|--outdir) shift
532 TARGET=$1; shift
533 ;;
Patrick Georgidd787362015-04-22 18:38:10 +0200534 -x|--chromeos) shift
Patrick Georgif43b06d2015-07-31 16:26:19 +0200535 chromeos=true
Patrick Georgi58474df2015-07-31 16:30:04 +0200536 testclass=chromeos
Patrick Georgif43b06d2015-07-31 16:26:19 +0200537 customizing="${customizing}, chrome os"
Patrick Georgidd787362015-04-22 18:38:10 +0200538 configoptions="${configoptions}CONFIG_CHROMEOS=y\n"
539 ;;
Martin Roth21ca9be2015-10-13 12:27:56 -0600540 -X|--xmlfile) shift; XMLFILE=$1; REAL_XMLFILE=$1; shift;;
Eric Biedermanc1492102004-11-05 08:50:54 +0000541 --) shift; break;;
Stefan Reinauer3a140572006-10-25 19:02:34 +0000542 -*) printf "Invalid option\n\n"; myhelp; exit 1;;
Eric Biedermanca883c92004-11-05 11:24:57 +0000543 *) break;;
Eric Biedermanc1492102004-11-05 08:50:54 +0000544 esac
Stefan Reinauer9f12caa2004-10-19 07:00:47 +0000545done
546
Patrick Georgiad273222014-05-21 23:00:32 +0200547if [ -z "$TARGET" -o "$TARGET" = "/" ]; then
548 echo "Please specify a valid, non-root build directory."
549 exit 1
550fi
551
Patrick Georgi64d9a772012-05-01 15:14:46 +0200552customizing=`echo $customizing |cut -c3-`
553if [ "$customizing" = "" ]; then
554 customizing="default configuration"
555fi
556
Patrick Georgi43105d62011-11-05 14:44:41 +0100557USE_XARGS=0
Patrick Georgif49f7c82011-11-05 12:55:18 +0100558if [ "$cpus" != "1" ]; then
Patrick Georgi58955512013-12-05 19:53:04 +0100559 # Limit to 32 parallel builds for now.
560 # Thrashing all caches because we run
561 # 160 abuilds in parallel is no fun.
562 if [ "$cpus" = "max" ]; then
563 cpus=32
564 fi
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100565 # Test if xargs supports the non-standard -P flag
566 # FIXME: disabled until we managed to eliminate all the make(1) quirks
567 echo | xargs -P ${cpus:-0} -n 1 echo 2>/dev/null >/dev/null && USE_XARGS=1
Patrick Georgi43105d62011-11-05 14:44:41 +0100568fi
569
570if [ "$USE_XARGS" = "0" ]; then
Raymond Danksc95da252012-05-30 16:03:48 -0600571test "$MAKEFLAGS" == "" && test "$cpus" != "" && export MAKEFLAGS="-j $cpus"
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100572build_targets()
Patrick Georgi43105d62011-11-05 14:44:41 +0100573{
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100574 local targets=${*-$(get_mainboards)}
575 for MAINBOARD in $targets; do
576 build_target ${MAINBOARD}
Patrick Georgic2050f02015-10-31 00:35:44 +0100577 remove_target ${MAINBOARD}
Patrick Georgi43105d62011-11-05 14:44:41 +0100578 done
579}
580else
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100581build_targets()
Patrick Georgi43105d62011-11-05 14:44:41 +0100582{
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100583 local targets=${*-$(get_mainboards)}
Patrick Georgi43105d62011-11-05 14:44:41 +0100584 # seed shared utils
585 TMPCFG=`mktemp`
Patrick Georgi02ac6c32014-11-28 23:08:51 +0100586 printf "$configoptions" > $TMPCFG
Patrick Georgi443fbcf2014-05-17 18:24:45 +0200587 $MAKE -j $cpus DOTCONFIG=$TMPCFG obj=$TARGET/temp objutil=$TARGET/sharedutils allnoconfig
Patrick Georgi02ac6c32014-11-28 23:08:51 +0100588 printf "$configoptions" >> $TMPCFG
Patrick Georgi1d915ca2015-07-31 16:46:55 +0200589 yes "" 2>/dev/null | $MAKE -j $cpus DOTCONFIG=$TMPCFG obj=$TARGET/temp objutil=$TARGET/sharedutils oldconfig 2>/dev/null |head > /dev/null
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200590 BUILDPREFIX=
591 if [ "$scanbuild" = "true" ]; then
592 scanbuild_out=$TARGET/sharedutils-scanbuild
593 rm -rf ${scanbuild_out}
594 BUILDPREFIX="scan-build -o ${scanbuild_out}tmp"
595 fi
Patrick Georgi053322f2015-09-15 17:30:52 +0200596 mkdir -p $TARGET/abuild
597 local ABSPATH=`cd $TARGET/abuild; pwd`
598 local XMLFILE=$ABSPATH/__util.xml
Patrick Georgi5ab5a392015-10-31 08:53:30 +0100599 rm -f ${XMLFILE}
Patrick Georgi053322f2015-09-15 17:30:52 +0200600 local stime=`perl -e 'print time();' 2>/dev/null || date +%s`
601 $BUILDPREFIX $MAKE -j $cpus DOTCONFIG=$TMPCFG obj=$TARGET/temp objutil=$TARGET/sharedutils tools > $TARGET/sharedutils/make.log 2>&1
602 local ret=$?
603 local etime=`perl -e 'print time();' 2>/dev/null || date +%s`
604 local duration=$(( $etime - $stime ))
605
606 junit " <testcase classname='util' name='all' time='$duration' >"
607 if [ $ret -eq 0 ]; then
608 junit "<system-out>"
609 junitfile $TARGET/sharedutils/make.log
610 junit "</system-out>"
611 junit "</testcase>"
612 else
613 junit "<failure type='BuildFailed'>"
614 junitfile $TARGET/sharedutils/make.log
615 junit "</failure>"
616 junit "</testcase>"
617 return
618 fi
619 if [ $ret -eq 1 ]; then
620 return
621 fi
622
Patrick Georgifadbe5f2014-05-17 18:26:38 +0200623 if [ "$scanbuild" = "true" ]; then
624 mv ${scanbuild_out}tmp/* ${scanbuild_out}
625 rmdir ${scanbuild_out}tmp
626 fi
Patrick Georgi443fbcf2014-05-17 18:24:45 +0200627 rm -rf $TARGET/temp $TMPCFG
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100628 echo $targets | xargs -P ${cpus:-0} -n 1 $0 $cmdline -t
Patrick Georgi43105d62011-11-05 14:44:41 +0100629}
Patrick Georgif49f7c82011-11-05 12:55:18 +0100630fi
631
Stefan Reinauer68003b82010-01-30 10:44:28 +0000632test -z "$1" || ROOT=$1
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000633
Stefan Reinauer68003b82010-01-30 10:44:28 +0000634debug "ROOT=$ROOT"
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000635
Patrick Georgi140a9902011-06-03 21:56:13 +0200636junit '<?xml version="1.0" encoding="utf-8"?>'
637junit '<testsuite>'
638
Stefan Reinauer3779f6a2004-11-05 00:26:31 +0000639if [ "$target" != "" ]; then
Eric Biederman709850a2004-11-05 10:48:04 +0000640 # build a single board
Patrick Georgic2050f02015-10-31 00:35:44 +0100641 MAINBOARD=$(normalize_target ${target})
642 if [ -z "${MAINBOARD}" ]; then
Stefan Reinauer002c9ff2010-03-29 16:23:42 +0000643 printf "No such target: $target\n"
Patrick Georgic2050f02015-10-31 00:35:44 +0100644 exit 1
645 fi
646 build_srcdir=$(mainboard_directory ${MAINBOARD})
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100647 if [ "$(echo ${MAINBOARD} | wc -w)" -gt 1 ]; then
648 build_targets ${MAINBOARD}
649 elif [ ! -r $ROOT/src/mainboard/${build_srcdir} ]; then
Patrick Georgic2050f02015-10-31 00:35:44 +0100650 printf "No such target: ${MAINBOARD}\n"
651 exit 1
Patrick Georgi43105d62011-11-05 14:44:41 +0100652 else
Patrick Georgic2050f02015-10-31 00:35:44 +0100653 build_target ${MAINBOARD}
654 remove_target ${MAINBOARD}
Patrick Georgia0e77382015-09-15 19:32:28 +0200655 test "$mode" != "text" && \
Patrick Georgic2050f02015-10-31 00:35:44 +0100656 test -f $TARGET/abuild/${MAINBOARD}.xml && \
657 cat $TARGET/abuild/${MAINBOARD}.xml >> $REAL_XMLFILE
Patrick Georgi43105d62011-11-05 14:44:41 +0100658 XMLFILE=$REAL_XMLFILE
Stefan Reinauer002c9ff2010-03-29 16:23:42 +0000659 fi
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000660else
Patrick Georgi0c65dcc2015-10-31 00:42:50 +0100661 build_targets
Patrick Georgi43105d62011-11-05 14:44:41 +0100662 rm -f $REAL_XMLFILE
Patrick Georgi92ff9342012-05-21 20:10:04 +0200663 XMLFILE=$REAL_XMLFILE
Patrick Georgi43105d62011-11-05 14:44:41 +0100664 junit '<?xml version="1.0" encoding="utf-8"?>'
665 junit '<testsuite>'
Patrick Georgi3fd44c32011-11-07 19:01:54 +0100666 if [ "$mode" != "text" ]; then
Patrick Georgid03d69b2013-12-19 20:13:23 +0100667 for xmlfile in $TARGET/abuild/*_*.xml; do
Patrick Georgi3fd44c32011-11-07 19:01:54 +0100668 cat $xmlfile >> $REAL_XMLFILE
669 done
670 fi
Patrick Georgi3db85f32011-11-05 13:21:14 +0100671 XMLFILE=$REAL_XMLFILE
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000672fi
Patrick Georgi140a9902011-06-03 21:56:13 +0200673junit '</testsuite>'
Stefan Reinauerd87ce962004-11-05 00:25:19 +0000674
Patrick Georgif9d19f22011-06-01 19:29:48 +0000675exit $failed