summaryrefslogtreecommitdiffstats
path: root/util/kbuildall/kbuildall
blob: 3d169508669e05e80ab3ebd560d18dc9f28ff43e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
#
#  coreboot autobuilder for kconfig
#
#  This script builds coreboot images for all available targets.
#
#  (C) 2009 coresystems GmbH 
#      written by Patrick Georgi <patrick.georgi@coresystems.de>
#
#  This file is subject to the terms and conditions of the GNU General
#  Public License, version 2. See the file COPYING in the main directory
#  of this archive for more details.

TARGETDIR=kbuildall.results
BOARD=$1

if [ ! -f util/kbuildall/kbuildall ]; then
	echo "This application must be run from the"
	echo "toplevel directory of a coreboot checkout."
	exit 1
fi

for make in make gmake gnumake; do
	if [ "`$make --version 2>/dev/null | grep -c GNU`" -gt 0 ]; then
		MAKE=$make
		break
	fi
done

builddefconfig() {
# $1: mainboarddir
	$MAKE distclean
	grep "depends[\t ]on[\t ]*VENDOR" src/mainboard/$1/../Kconfig | sed "s,^.*\(VENDOR_.*\)[^A-Z0-9_]*,CONFIG_\1=y," > .config
	grep "config[\t ]*BOARD" src/mainboard/$1/Kconfig | sed "s,^.*\(BOARD_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
	grep "select[\t ]*ARCH" src/mainboard/$1/Kconfig | sed "s,^.*\(ARCH_.*\)[^A-Z0-9_]*,CONFIG_\1=y," >> .config
	echo "CONFIG_MAINBOARD_DIR=$1" >> .config
	yes "" | $MAKE oldconfig
}

ALLTARGETS=`(cd src/mainboard; ls */*/Config.lb | sed s,/Config.lb,,)`
TARGETCOUNT=`echo $ALLTARGETS | wc -w`

if [ -n "$BOARD" ]; then
	TARGETCOUNT=1
	ALLTARGETS=$BOARD
else
	rm -rf $TARGETDIR
fi
mkdir -p $TARGETDIR
i=0
for dir in $ALLTARGETS; do
	i=`expr $i + 1`
	if [ ! -f src/mainboard/$dir/Kconfig ]; then
		echo "[$i/$TARGETCOUNT] ($dir) no Kconfig"
		echo "$dir nokconfig" >> $TARGETDIR/_overview.txt
		continue
	fi
	name=`echo $dir | sed s,/,_,g`
	printf "[$i/$TARGETCOUNT] $dir "
	builddefconfig $dir > $TARGETDIR/$name.buildconfig.log 2>&1
	result=`$MAKE > $TARGETDIR/$name.buildcoreboot.log 2>&1 && echo ok || echo fail`
	echo "$result."
	if [ "$result" = "ok" ]; then
		util/abuild/abuild -C -t $dir
		sh util/compareboard/compareboard $dir | tee $TARGETDIR/$name.variables.txt
	fi
	echo "$dir $result" >> $TARGETDIR/_overview.txt
done
OpenPOWER on IntegriCloud