[coreboot] [commit] r5328 - trunk/util/abuild

repository service svn at coreboot.org
Tue Mar 30 16:02:19 CEST 2010


Author: stepan
Date: Tue Mar 30 16:02:19 2010
New Revision: 5328
URL: https://tracker.coreboot.org/trac/coreboot/changeset/5328

Log:
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 <stepan at coresystems.de>
Acked-by: Stefan Reinauer <stepan at coresystems.de>

Modified:
   trunk/util/abuild/abuild

Modified: trunk/util/abuild/abuild
==============================================================================
--- trunk/util/abuild/abuild	Tue Mar 30 11:59:23 2010	(r5327)
+++ trunk/util/abuild/abuild	Tue Mar 30 16:02:19 2010	(r5328)
@@ -25,7 +25,7 @@
 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 @@
 # 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 xml
 {
 	test "$mode" == "xml" && printf "$*\n" >> $XMLFILE
+	return 0
 }
 
 function xmlfile
@@ -146,8 +153,10 @@
 		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 @@
 		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 @@
 			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 @@
 		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 "  <builddir>ok</builddir>"
 		xml "  <log>"
 		xmlfile $build_dir/config.log
@@ -201,7 +216,8 @@
 		xml ""
 		return 0
 	else
-		printf "FAILED! Log excerpt:\n"
+		# Does this ever happen?
+		printf "FAILED!\nLog excerpt:\n"
 		xml "  <builddir>failed</builddir>"
 		xml "  <log>"
 		xmlfile $build_dir/config.log
@@ -224,7 +240,7 @@
 	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 @@
 	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 @@
 	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 "  <buildtime>${duration}s</buildtime>"
+
+	xml "  <log>"
+	xmlfile make.log
+	xml "  </log>"
+
 	if [ $ret -eq 0 ]; then
 		xml "  <compile>ok</compile>"
-		xml "  <compiletime>${duration}s</compiletime>"
-		xml "  <log>"
-		xmlfile make.log
-		xml "  </log>"
 		printf "ok\n" > compile.status
 		printf "ok. (took ${duration}s)\n"
 		cd $CURR
 		return 0
 	else
 		xml "  <compile>failed</compile>"
-		xml "  <compiletime>${duration}s</compiletime>"
-		xml "  <log>"
-		xmlfile make.log
-		xml "  </log>"
-
-		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 @@
 		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 "<mainboard>"
 	xml ""
@@ -339,8 +353,9 @@
 	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 @@
 		
 		# Check result:
 		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 ""
 			xml "</mainboard>"
 		
 			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 "  <compiler>"
 			xml "    <path>`which ${CROSS_COMPILE}gcc`</path>"
 			xml "    <version>`${CROSS_COMPILE}gcc --version | head -1`</version>"
@@ -388,7 +403,7 @@
 		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 "  <status>previouslyok</status>"
@@ -406,6 +421,7 @@
 		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 @@
 			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 "  <buildtime>${duration}s</buildtime>"
 
 	xml ""
 	xml "</mainboard>"
@@ -506,6 +526,8 @@
 	printf "    [-y|--ccache]                 use ccache\n"
 	printf "    [-C|--config]                 configure-only mode\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 "				  (defaults to $ROOT)\n\n"
 }
@@ -539,11 +561,11 @@
 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 @@
 		-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;;




More information about the coreboot mailing list