- increase context to 6 lines in case of build error
- add update mechanism to automatically produce fallback+normal in one image.
- tighten up output
- in-coreboot-builds makefile main target is now "all" as coreboot.rom matches
  a file
- time measurement now includes "make config" step
- actually allow long-implemented long version of --remove|-r option.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5328 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer 2010-03-30 14:02:19 +00:00 committed by Stefan Reinauer
parent fd0bef825d
commit abdf84884e
1 changed files with 49 additions and 25 deletions

View File

@ -25,7 +25,7 @@ XMLFILE=$( pwd )/abuild.xml
PAYLOAD=/dev/null PAYLOAD=/dev/null
# Lines of error context to be printed in FAILURE case # Lines of error context to be printed in FAILURE case
CONTEXT=5 CONTEXT=6
TESTSUBMISSION="http://qa.coreboot.org/deployment/send.php" TESTSUBMISSION="http://qa.coreboot.org/deployment/send.php"
@ -64,6 +64,12 @@ stackprotect=false
# loglevel changed with -l / --loglevel option # loglevel changed with -l / --loglevel option
loglevel=default loglevel=default
# update existing image
update=false
# CBFS prefix
cbfs_prefix=fallback
ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ ARCH=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
-e s/i86pc/i386/ \ -e s/i86pc/i386/ \
-e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \
@ -88,6 +94,7 @@ function debug
function xml function xml
{ {
test "$mode" == "xml" && printf "$*\n" >> $XMLFILE test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
return 0
} }
function xmlfile function xmlfile
@ -146,8 +153,10 @@ function create_config
printf "Using payload $PAYLOAD\n" printf "Using payload $PAYLOAD\n"
fi fi
[ "$update" = "true" ] && mv ${build_dir}/coreboot.rom coreboot.rom.tmp
$MAKE distclean obj=${build_dir} $MAKE distclean obj=${build_dir}
mkdir -p ${build_dir} mkdir -p ${build_dir}
[ "$update" = "true" ] && mv coreboot.rom.tmp ${build_dir}/coreboot.rom
if [ "$CONFIG" != "" ]; then if [ "$CONFIG" != "" ]; then
printf " Using existing configuration $CONFIG ... " printf " Using existing configuration $CONFIG ... "
@ -163,6 +172,7 @@ function create_config
grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \ grep "select[\t ]*ARCH" src/mainboard/$VENDOR/$MAINBOARD/Kconfig | \
sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> .config echo "CONFIG_MAINBOARD_DIR=\"$VENDOR/$MAINBOARD\"" >> .config
echo "CONFIG_CBFS_PREFIX=\"$cbfs_prefix\"" >> .config
if [ "$PAYLOAD" != "/dev/null" ]; then if [ "$PAYLOAD" != "/dev/null" ]; then
echo "# CONFIG_PAYLOAD_NONE is not set" >> .config echo "# CONFIG_PAYLOAD_NONE is not set" >> .config
echo "CONFIG_PAYLOAD_ELF=y" >> .config echo "CONFIG_PAYLOAD_ELF=y" >> .config
@ -177,6 +187,11 @@ function create_config
echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config
fi fi
if [ "$update" != "false" ]; then
printf "(update) "
echo "CONFIG_UPDATE_IMAGE=y" >> .config
fi
if [ "$ccache" = "true" ]; then if [ "$ccache" = "true" ]; then
printf "(ccache enabled) " printf "(ccache enabled) "
echo "CONFIG_CCACHE=y" >> .config echo "CONFIG_CCACHE=y" >> .config
@ -189,11 +204,11 @@ function create_config
fi fi
fi fi
yes "" | $MAKE oldconfig obj=${build_dir} > ${build_dir}/config.log yes "" | $MAKE oldconfig -j $cpus obj=${build_dir} > ${build_dir}/config.log
ret=$? ret=$?
mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in
if [ $ret -eq 0 ]; then if [ $ret -eq 0 ]; then
printf "ok\n" printf "ok; "
xml " <builddir>ok</builddir>" xml " <builddir>ok</builddir>"
xml " <log>" xml " <log>"
xmlfile $build_dir/config.log xmlfile $build_dir/config.log
@ -201,7 +216,8 @@ function create_config
xml "" xml ""
return 0 return 0
else else
printf "FAILED! Log excerpt:\n" # Does this ever happen?
printf "FAILED!\nLog excerpt:\n"
xml " <builddir>failed</builddir>" xml " <builddir>failed</builddir>"
xml " <log>" xml " <log>"
xmlfile $build_dir/config.log xmlfile $build_dir/config.log
@ -224,7 +240,7 @@ function create_buildenv
echo "# autogenerated makefile" > $MAKEFILE echo "# autogenerated makefile" > $MAKEFILE
echo "TOP=$ROOT" >> $MAKEFILE echo "TOP=$ROOT" >> $MAKEFILE
echo "OUT=$TARGET/${VENDOR}_${MAINBOARD}" >> $MAKEFILE echo "OUT=$TARGET/${VENDOR}_${MAINBOARD}" >> $MAKEFILE
echo "coreboot.rom:" >> $MAKEFILE echo "all:" >> $MAKEFILE
echo " cp config.build \$(TOP)/.config" >> $MAKEFILE echo " cp config.build \$(TOP)/.config" >> $MAKEFILE
echo " cd \$(TOP); \$(MAKE) oldconfig obj=\$(OUT)" >> $MAKEFILE echo " cd \$(TOP); \$(MAKE) oldconfig obj=\$(OUT)" >> $MAKEFILE
echo " cd \$(TOP); \$(MAKE) obj=\$(OUT)" >> $MAKEFILE echo " cd \$(TOP); \$(MAKE) obj=\$(OUT)" >> $MAKEFILE
@ -241,7 +257,7 @@ function compile_target
test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus
CURR=$( pwd ) CURR=$( pwd )
stime=`perl -e 'print time();' 2>/dev/null || date +%s` #stime=`perl -e 'print time();' 2>/dev/null || date +%s`
build_dir=$TARGET/${VENDOR}_${MAINBOARD} build_dir=$TARGET/${VENDOR}_${MAINBOARD}
eval $MAKE $silent -j $cpus obj=${build_dir} \ eval $MAKE $silent -j $cpus obj=${build_dir} \
&> ${build_dir}/make.log &> ${build_dir}/make.log
@ -249,26 +265,24 @@ function compile_target
mv .config ${build_dir}/config.build mv .config ${build_dir}/config.build
mv .xcompile ${build_dir}/xcompile.build mv .xcompile ${build_dir}/xcompile.build
cd $TARGET/${VENDOR}_${MAINBOARD} cd $TARGET/${VENDOR}_${MAINBOARD}
etime=`perl -e 'print time();' 2>/dev/null || date +%s` etime=`perl -e 'print time();' 2>/dev/null || date +%s`
duration=$(( $etime - $stime )) duration=$(( $etime - $stime ))
if [ $ret -eq 0 ]; then xml " <buildtime>${duration}s</buildtime>"
xml " <compile>ok</compile>"
xml " <compiletime>${duration}s</compiletime>"
xml " <log>" xml " <log>"
xmlfile make.log xmlfile make.log
xml " </log>" xml " </log>"
if [ $ret -eq 0 ]; then
xml " <compile>ok</compile>"
printf "ok\n" > compile.status printf "ok\n" > compile.status
printf "ok. (took ${duration}s)\n" printf "ok. (took ${duration}s)\n"
cd $CURR cd $CURR
return 0 return 0
else else
xml " <compile>failed</compile>" xml " <compile>failed</compile>"
xml " <compiletime>${duration}s</compiletime>" printf "FAILED after ${duration}s!\nLog excerpt:\n"
xml " <log>"
xmlfile make.log
xml " </log>"
printf "FAILED after ${duration}s! Log excerpt:\n"
tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log
cd $CURR cd $CURR
return 1 return 1
@ -322,13 +336,13 @@ function build_target
fi fi
CROSS_COMPILE="$TARCH-elf-" CROSS_COMPILE="$TARCH-elf-"
CC=gcc CC=gcc
echo using $CROSS_COMPILE$CC CROSS_TEXT=", using $CROSS_COMPILE$CC"
found_crosscompiler=true found_crosscompiler=true
fi fi
HOSTCC='gcc' HOSTCC='gcc'
printf "Processing mainboard/$VENDOR/$MAINBOARD" printf "Building $VENDOR/$MAINBOARD; "
xml "<mainboard>" xml "<mainboard>"
xml "" xml ""
@ -339,8 +353,9 @@ function build_target
xml "" xml ""
if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then
printf " ($TARCH: ok)\n" printf "$TARCH: ok$CROSS_TEXT\n"
else else
# FIXME this is basically the same as above.
found_crosscompiler=false found_crosscompiler=false
if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then
CC="gcc -m32" CC="gcc -m32"
@ -366,14 +381,14 @@ function build_target
# Check result: # Check result:
if [ $found_crosscompiler == "false" ]; then if [ $found_crosscompiler == "false" ]; then
printf " ($TARCH: skipped, we're $ARCH)\n\n" printf "$TARCH: skipped, we're $ARCH\n\n"
xml " <status>notbuilt</status>" xml " <status>notbuilt</status>"
xml "" xml ""
xml "</mainboard>" xml "</mainboard>"
return 0 return 0
else else
printf " ($TARCH: ok, we're $ARCH with a ${CROSS_COMPILE} cross compiler)\n" printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n"
xml " <compiler>" xml " <compiler>"
xml " <path>`which ${CROSS_COMPILE}gcc`</path>" xml " <path>`which ${CROSS_COMPILE}gcc`</path>"
xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>" xml " <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
@ -388,7 +403,7 @@ function build_target
CC="$CC -fno-stack-protector" CC="$CC -fno-stack-protector"
fi fi
built_successfully $VENDOR $MAINBOARD && \ built_successfully $VENDOR $MAINBOARD && test $update = "false" && \
{ {
printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n" printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n"
xml " <status>previouslyok</status>" xml " <status>previouslyok</status>"
@ -406,6 +421,7 @@ function build_target
return 0 return 0
} }
stime=`perl -e 'print time();' 2>/dev/null || date +%s`
create_buildenv $VENDOR $MAINBOARD $CONFIG create_buildenv $VENDOR $MAINBOARD $CONFIG
if [ $? -eq 0 -a $configureonly -eq 0 ]; then if [ $? -eq 0 -a $configureonly -eq 0 ]; then
compile_target $VENDOR $MAINBOARD && compile_target $VENDOR $MAINBOARD &&
@ -416,6 +432,10 @@ function build_target
MAKE=$origMAKE MAKE=$origMAKE
fi fi
fi fi
# Not calculated here because we still print it in compile_target
#etime=`perl -e 'print time();' 2>/dev/null || date +%s`
#duration=$(( $etime - $stime ))
#xml " <buildtime>${duration}s</buildtime>"
xml "" xml ""
xml "</mainboard>" xml "</mainboard>"
@ -506,6 +526,8 @@ function myhelp
printf " [-y|--ccache] use ccache\n" printf " [-y|--ccache] use ccache\n"
printf " [-C|--config] configure-only mode\n" printf " [-C|--config] configure-only mode\n"
printf " [-l|--loglevel <num>] set loglevel\n" printf " [-l|--loglevel <num>] set loglevel\n"
printf " [-u|--update] update existing image\n"
printf " [-P|--prefix <name>] file name prefix in CBFS\n"
printf " [lbroot] absolute path to coreboot sources\n" printf " [lbroot] absolute path to coreboot sources\n"
printf " (defaults to $ROOT)\n\n" printf " (defaults to $ROOT)\n\n"
} }
@ -539,11 +561,11 @@ test "$ROOT" = "" && ROOT=$( cd ../..; pwd )
getoptbrand="`getopt -V`" getoptbrand="`getopt -V`"
if [ "${getoptbrand:0:6}" == "getopt" ]; then if [ "${getoptbrand:0:6}" == "getopt" ]; then
# Detected GNU getopt that supports long options. # Detected GNU getopt that supports long options.
args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,ccache Vvhat:bp:Tc:sxCl:y -- "$@"` args=`getopt -l version,verbose,help,all,target:,broken,payloads:,test,cpus:,silent,xml,config,loglevel:,remove,prefix:,update,nostackprotect,scan-build,ccache Vvhat:bp:Tc:sxCl:rP:uy -- "$@"`
eval set "$args" eval set "$args"
else else
# Detected non-GNU getopt # Detected non-GNU getopt
args=`getopt Vvhat:bp:Tc:sxCl:y $*` args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*`
set -- $args set -- $args
fi fi
@ -571,6 +593,8 @@ while true ; do
-y|--ccache) shift; ccache=true;; -y|--ccache) shift; ccache=true;;
-C|--config) shift; configureonly=1;; -C|--config) shift; configureonly=1;;
-l|--loglevel) shift; loglevel="$1"; shift;; -l|--loglevel) shift; loglevel="$1"; shift;;
-u|--update) shift; update="true";;
-P|--prefix) shift; cbfs_prefix="$1"; shift;;
--) shift; break;; --) shift; break;;
-*) printf "Invalid option\n\n"; myhelp; exit 1;; -*) printf "Invalid option\n\n"; myhelp; exit 1;;
*) break;; *) break;;