[coreboot] [commit] r5066 - in trunk/util: abuild kbuildall

repository service svn at coreboot.org
Sat Jan 30 11:44:29 CET 2010


Author: stepan
Date: Sat Jan 30 11:44:28 2010
New Revision: 5066
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5066

Log:
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 at coresystems.de>
Acked-by: Myles Watson <mylesgw at gmail.com>

Modified:
   trunk/util/abuild/abuild
   trunk/util/kbuildall/kbuildall

Modified: trunk/util/abuild/abuild
==============================================================================
--- trunk/util/abuild/abuild	Sat Jan 30 10:47:18 2010	(r5065)
+++ trunk/util/abuild/abuild	Sat Jan 30 11:44:28 2010	(r5066)
@@ -5,7 +5,7 @@
 #  This script builds coreboot images for all available targets.
 #
 #  (C) 2004 by Stefan Reinauer <stepan at openbios.org>
-#  (C) 2006-2009 by coresystems GmbH <info at coresystems.de>
+#  (C) 2006-2010 by coresystems GmbH <info at 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 @@
 
 # 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 @@
 {
 	# 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 @@
 	
 	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 | \
-		grep ^arch | cut -f 2 -d\ `
-	echo $ARCH | sed s/ppc/powerpc/
+	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 @@
 		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 @@
 	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 @@
 	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 @@
 	# 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 @@
 	VENDOR=$1
 	MAINBOARD=$2
 	CONFIG=$3
-	create_config $VENDOR $MAINBOARD $CONFIG
-	create_builddir $VENDOR $MAINBOARD
+	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 @@
 	test 0$cpus -gt 1 && printf "on %d cpus in parallel .. " $cpus
 
 	CURR=$( pwd )
-	cd $TARGET/${VENDOR}_${MAINBOARD}
 	stime=`perl -e 'print time();'`
-	eval $MAKE $silent -j $cpus &> make.log
-	ret=$?
+	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 @@
 {
 	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 @@
 	# 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 @@
 	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 @@
 coreboot autobuild v$ABUILD_VERSION ($ABUILD_DATE)
 
 Copyright (C) 2004 by Stefan Reinauer <stepan at openbios.org>
-Copyright (C) 2006-2008 by coresystems GmbH <info at coresystems.de>
+Copyright (C) 2006-2010 by coresystems GmbH <info at 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 @@
 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 @@
 		-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 @@
 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>'

Modified: trunk/util/kbuildall/kbuildall
==============================================================================
--- trunk/util/kbuildall/kbuildall	Sat Jan 30 10:47:18 2010	(r5065)
+++ trunk/util/kbuildall/kbuildall	Sat Jan 30 11:44:28 2010	(r5066)
@@ -61,7 +61,7 @@
 	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




More information about the coreboot mailing list