2004-10-19 09:00:47 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2008-01-18 16:08:58 +01:00
|
|
|
# coreboot autobuild
|
2004-10-19 09:00:47 +02:00
|
|
|
#
|
2008-01-18 16:08:58 +01:00
|
|
|
# This script builds coreboot images for all available targets.
|
2004-10-19 09:00:47 +02:00
|
|
|
#
|
|
|
|
# (C) 2004 by Stefan Reinauer <stepan@openbios.org>
|
2010-01-30 11:44:28 +01:00
|
|
|
# (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
|
2004-10-19 09:00:47 +02:00
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU General
|
|
|
|
# Public License. See the file COPYING in the main directory of this
|
|
|
|
# archive for more details.
|
|
|
|
#
|
|
|
|
|
2004-11-05 09:50:54 +01:00
|
|
|
#set -x # Turn echo on....
|
2004-10-21 23:41:57 +02:00
|
|
|
|
2010-01-30 11:44:28 +01:00
|
|
|
ABUILD_DATE="January 29th, 2010"
|
|
|
|
ABUILD_VERSION="0.9"
|
2006-10-25 21:02:34 +02:00
|
|
|
|
2004-10-21 23:41:57 +02:00
|
|
|
# Where shall we place all the build trees?
|
2008-01-18 16:08:58 +01:00
|
|
|
TARGET=$( pwd )/coreboot-builds
|
2006-05-27 02:22:02 +02:00
|
|
|
XMLFILE=$( pwd )/abuild.xml
|
2004-10-19 09:00:47 +02:00
|
|
|
|
2004-10-21 23:41:57 +02:00
|
|
|
# path to payload. Should be more generic
|
2004-11-04 12:04:33 +01:00
|
|
|
PAYLOAD=/dev/null
|
2004-10-21 23:41:57 +02:00
|
|
|
|
|
|
|
# Lines of error context to be printed in FAILURE case
|
|
|
|
CONTEXT=5
|
|
|
|
|
2008-01-18 16:08:58 +01:00
|
|
|
TESTSUBMISSION="http://qa.coreboot.org/deployment/send.php"
|
2006-10-25 21:02:34 +02:00
|
|
|
|
2008-05-27 20:29:26 +02:00
|
|
|
# Number of CPUs to compile on per default
|
|
|
|
cpus=1
|
|
|
|
|
2009-03-11 16:00:50 +01:00
|
|
|
# Configure-only mode
|
|
|
|
configureonly=0
|
|
|
|
|
2004-10-21 23:41:57 +02:00
|
|
|
# One might want to adjust these in case of cross compiling
|
2009-05-26 16:03:51 +02:00
|
|
|
for i in make gmake gnumake nonexistant_make; do
|
|
|
|
$i --version 2>/dev/null |grep "GNU Make" >/dev/null && break
|
|
|
|
done
|
|
|
|
if [ "$i" = "nonexistant_make" ]; then
|
|
|
|
echo No GNU Make found.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
MAKE=$i
|
2004-10-19 09:00:47 +02:00
|
|
|
|
2006-05-27 02:22:02 +02:00
|
|
|
# this can be changed to xml by -x
|
|
|
|
mode=text
|
|
|
|
|
2008-05-27 20:29:26 +02:00
|
|
|
# silent mode.. no compiler calls, only warnings in the log files.
|
|
|
|
# this is disabled per default but can be enabled with -s
|
|
|
|
silent=
|
|
|
|
|
2009-03-11 16:43:02 +01:00
|
|
|
# clang mode enabled by -sb option.
|
|
|
|
scanbuild=false
|
|
|
|
|
2008-09-30 19:09:44 +02:00
|
|
|
# stackprotect mode enabled by -ns option.
|
|
|
|
stackprotect=false
|
|
|
|
|
2009-04-21 22:31:18 +02:00
|
|
|
# loglevel changed with -l / --loglevel option
|
|
|
|
loglevel=default
|
|
|
|
|
2004-10-19 09:00:47 +02:00
|
|
|
ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
|
2009-03-11 16:00:50 +01:00
|
|
|
-e s/i86pc/i386/ \
|
2004-10-19 09:00:47 +02:00
|
|
|
-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
|
|
|
|
-e "s/Power Macintosh/ppc/"`
|
|
|
|
|
2006-10-25 21:02:34 +02:00
|
|
|
trap interrupt INT
|
|
|
|
|
|
|
|
function interrupt
|
|
|
|
{
|
|
|
|
printf "\n$0: execution interrupted manually.\n"
|
|
|
|
if [ "$mode" == "xml" ]; then
|
|
|
|
printf "$0: deleting incomplete xml output file.\n"
|
|
|
|
fi
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2004-11-05 12:57:00 +01:00
|
|
|
function debug
|
|
|
|
{
|
2006-10-25 21:02:34 +02:00
|
|
|
test "$verbose" == "true" && printf "$*\n"
|
2004-11-05 12:57:00 +01:00
|
|
|
}
|
2004-11-05 20:55:06 +01:00
|
|
|
|
2006-05-27 02:22:02 +02:00
|
|
|
function xml
|
|
|
|
{
|
2006-10-25 21:02:34 +02:00
|
|
|
test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
|
2006-05-27 02:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function xmlfile
|
|
|
|
{
|
2006-10-25 21:02:34 +02:00
|
|
|
test "$mode" == "xml" && {
|
|
|
|
printf '<![CDATA[\n'
|
|
|
|
cat $1
|
|
|
|
printf ']]>\n'
|
|
|
|
} >> $XMLFILE
|
2006-05-27 02:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-10-19 09:00:47 +02:00
|
|
|
function vendors
|
|
|
|
{
|
|
|
|
# make this a function so we can easily select
|
|
|
|
# without breaking readability
|
2010-01-30 11:44:28 +01:00
|
|
|
ls -1 "$ROOT/src/mainboard" | grep -v Kconfig | grep -v Makefile
|
2004-10-19 09:00:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function mainboards
|
|
|
|
{
|
|
|
|
# make this a function so we can easily select
|
|
|
|
# without breaking readability
|
|
|
|
|
|
|
|
VENDOR=$1
|
|
|
|
|
2010-01-30 11:44:28 +01:00
|
|
|
ls -1 $ROOT/src/mainboard/$VENDOR | grep -v Kconfig
|
2004-10-19 09:00:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function architecture
|
|
|
|
{
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
2010-02-07 22:43:48 +01:00
|
|
|
ARCH=`cat $ROOT/src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
|
|
|
|
grep "select ARCH_"|cut -f2- -d_`
|
|
|
|
echo $ARCH | sed s/X86/i386/
|
2004-10-19 09:00:47 +02:00
|
|
|
}
|
|
|
|
|
2010-01-30 11:44:28 +01:00
|
|
|
function create_config
|
|
|
|
{
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
|
|
|
CONFIG=$3
|
|
|
|
|
|
|
|
build_dir=$TARGET/${VENDOR}_${MAINBOARD}
|
|
|
|
|
|
|
|
# get a working payload for the board if we have one.
|
|
|
|
# the --payload option expects a directory containing
|
|
|
|
# a shell script payload.sh
|
|
|
|
# Usage: payload.sh [VENDOR] [DEVICE]
|
|
|
|
# the script returns an absolute path to the payload binary.
|
|
|
|
|
|
|
|
if [ -f $payloads/payload.sh ]; then
|
|
|
|
PAYLOAD=`sh $payloads/payload.sh $VENDOR $MAINBOARD`
|
|
|
|
printf "Using payload $PAYLOAD\n"
|
|
|
|
fi
|
|
|
|
|
2010-03-24 23:39:40 +01:00
|
|
|
$MAKE distclean O=${build_dir}
|
2010-01-30 11:44:28 +01:00
|
|
|
mkdir -p ${build_dir}
|
|
|
|
|
|
|
|
if [ "$CONFIG" != "" ]; then
|
|
|
|
printf " Using existing configuration $CONFIG ... "
|
|
|
|
xml " <config>$CONFIG</config>"
|
|
|
|
cp $CONFIG .config
|
|
|
|
else
|
|
|
|
printf " Creating config file... "
|
|
|
|
xml " <config>autogenerated</config>"
|
|
|
|
grep "depends[\t ]on[\t ]*VENDOR" src/mainboard/$VENDOR/$MAINBOARD/../Kconfig | \
|
|
|
|
sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > .config
|
|
|
|
grep "config[\t ]*BOARD" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
|
|
|
|
sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
|
|
|
|
grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
|
|
|
|
sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
|
|
|
|
echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> .config
|
|
|
|
if [ "$PAYLOAD" != "/dev/null" ]; then
|
|
|
|
echo "# CONFIG_PAYLOAD_NONE is not set" >> .config
|
2010-02-22 07:09:43 +01:00
|
|
|
echo "CONFIG_PAYLOAD_ELF=y" >> .config
|
|
|
|
echo "CONFIG_FALLBACK_PAYLOAD_FILE=\"$PAYLOAD\"" >> .config
|
2010-01-30 11:44:28 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$loglevel" != "default" ]; then
|
|
|
|
printf "(loglevel override) "
|
2010-02-22 07:09:43 +01:00
|
|
|
echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y" >> .config
|
|
|
|
echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel" >> .config
|
|
|
|
echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y" >> .config
|
|
|
|
echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config
|
2010-01-30 11:44:28 +01:00
|
|
|
fi
|
2010-03-14 22:25:03 +01:00
|
|
|
|
|
|
|
if [ "$scanbuild" = "true" ]; then
|
|
|
|
printf "(scan-build enabled) "
|
|
|
|
echo "CONFIG_SCANBUILD_ENABLE=y" >> .config
|
|
|
|
echo "CONFIG_SCANBUILD_REPORT_LOCATION=\"$TARGET/scan-build-results-tmp\"" >> .config
|
|
|
|
fi
|
2010-01-30 11:44:28 +01:00
|
|
|
fi
|
|
|
|
|
2010-03-24 23:39:40 +01:00
|
|
|
yes "" | $MAKE oldconfig O=${build_dir} > ${build_dir}/config.log
|
2010-01-30 11:44:28 +01:00
|
|
|
ret=$?
|
|
|
|
mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in
|
|
|
|
if [ $ret -eq 0 ]; then
|
|
|
|
printf "ok\n"
|
|
|
|
xml " <builddir>ok</builddir>"
|
|
|
|
xml " <log>"
|
|
|
|
xmlfile $build_dir/config.log
|
|
|
|
xml " </log>"
|
|
|
|
xml ""
|
|
|
|
return 0
|
|
|
|
else
|
|
|
|
printf "FAILED! Log excerpt:\n"
|
|
|
|
xml " <builddir>failed</builddir>"
|
|
|
|
xml " <log>"
|
|
|
|
xmlfile $build_dir/config.log
|
|
|
|
xml " </log>"
|
|
|
|
xml ""
|
|
|
|
tail -n $CONTEXT $build_dir/config.log 2> /dev/null || tail -$CONTEXT $build_dir/config.log
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2004-10-19 09:00:47 +02:00
|
|
|
function create_buildenv
|
|
|
|
{
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
2009-04-23 01:39:19 +02:00
|
|
|
CONFIG=$3
|
2010-02-07 22:43:48 +01:00
|
|
|
create_config $VENDOR $MAINBOARD $CONFIG
|
2010-03-25 15:18:57 +01:00
|
|
|
|
|
|
|
# Allow simple "make" in the target directory
|
|
|
|
MAKEFILE=$TARGET/${VENDOR}_${MAINBOARD}/Makefile
|
|
|
|
echo "# autogenerated makefile" > $MAKEFILE
|
|
|
|
echo "TOP=$ROOT" >> $MAKEFILE
|
|
|
|
echo "OUT=$TARGET/${VENDOR}_${MAINBOARD}" >> $MAKEFILE
|
|
|
|
echo "coreboot.rom:" >> $MAKEFILE
|
|
|
|
echo " cp config.build \$(TOP)/.config" >> $MAKEFILE
|
|
|
|
echo " cd \$(TOP); \$(MAKE) oldconfig O=\$(OUT)" >> $MAKEFILE
|
|
|
|
echo " cd \$(TOP); \$(MAKE) O=\$(OUT)" >> $MAKEFILE
|
2004-10-19 09:00:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function compile_target
|
|
|
|
{
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
|
|
|
|
2008-05-27 20:29:26 +02:00
|
|
|
printf " Compiling image "
|
|
|
|
test "$cpus" == "" && printf "in parallel .. "
|
|
|
|
test "$cpus" == "1" && printf "on 1 cpu .. "
|
|
|
|
test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus
|
|
|
|
|
2004-10-19 09:00:47 +02:00
|
|
|
CURR=$( pwd )
|
2010-02-10 19:08:22 +01:00
|
|
|
stime=`perl -e 'print time();' 2>/dev/null || date +%s`
|
2010-02-07 22:43:48 +01:00
|
|
|
build_dir=$TARGET/${VENDOR}_${MAINBOARD}
|
2010-03-24 23:39:40 +01:00
|
|
|
eval $MAKE $silent -j $cpus O=${build_dir} \
|
2010-02-07 22:43:48 +01:00
|
|
|
&> ${build_dir}/make.log
|
|
|
|
ret=$?
|
|
|
|
mv .config ${build_dir}/config.build
|
|
|
|
mv .xcompile ${build_dir}/xcompile.build
|
|
|
|
cd $TARGET/${VENDOR}_${MAINBOARD}
|
2010-02-10 19:08:22 +01:00
|
|
|
etime=`perl -e 'print time();' 2>/dev/null || date +%s`
|
2005-12-04 21:35:56 +01:00
|
|
|
duration=$(( $etime - $stime ))
|
2005-12-04 21:42:37 +01:00
|
|
|
if [ $ret -eq 0 ]; then
|
2006-05-27 02:22:02 +02:00
|
|
|
xml " <compile>ok</compile>"
|
|
|
|
xml " <compiletime>${duration}s</compiletime>"
|
2009-03-13 18:22:53 +01:00
|
|
|
xml " <log>"
|
|
|
|
xmlfile make.log
|
|
|
|
xml " </log>"
|
2006-10-25 21:02:34 +02:00
|
|
|
printf "ok\n" > compile.status
|
|
|
|
printf "ok. (took ${duration}s)\n"
|
2004-10-19 09:00:47 +02:00
|
|
|
cd $CURR
|
2004-11-04 12:04:33 +01:00
|
|
|
return 0
|
2004-10-19 09:00:47 +02:00
|
|
|
else
|
2006-05-27 02:22:02 +02:00
|
|
|
xml " <compile>failed</compile>"
|
|
|
|
xml " <compiletime>${duration}s</compiletime>"
|
|
|
|
xml " <log>"
|
|
|
|
xmlfile make.log
|
|
|
|
xml " </log>"
|
|
|
|
|
2006-10-25 21:02:34 +02:00
|
|
|
printf "FAILED after ${duration}s! Log excerpt:\n"
|
2009-05-26 16:03:51 +02:00
|
|
|
tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
|
2004-10-19 09:00:47 +02:00
|
|
|
cd $CURR
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2004-11-04 12:04:33 +01:00
|
|
|
function built_successfully
|
|
|
|
{
|
|
|
|
CURR=`pwd`
|
|
|
|
status="fail"
|
2004-11-05 01:25:19 +01:00
|
|
|
if [ -d "$TARGET/${VENDOR}_${MAINBOARD}" ]; then
|
|
|
|
cd $TARGET/${VENDOR}_${MAINBOARD}
|
|
|
|
if [ -r compile.status ] ; then
|
|
|
|
status=`cat compile.status`
|
|
|
|
fi
|
|
|
|
cd $CURR
|
2004-11-04 12:04:33 +01:00
|
|
|
fi
|
2004-11-05 01:25:19 +01:00
|
|
|
[ "$buildall" != "true" -a "$status" == "ok" ]
|
2004-11-04 12:04:33 +01:00
|
|
|
}
|
2004-11-05 12:47:41 +01:00
|
|
|
|
|
|
|
function build_broken
|
|
|
|
{
|
|
|
|
CURR=`pwd`
|
|
|
|
status="yes"
|
2010-01-30 11:44:28 +01:00
|
|
|
[ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no"
|
2004-11-05 12:47:41 +01:00
|
|
|
[ "$buildbroken" == "true" -o "$status" == "yes" ]
|
|
|
|
}
|
|
|
|
|
2004-10-19 09:00:47 +02:00
|
|
|
function build_target
|
|
|
|
{
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
2009-04-23 01:39:19 +02:00
|
|
|
CONFIG=$3
|
2004-10-19 09:00:47 +02:00
|
|
|
TARCH=$( architecture $VENDOR $MAINBOARD )
|
2004-11-05 01:25:19 +01:00
|
|
|
|
2009-04-11 01:02:48 +02:00
|
|
|
# Allow architecture override in an abuild.info file.
|
|
|
|
# This is used for the Motorola Sandpoint, which is not a real target
|
|
|
|
# but a skeleton target for the Sandpoint X3.
|
2010-01-30 11:44:28 +01:00
|
|
|
[ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
|
|
|
|
source $ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
|
2009-04-11 01:02:48 +02:00
|
|
|
|
2004-11-05 01:25:19 +01:00
|
|
|
# default setting
|
2008-05-27 20:29:26 +02:00
|
|
|
|
2009-03-11 16:00:50 +01:00
|
|
|
CC="${CROSS_COMPILE}gcc"
|
|
|
|
CROSS_COMPILE=""
|
|
|
|
found_crosscompiler=false
|
|
|
|
if which $TARCH-elf-gcc 2>/dev/null >/dev/null; then
|
|
|
|
# i386-elf target needs --divide, for i386-linux, that's the default
|
|
|
|
if [ "$TARCH" = "i386" ]; then
|
|
|
|
CC="$CC -Wa,--divide"
|
|
|
|
fi
|
2008-05-27 20:29:26 +02:00
|
|
|
CROSS_COMPILE="$TARCH-elf-"
|
2009-06-06 09:19:53 +02:00
|
|
|
CC=gcc
|
2009-04-04 20:16:11 +02:00
|
|
|
echo using $CROSS_COMPILE$CC
|
2009-03-11 16:00:50 +01:00
|
|
|
found_crosscompiler=true
|
2008-05-27 20:29:26 +02:00
|
|
|
fi
|
2009-03-11 16:43:02 +01:00
|
|
|
|
2009-03-11 16:00:50 +01:00
|
|
|
HOSTCC='gcc'
|
2004-11-05 11:48:04 +01:00
|
|
|
|
2006-10-25 21:02:34 +02:00
|
|
|
printf "Processing mainboard/$VENDOR/$MAINBOARD"
|
2006-05-27 02:22:02 +02:00
|
|
|
|
|
|
|
xml "<mainboard>"
|
|
|
|
xml ""
|
|
|
|
xml " <vendor>$VENDOR</vendor>"
|
|
|
|
xml " <device>$MAINBOARD</device>"
|
|
|
|
xml ""
|
|
|
|
xml " <architecture>$TARCH</architecture>"
|
|
|
|
xml ""
|
2009-04-11 01:02:48 +02:00
|
|
|
|
2009-03-11 16:00:50 +01:00
|
|
|
if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then
|
2006-10-25 21:02:34 +02:00
|
|
|
printf " ($TARCH: ok)\n"
|
2004-11-05 01:25:19 +01:00
|
|
|
else
|
|
|
|
found_crosscompiler=false
|
|
|
|
if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
|
|
|
|
CC="gcc -m32"
|
|
|
|
found_crosscompiler=true
|
|
|
|
fi
|
|
|
|
if [ "$ARCH" == ppc64 -a "$TARCH" == ppc ]; then
|
|
|
|
CC="gcc -m32"
|
|
|
|
found_crosscompiler=true
|
2004-10-19 09:00:47 +02:00
|
|
|
fi
|
2004-11-06 00:19:46 +01:00
|
|
|
if [ "$found_crosscompiler" == "false" -a "$TARCH" == ppc ];then
|
|
|
|
for prefix in powerpc-eabi- powerpc-linux- ppc_74xx- \
|
2009-03-14 17:33:22 +01:00
|
|
|
powerpc-7450-linux-gnu- powerpc-elf-; do
|
2004-11-05 11:48:04 +01:00
|
|
|
if ${prefix}gcc --version > /dev/null 2> /dev/null ; then
|
|
|
|
found_crosscompiler=true
|
|
|
|
CROSS_COMPILE=$prefix
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2004-11-04 12:04:33 +01:00
|
|
|
|
2006-06-26 18:51:06 +02:00
|
|
|
|
2004-11-05 01:25:19 +01:00
|
|
|
# TBD: look for suitable cross compiler suite
|
|
|
|
# cross-$TARCH-gcc and cross-$TARCH-ld
|
|
|
|
|
|
|
|
# Check result:
|
|
|
|
if [ $found_crosscompiler == "false" ]; then
|
2006-10-25 21:02:34 +02:00
|
|
|
printf " ($TARCH: skipped, we're $ARCH)\n\n"
|
2006-06-26 18:51:06 +02:00
|
|
|
xml " <status>notbuilt</status>"
|
|
|
|
xml ""
|
|
|
|
xml "</mainboard>"
|
|
|
|
|
2004-11-05 01:25:19 +01:00
|
|
|
return 0
|
2004-11-05 11:48:04 +01:00
|
|
|
else
|
2009-03-15 10:55:17 +01:00
|
|
|
printf " ($TARCH: ok, we're $ARCH with a ${CROSS_COMPILE} cross compiler)\n"
|
2006-06-26 18:51:06 +02:00
|
|
|
xml " <compiler>"
|
|
|
|
xml " <path>`which ${CROSS_COMPILE}gcc`</path>"
|
|
|
|
xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
|
|
|
|
xml " </compiler>"
|
|
|
|
xml ""
|
2004-11-05 01:25:19 +01:00
|
|
|
fi
|
|
|
|
fi
|
2004-11-05 20:55:06 +01:00
|
|
|
|
2009-03-15 10:55:17 +01:00
|
|
|
CC=${CROSS_COMPILE}$CC
|
|
|
|
|
2009-03-11 16:43:02 +01:00
|
|
|
if [ "$stackprotect" = "true" ]; then
|
|
|
|
CC="$CC -fno-stack-protector"
|
|
|
|
fi
|
|
|
|
|
2004-11-05 12:47:41 +01:00
|
|
|
built_successfully $VENDOR $MAINBOARD && \
|
|
|
|
{
|
2006-10-25 21:02:34 +02:00
|
|
|
printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n"
|
2006-05-27 02:22:02 +02:00
|
|
|
xml " <status>previouslyok</status>"
|
|
|
|
xml ""
|
|
|
|
xml "</mainboard>"
|
2004-11-05 12:47:41 +01:00
|
|
|
return 0
|
|
|
|
}
|
2004-11-05 20:55:06 +01:00
|
|
|
|
2004-11-05 12:47:41 +01:00
|
|
|
build_broken $VENDOR $MAINBOARD || \
|
|
|
|
{
|
2006-10-25 21:02:34 +02:00
|
|
|
printf " ( broken mainboard/$VENDOR/$MAINBOARD skipped )\n\n"
|
2006-05-27 02:22:02 +02:00
|
|
|
xml " <status>knownbroken</status>"
|
|
|
|
xml ""
|
|
|
|
xml "</mainboard>"
|
2004-11-05 12:47:41 +01:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2009-04-23 01:39:19 +02:00
|
|
|
create_buildenv $VENDOR $MAINBOARD $CONFIG
|
2009-03-11 16:00:50 +01:00
|
|
|
if [ $? -eq 0 -a $configureonly -eq 0 ]; then
|
2006-05-27 02:22:02 +02:00
|
|
|
compile_target $VENDOR $MAINBOARD &&
|
2006-10-25 21:02:34 +02:00
|
|
|
xml " <status>ok</status>" ||
|
2006-05-27 02:22:02 +02:00
|
|
|
xml "<status>broken</status>"
|
2009-03-11 16:43:02 +01:00
|
|
|
if [ "$scanbuild" = "true" ]; then
|
|
|
|
mv `dirname $TARGET/scan-build-results-tmp/*/index.html` $TARGET/${VENDOR}_${MAINBOARD}-scanbuild
|
|
|
|
MAKE=$origMAKE
|
|
|
|
fi
|
2004-10-19 09:00:47 +02:00
|
|
|
fi
|
2004-11-05 15:06:24 +01:00
|
|
|
|
2006-05-27 02:22:02 +02:00
|
|
|
xml ""
|
|
|
|
xml "</mainboard>"
|
|
|
|
|
2006-10-25 21:02:34 +02:00
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_target
|
|
|
|
{
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
|
|
|
|
|
|
|
if [ "$hwtest" != "true" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# image does not exist. we silently skip the patch.
|
2008-01-18 16:08:58 +01:00
|
|
|
if [ ! -r "$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" ]; then
|
2006-10-25 21:02:34 +02:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
which curl &> /dev/null
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
printf "curl is not installed but required for test submission. skipping test.\n\n"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
CURR=`pwd`
|
|
|
|
if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/tested" ]; then
|
|
|
|
printf "Testing image for board $VENDOR $MAINBOARD skipped (previously submitted).\n\n"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
# touch $TARGET/${VENDOR}_${MAINBOARD}/tested
|
|
|
|
|
|
|
|
printf "Submitting image for board $VENDOR $MAINBOARD to test system...\n"
|
|
|
|
|
2008-01-18 16:08:58 +01:00
|
|
|
curl -f -F "romfile=@$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" \
|
2006-10-25 21:02:34 +02:00
|
|
|
-F "mode=abuild" -F "mainboard=${VENDOR}_${MAINBOARD}" -F "submit=Upload" \
|
2008-01-18 16:08:58 +01:00
|
|
|
"http://qa.coreboot.org/deployment/send.php"
|
2006-10-25 21:02:34 +02:00
|
|
|
|
|
|
|
printf "\n"
|
|
|
|
return 0
|
2004-11-05 15:06:24 +01:00
|
|
|
}
|
2004-10-19 09:00:47 +02:00
|
|
|
|
2009-04-15 18:07:27 +02:00
|
|
|
function remove_target
|
|
|
|
{
|
|
|
|
if [ "$remove" != "true" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
VENDOR=$1
|
|
|
|
MAINBOARD=$2
|
|
|
|
|
|
|
|
# Save the generated coreboot.rom file of each board.
|
|
|
|
if [ -r "$TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom" ]; then
|
|
|
|
cp $TARGET/${VENDOR}_${MAINBOARD}/coreboot.rom \
|
|
|
|
${VENDOR}_${MAINBOARD}_coreboot.rom
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf "Removing build dir for board $VENDOR $MAINBOARD...\n"
|
|
|
|
rm -rf $TARGET/${VENDOR}_${MAINBOARD}
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2004-11-05 01:25:19 +01:00
|
|
|
function myhelp
|
|
|
|
{
|
2009-04-15 18:07:27 +02:00
|
|
|
printf "Usage: $0 [-v] [-a] [-b] [-r] [-t <vendor/board>] [-p <dir>] [lbroot]\n"
|
2006-10-25 21:02:34 +02:00
|
|
|
printf " $0 [-V|--version]\n"
|
2006-11-10 14:30:28 +01:00
|
|
|
printf " $0 [-h|--help]\n\n"
|
|
|
|
|
2006-10-25 21:02:34 +02:00
|
|
|
printf "Options:\n"
|
|
|
|
printf " [-v|--verbose] print more messages\n"
|
|
|
|
printf " [-a|--all] build previously succeeded ports as well\n"
|
|
|
|
printf " [-b|--broken] attempt to build ports that are known broken\n"
|
2009-04-15 18:07:27 +02:00
|
|
|
printf " [-r|--remove] remove output dir after build\n"
|
2006-10-25 21:02:34 +02:00
|
|
|
printf " [-t|--target <vendor/board>] attempt to build target vendor/board only\n"
|
|
|
|
printf " [-p|--payloads <dir>] use payloads in <dir> to build images\n"
|
|
|
|
printf " [-V|--version] print version number and exit\n"
|
|
|
|
printf " [-h|--help] print this help and exit\n"
|
|
|
|
printf " [-x|--xml] write xml log file \n"
|
|
|
|
printf " (defaults to $XMLFILE)\n"
|
|
|
|
printf " [-T|--test] submit image(s) to automated test system\n"
|
2008-05-27 20:29:26 +02:00
|
|
|
printf " [-c|--cpus <numcpus>] build on <numcpus> at the same time\n"
|
|
|
|
printf " [-s|--silent] omit compiler calls in logs\n"
|
2008-09-30 19:09:44 +02:00
|
|
|
printf " [-ns|--nostackprotect] use gcc -fno-stack-protector option\n"
|
2009-03-11 16:43:02 +01:00
|
|
|
printf " [-sb|--scan-build] use clang's static analyzer\n"
|
2009-03-11 16:00:50 +01:00
|
|
|
printf " [-C|--config] configure-only mode\n"
|
2009-04-23 01:39:19 +02:00
|
|
|
printf " [-l|--loglevel <num>] set loglevel\n"
|
2008-01-18 16:08:58 +01:00
|
|
|
printf " [lbroot] absolute path to coreboot sources\n"
|
2010-01-30 11:44:28 +01:00
|
|
|
printf " (defaults to $ROOT)\n\n"
|
2004-11-05 01:25:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function myversion
|
|
|
|
{
|
|
|
|
cat << EOF
|
|
|
|
|
2008-01-18 16:08:58 +01:00
|
|
|
coreboot autobuild v$ABUILD_VERSION ($ABUILD_DATE)
|
2004-11-05 01:25:19 +01:00
|
|
|
|
2006-05-27 02:22:02 +02:00
|
|
|
Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
|
2010-01-30 11:44:28 +01:00
|
|
|
Copyright (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
|
2006-10-25 21:02:34 +02:00
|
|
|
|
2004-11-05 01:25:19 +01:00
|
|
|
This program is free software; you may redistribute it under the terms
|
|
|
|
of the GNU General Public License. This program has absolutely no
|
|
|
|
warranty.
|
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
# default options
|
|
|
|
target=""
|
|
|
|
buildall=false
|
2004-11-05 12:57:00 +01:00
|
|
|
verbose=false
|
2004-11-05 01:25:19 +01:00
|
|
|
|
2010-02-07 22:43:48 +01:00
|
|
|
test -f util/sconfig/config.g && ROOT=$( pwd )
|
|
|
|
test -f ../util/sconfig/config.g && ROOT=$( cd ..; pwd )
|
2010-01-30 11:44:28 +01:00
|
|
|
test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
|
2009-07-01 14:26:11 +02:00
|
|
|
|
2008-05-27 20:29:26 +02:00
|
|
|
# parse parameters.. try to find out whether we're running GNU getopt
|
2008-05-28 10:40:23 +02:00
|
|
|
getoptbrand="`getopt -V`"
|
|
|
|
if [ "${getoptbrand:0:6}" == "getopt" ]; then
|
|
|
|
# Detected GNU getopt that supports long options.
|
2010-02-07 22:43:48 +01:00
|
|
|
args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel: Vvhat:bp:Tc:sxCl: -- "$@"`
|
2008-05-27 20:29:26 +02:00
|
|
|
eval set "$args"
|
|
|
|
else
|
|
|
|
# Detected non-GNU getopt
|
2010-01-30 11:44:28 +01:00
|
|
|
args=`getopt Vvhat:bp:Tc:sxCl:o $*`
|
2008-05-27 20:29:26 +02:00
|
|
|
set -- $args
|
|
|
|
fi
|
2004-11-05 01:25:19 +01:00
|
|
|
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
myhelp
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-11-05 09:50:54 +01:00
|
|
|
while true ; do
|
2004-11-05 12:24:57 +01:00
|
|
|
case "$1" in
|
2006-05-27 02:22:02 +02:00
|
|
|
-x|--xml) shift; mode=xml; rm -f $XMLFILE ;;
|
2004-11-05 15:06:24 +01:00
|
|
|
-t|--target) shift; target="$1"; shift;;
|
2004-11-05 09:50:54 +01:00
|
|
|
-a|--all) shift; buildall=true;;
|
2004-11-05 20:55:06 +01:00
|
|
|
-b|--broken) shift; buildbroken=true;;
|
2009-04-15 18:07:27 +02:00
|
|
|
-r|--remove) shift; remove=true; shift;;
|
2004-11-05 09:50:54 +01:00
|
|
|
-v|--verbose) shift; verbose=true;;
|
2004-11-05 12:47:41 +01:00
|
|
|
-V|--version) shift; myversion; exit 0;;
|
2006-10-25 21:02:34 +02:00
|
|
|
-h|--help) shift; myversion; myhelp; exit 0;;
|
2006-09-15 19:00:11 +02:00
|
|
|
-p|--payloads) shift; payloads="$1"; shift;;
|
2006-10-25 21:02:34 +02:00
|
|
|
-T|--test) shift; hwtest=true;;
|
2008-05-27 20:29:26 +02:00
|
|
|
-c|--cpus) shift; cpus="$1"; test "$cpus" == "max" && cpus=""; shift;;
|
|
|
|
-s|--silent) shift; silent="-s";;
|
2008-09-30 19:09:44 +02:00
|
|
|
-ns|--nostackprotect) shift; stackprotect=true;;
|
2009-03-11 16:43:02 +01:00
|
|
|
-sb|--scan-build) shift; scanbuild=true;;
|
2009-03-11 16:00:50 +01:00
|
|
|
-C|--config) shift; configureonly=1;;
|
2009-04-21 22:31:18 +02:00
|
|
|
-l|--loglevel) shift; loglevel="$1"; shift;;
|
2004-11-05 09:50:54 +01:00
|
|
|
--) shift; break;;
|
2006-10-25 21:02:34 +02:00
|
|
|
-*) printf "Invalid option\n\n"; myhelp; exit 1;;
|
2004-11-05 12:24:57 +01:00
|
|
|
*) break;;
|
2004-11-05 09:50:54 +01:00
|
|
|
esac
|
2004-11-05 01:25:19 +01:00
|
|
|
done
|
|
|
|
|
2004-11-05 20:55:06 +01:00
|
|
|
# /path/to/freebios2/
|
2010-01-30 11:44:28 +01:00
|
|
|
test -z "$1" || ROOT=$1
|
2004-11-05 01:25:19 +01:00
|
|
|
|
2010-01-30 11:44:28 +01:00
|
|
|
debug "ROOT=$ROOT"
|
2004-11-05 01:25:19 +01:00
|
|
|
|
2006-05-27 02:22:02 +02:00
|
|
|
xml '<?xml version="1.0" encoding="utf-8"?>'
|
|
|
|
xml '<abuild>'
|
|
|
|
|
2004-11-05 01:26:31 +01:00
|
|
|
if [ "$target" != "" ]; then
|
2004-11-05 11:48:04 +01:00
|
|
|
# build a single board
|
2006-10-25 21:02:34 +02:00
|
|
|
VENDOR=`printf $target|cut -f1 -d/`
|
|
|
|
MAINBOARD=`printf $target|cut -f2 -d/`
|
2009-04-23 01:39:19 +02:00
|
|
|
CONFIG=`printf $target|cut -f3 -d/`
|
|
|
|
build_target $VENDOR $MAINBOARD $CONFIG
|
2006-10-25 21:02:34 +02:00
|
|
|
test_target $VENDOR $MAINBOARD
|
2004-11-05 01:25:19 +01:00
|
|
|
else
|
2004-11-05 11:48:04 +01:00
|
|
|
# build all boards per default
|
|
|
|
for VENDOR in $( vendors ); do
|
|
|
|
for MAINBOARD in $( mainboards $VENDOR ); do
|
|
|
|
build_target $VENDOR $MAINBOARD
|
2006-10-25 21:02:34 +02:00
|
|
|
test_target $VENDOR $MAINBOARD
|
2009-04-15 18:07:27 +02:00
|
|
|
remove_target $VENDOR $MAINBOARD
|
2004-11-05 11:48:04 +01:00
|
|
|
done
|
|
|
|
done
|
2004-11-05 01:25:19 +01:00
|
|
|
fi
|
2006-05-27 02:22:02 +02:00
|
|
|
xml '</abuild>'
|
2004-10-19 09:00:47 +02:00
|
|
|
|