add Kbuild support to abuild and enable it per default;

use -o/--oldconfig to get the old behavior (and use that 
option in kbuildall to get the old config)

I changed the qa.coreboot.org autobuild system to use -o
for now so we get build reports from the old and new config,
still.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Myles Watson <mylesgw@gmail.com>


git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5066 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2010-01-30 10:44:28 +00:00 committed by Stefan Reinauer
parent e37785791a
commit 68003b8d14
2 changed files with 129 additions and 32 deletions

View File

@ -5,7 +5,7 @@
# This script builds coreboot images for all available targets.
#
# (C) 2004 by Stefan Reinauer <stepan@openbios.org>
# (C) 2006-2009 by coresystems GmbH <info@coresystems.de>
# (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
#
# 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
@ -14,8 +14,8 @@
#set -x # Turn echo on....
ABUILD_DATE="April 10th, 2009"
ABUILD_VERSION="0.8.1"
ABUILD_DATE="January 29th, 2010"
ABUILD_VERSION="0.9"
# Where shall we place all the build trees?
TARGET=$( pwd )/coreboot-builds
@ -34,6 +34,8 @@ cpus=1
# Configure-only mode
configureonly=0
# use old config method "newconfig"
oldconfig=0
# One might want to adjust these in case of cross compiling
for i in make gmake gnumake nonexistant_make; do
@ -103,7 +105,7 @@ function vendors
{
# make this a function so we can easily select
# without breaking readability
ls -1 "$LBROOT/src/mainboard" | grep -v Kconfig | grep -v Makefile
ls -1 "$ROOT/src/mainboard" | grep -v Kconfig | grep -v Makefile
}
function mainboards
@ -113,28 +115,34 @@ function mainboards
VENDOR=$1
ls -1 $LBROOT/src/mainboard/$VENDOR | grep -v Kconfig
ls -1 $ROOT/src/mainboard/$VENDOR | grep -v Kconfig
}
function architecture
{
VENDOR=$1
MAINBOARD=$2
ARCH=`cat $LBROOT/src/mainboard/$VENDOR/$MAINBOARD/Config.lb | \
if [ $oldconfig -eq 1 ]; then
ARCH=`cat $ROOT/src/mainboard/$VENDOR/$MAINBOARD/Config.lb | \
grep ^arch | cut -f 2 -d\ `
echo $ARCH | sed s/ppc/powerpc/
else
ARCH=`cat $ROOT/src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
grep "select ARCH_"|cut -f2- -d_`
echo $ARCH | sed s/X86/i386/
fi
}
function create_config
function create_config_old
{
VENDOR=$1
MAINBOARD=$2
CONFIG=$3
TARCH=$( architecture $VENDOR $MAINBOARD )
TARGCONFIG=$LBROOT/targets/$VENDOR/$MAINBOARD/Config-abuild.lb
TARGCONFIG=$ROOT/targets/$VENDOR/$MAINBOARD/Config-abuild.lb
if [ "$CONFIG" != "" ]; then
TARGCONFIG=$LBROOT/targets/$VENDOR/$MAINBOARD/$CONFIG
TARGCONFIG=$ROOT/targets/$VENDOR/$MAINBOARD/$CONFIG
fi
# get a working payload for the board if we have one.
@ -155,7 +163,6 @@ function create_config
printf "Using existing test target $TARGCONFIG"
xml " <config>$TARGCONFIG</config>"
else
printf " Creating config file..."
xml " <config>autogenerated</config>"
( cat << EOF
@ -228,6 +235,79 @@ EOF
printf " ok\n"
}
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
$MAKE distclean obj=${build_dir}
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
echo "CONFIG_PAYLOAD_ELF=\"$PAYLOAD\"" >> .config
fi
if [ "$loglevel" != "default" ]; then
printf "(loglevel override) "
echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL_$loglevel=y"
echo "CONFIG_MAXIMUM_CONSOLE_LOGLEVEL=$loglevel"
echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL_$loglevel=y"
echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel"
fi
fi
yes "" | $MAKE oldconfig obj=${build_dir} > ${build_dir}/config.log
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
}
function create_builddir
{
VENDOR=$1
@ -236,7 +316,7 @@ function create_builddir
printf " Creating builddir..."
target_dir=$TARGET
config_dir=$LBROOT/util/newconfig
config_dir=$ROOT/util/newconfig
yapps2_py=$config_dir/yapps2.py
config_g=$config_dir/config.g
config_lb=Config-${VENDOR}_${MAINBOARD}.lb
@ -256,7 +336,7 @@ function create_builddir
# make sure config.py is up-to-date
export PYTHONPATH=$config_dir
$PYTHON $config_py $config_lb $LBROOT &> $build_dir/config.log
$PYTHON $config_py $config_lb $ROOT &> $build_dir/config.log
if [ $? -eq 0 ]; then
printf "ok\n"
xml " <builddir>ok</builddir>"
@ -282,8 +362,13 @@ function create_buildenv
VENDOR=$1
MAINBOARD=$2
CONFIG=$3
create_config $VENDOR $MAINBOARD $CONFIG
if [ $oldconfig -eq 1 ]; then
create_config_old $VENDOR $MAINBOARD $CONFIG
create_builddir $VENDOR $MAINBOARD
else
create_config $VENDOR $MAINBOARD $CONFIG
cp .config $TARGET/${VENDOR}_${MAINBOARD}/coreboot.config
fi
}
function compile_target
@ -297,10 +382,21 @@ function compile_target
test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus
CURR=$( pwd )
cd $TARGET/${VENDOR}_${MAINBOARD}
stime=`perl -e 'print time();'`
if [ $oldconfig -eq 1 ]; then
cd $TARGET/${VENDOR}_${MAINBOARD}
eval $MAKE $silent -j $cpus &> make.log
ret=$?
else
build_dir=$TARGET/${VENDOR}_${MAINBOARD}
eval $MAKE $silent -j $cpus obj=${build_dir} \
&> ${build_dir}/make.log
ret=$?
mv .config ${build_dir}/config.build
mv .xcompile ${build_dir}/xcompile.build
mv ..config.tmp ${build_dir}/config.deps
cd $TARGET/${VENDOR}_${MAINBOARD}
fi
etime=`perl -e 'print time();'`
duration=$(( $etime - $stime ))
if [ $ret -eq 0 ]; then
@ -345,7 +441,7 @@ function build_broken
{
CURR=`pwd`
status="yes"
[ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no"
[ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/BROKEN" ] && status="no"
[ "$buildbroken" == "true" -o "$status" == "yes" ]
}
@ -359,8 +455,8 @@ function build_target
# 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.
[ -r "$LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
source $LBROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
[ -r "$ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info" ] && \
source $ROOT/src/mainboard/${VENDOR}/${MAINBOARD}/abuild.info
# default setting
@ -573,7 +669,7 @@ function myhelp
printf " [-C|--config] configure-only mode\n"
printf " [-l|--loglevel <num>] set loglevel\n"
printf " [lbroot] absolute path to coreboot sources\n"
printf " (defaults to $LBROOT)\n\n"
printf " (defaults to $ROOT)\n\n"
}
function myversion
@ -583,7 +679,7 @@ function myversion
coreboot autobuild v$ABUILD_VERSION ($ABUILD_DATE)
Copyright (C) 2004 by Stefan Reinauer <stepan@openbios.org>
Copyright (C) 2006-2008 by coresystems GmbH <info@coresystems.de>
Copyright (C) 2006-2010 by coresystems GmbH <info@coresystems.de>
This program is free software; you may redistribute it under the terms
of the GNU General Public License. This program has absolutely no
@ -597,19 +693,19 @@ target=""
buildall=false
verbose=false
test -f util/newconfig/config.g && LBROOT=$( pwd )
test -f ../util/newconfig/config.g && LBROOT=$( cd ..; pwd )
test "$LBROOT" = "" && LBROOT=$( cd ../..; pwd )
test -f util/newconfig/config.g && ROOT=$( pwd )
test -f ../util/newconfig/config.g && ROOT=$( cd ..; pwd )
test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
# parse parameters.. try to find out whether we're running GNU getopt
getoptbrand="`getopt -V`"
if [ "${getoptbrand:0:6}" == "getopt" ]; then
# Detected GNU getopt that supports long options.
args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel Vvhat:bp:Tc:sxCl: -- "$@"`
args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,oldconfig Vvhat:bp:Tc:sxCl:o -- "$@"`
eval set "$args"
else
# Detected non-GNU getopt
args=`getopt Vvhat:bp:Tc:sxCl: $*`
args=`getopt Vvhat:bp:Tc:sxCl:o $*`
set -- $args
fi
@ -636,6 +732,7 @@ while true ; do
-sb|--scan-build) shift; scanbuild=true;;
-C|--config) shift; configureonly=1;;
-l|--loglevel) shift; loglevel="$1"; shift;;
-o|--oldconfig) shift; oldconfig=1;;
--) shift; break;;
-*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;;
@ -643,9 +740,9 @@ while true ; do
done
# /path/to/freebios2/
test -z "$1" || LBROOT=$1
test -z "$1" || ROOT=$1
debug "LBROOT=$LBROOT"
debug "ROOT=$ROOT"
xml '<?xml version="1.0" encoding="utf-8"?>'
xml '<abuild>'

View File

@ -61,7 +61,7 @@ for dir in $ALLTARGETS; do
result=`$MAKE > $TARGETDIR/$name.buildcoreboot.log 2>&1 && echo ok || echo fail`
echo "$result."
if [ "$result" = "ok" ]; then
util/abuild/abuild -C -t $dir
util/abuild/abuild -o -C -t $dir
sh util/compareboard/compareboard $dir | tee $TARGETDIR/$name.variables.txt
fi
echo "$dir $result" >> $TARGETDIR/_overview.txt