From abdf84884e7ffa5335c6534a6198a38812ff51a4 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 30 Mar 2010 14:02:19 +0000 Subject: [PATCH] abuild: - 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 Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5328 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/abuild/abuild | 74 ++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/util/abuild/abuild b/util/abuild/abuild index 6c32cacea..7f0e2ed6d 100755 --- a/util/abuild/abuild +++ b/util/abuild/abuild @@ -25,7 +25,7 @@ XMLFILE=$( pwd )/abuild.xml PAYLOAD=/dev/null # Lines of error context to be printed in FAILURE case -CONTEXT=5 +CONTEXT=6 TESTSUBMISSION="http://qa.coreboot.org/deployment/send.php" @@ -64,6 +64,12 @@ stackprotect=false # loglevel changed with -l / --loglevel option 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/ \ -e s/i86pc/i386/ \ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/ \ @@ -88,6 +94,7 @@ function debug function xml { test "$mode" == "xml" && printf "$*\n" >> $XMLFILE + return 0 } function xmlfile @@ -146,8 +153,10 @@ function create_config printf "Using payload $PAYLOAD\n" fi + [ "$update" = "true" ] && mv ${build_dir}/coreboot.rom coreboot.rom.tmp $MAKE distclean obj=${build_dir} mkdir -p ${build_dir} + [ "$update" = "true" ] && mv coreboot.rom.tmp ${build_dir}/coreboot.rom if [ "$CONFIG" != "" ]; then printf " Using existing configuration $CONFIG ... " @@ -163,6 +172,7 @@ function create_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 + echo "CONFIG_CBFS_PREFIX=\"$cbfs_prefix\"" >> .config if [ "$PAYLOAD" != "/dev/null" ]; then echo "# CONFIG_PAYLOAD_NONE is not set" >> .config echo "CONFIG_PAYLOAD_ELF=y" >> .config @@ -177,6 +187,11 @@ function create_config echo "CONFIG_DEFAULT_CONSOLE_LOGLEVEL=$loglevel" >> .config fi + if [ "$update" != "false" ]; then + printf "(update) " + echo "CONFIG_UPDATE_IMAGE=y" >> .config + fi + if [ "$ccache" = "true" ]; then printf "(ccache enabled) " echo "CONFIG_CCACHE=y" >> .config @@ -189,11 +204,11 @@ function create_config 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=$? mv .config.old $TARGET/${VENDOR}_${MAINBOARD}/config.in if [ $ret -eq 0 ]; then - printf "ok\n" + printf "ok; " xml " ok" xml " " xmlfile $build_dir/config.log @@ -201,7 +216,8 @@ function create_config xml "" return 0 else - printf "FAILED! Log excerpt:\n" + # Does this ever happen? + printf "FAILED!\nLog excerpt:\n" xml " failed" xml " " xmlfile $build_dir/config.log @@ -224,7 +240,7 @@ function create_buildenv echo "# autogenerated makefile" > $MAKEFILE echo "TOP=$ROOT" >> $MAKEFILE echo "OUT=$TARGET/${VENDOR}_${MAINBOARD}" >> $MAKEFILE - echo "coreboot.rom:" >> $MAKEFILE + echo "all:" >> $MAKEFILE echo " cp config.build \$(TOP)/.config" >> $MAKEFILE echo " cd \$(TOP); \$(MAKE) oldconfig obj=\$(OUT)" >> $MAKEFILE echo " cd \$(TOP); \$(MAKE) obj=\$(OUT)" >> $MAKEFILE @@ -235,13 +251,13 @@ function compile_target VENDOR=$1 MAINBOARD=$2 - printf " Compiling image " + 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 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} eval $MAKE $silent -j $cpus obj=${build_dir} \ &> ${build_dir}/make.log @@ -249,26 +265,24 @@ function compile_target mv .config ${build_dir}/config.build mv .xcompile ${build_dir}/xcompile.build cd $TARGET/${VENDOR}_${MAINBOARD} + etime=`perl -e 'print time();' 2>/dev/null || date +%s` duration=$(( $etime - $stime )) + xml " ${duration}s" + + xml " " + xmlfile make.log + xml " " + if [ $ret -eq 0 ]; then xml " ok" - xml " ${duration}s" - xml " " - xmlfile make.log - xml " " printf "ok\n" > compile.status printf "ok. (took ${duration}s)\n" cd $CURR return 0 else xml " failed" - xml " ${duration}s" - xml " " - xmlfile make.log - xml " " - - printf "FAILED after ${duration}s! Log excerpt:\n" + printf "FAILED after ${duration}s!\nLog excerpt:\n" tail -n $CONTEXT make.log 2> /dev/null || tail -$CONTEXT make.log cd $CURR return 1 @@ -322,13 +336,13 @@ function build_target fi CROSS_COMPILE="$TARCH-elf-" CC=gcc - echo using $CROSS_COMPILE$CC + CROSS_TEXT=", using $CROSS_COMPILE$CC" found_crosscompiler=true fi HOSTCC='gcc' - printf "Processing mainboard/$VENDOR/$MAINBOARD" + printf "Building $VENDOR/$MAINBOARD; " xml "" xml "" @@ -339,8 +353,9 @@ function build_target xml "" if [ "$ARCH" = "$TARCH" -o $found_crosscompiler = true ]; then - printf " ($TARCH: ok)\n" + printf "$TARCH: ok$CROSS_TEXT\n" else + # FIXME this is basically the same as above. found_crosscompiler=false if [ "$ARCH" == amd64 -a "$TARCH" == i386 ]; then CC="gcc -m32" @@ -366,14 +381,14 @@ function build_target # Check result: if [ $found_crosscompiler == "false" ]; then - printf " ($TARCH: skipped, we're $ARCH)\n\n" + printf "$TARCH: skipped, we're $ARCH\n\n" xml " notbuilt" xml "" xml "" return 0 else - printf " ($TARCH: ok, we're $ARCH with a ${CROSS_COMPILE} cross compiler)\n" + printf "$TARCH: ok, $ARCH using ${CROSS_COMPILE}gcc\n" xml " " xml " `which ${CROSS_COMPILE}gcc`" xml " `${CROSS_COMPILE}gcc --version | head -1`" @@ -388,7 +403,7 @@ function build_target CC="$CC -fno-stack-protector" fi - built_successfully $VENDOR $MAINBOARD && \ + built_successfully $VENDOR $MAINBOARD && test $update = "false" && \ { printf " ( mainboard/$VENDOR/$MAINBOARD previously ok )\n\n" xml " previouslyok" @@ -406,6 +421,7 @@ function build_target return 0 } + stime=`perl -e 'print time();' 2>/dev/null || date +%s` create_buildenv $VENDOR $MAINBOARD $CONFIG if [ $? -eq 0 -a $configureonly -eq 0 ]; then compile_target $VENDOR $MAINBOARD && @@ -416,6 +432,10 @@ function build_target MAKE=$origMAKE 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 " ${duration}s" xml "" xml "" @@ -506,6 +526,8 @@ function myhelp printf " [-y|--ccache] use ccache\n" printf " [-C|--config] configure-only mode\n" printf " [-l|--loglevel ] set loglevel\n" + printf " [-u|--update] update existing image\n" + printf " [-P|--prefix ] file name prefix in CBFS\n" printf " [lbroot] absolute path to coreboot sources\n" printf " (defaults to $ROOT)\n\n" } @@ -539,11 +561,11 @@ test "$ROOT" = "" && ROOT=$( cd ../..; pwd ) 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:,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" else # Detected non-GNU getopt - args=`getopt Vvhat:bp:Tc:sxCl:y $*` + args=`getopt Vvhat:bp:Tc:sxCl:rP:uy $*` set -- $args fi @@ -571,6 +593,8 @@ while true ; do -y|--ccache) shift; ccache=true;; -C|--config) shift; configureonly=1;; -l|--loglevel) shift; loglevel="$1"; shift;; + -u|--update) shift; update="true";; + -P|--prefix) shift; cbfs_prefix="$1"; shift;; --) shift; break;; -*) printf "Invalid option\n\n"; myhelp; exit 1;; *) break;; -- 2.25.1