Patchwork compareboard utility

login
register
about
Submitter Patrick Georgi
Date 2009-10-12 17:00:59
Message ID <1255366859.23457.40.camel@tetris>
Download mbox | patch
Permalink /patch/390/
State Accepted
Commit r4761
Headers show

Comments

Patrick Georgi - 2009-10-12 17:00:59
Hi,

attached patch adds the compareboard utility, which compares a kbuildall
build's variables with those of an abuild build.

The previous version which I used so far only looked for existance of
variables (and had a bug for AMD boards, so some of them lack a bunch of
crucial values, sorry about that).
This version also tells you the values, but converts them from hex to
integer first. While this is not very helpful for vendor/device id pairs
and addresses, it helps because it eliminates "0xa" vs. "10" issues.

It hooks up to kbuildall, so just running it leads to abuild being
called (warning: large set of large trees around), and compares their
output.
The results are dumped to stdout and stored as
kbuildall.results/$boardname.variables.txt

Starting from these diffs, it should be easier to make board
configurations in kconfig more correct.

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>

Patrick
Myles Watson - 2009-10-12 17:25:11
> Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Can you make it check if the abuild tree is already there and skip the abuild?

Acked-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles
Myles Watson - 2009-10-12 17:30:49
> This version also tells you the values, but converts them from hex to
> integer first. While this is not very helpful for vendor/device id pairs
> and addresses, it helps because it eliminates "0xa" vs. "10" issues.
More of the tricky values are hex than ints, so maybe printing them all as
hex would be better.

Thanks,
Myles
Carl-Daniel Hailfinger - 2009-10-12 17:56:39
On 12.10.2009 19:00, Patrick Georgi wrote:
> attached patch adds the compareboard utility, which compares a kbuildall
> build's variables with those of an abuild build.
>
> Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
>   

Very nice!
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Regards,
Carl-Daniel
Patrick Georgi - 2009-10-12 18:28:28
Am Montag, den 12.10.2009, 11:25 -0600 schrieb Myles Watson:
> > Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
> Can you make it check if the abuild tree is already there and skip the abuild?
abuild does that itself already.
Myles Watson - 2009-10-12 18:34:24
On Mon, Oct 12, 2009 at 12:28 PM, Patrick Georgi <patrick@georgi-clan.de> wrote:
> Am Montag, den 12.10.2009, 11:25 -0600 schrieb Myles Watson:
>> > Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
>> Can you make it check if the abuild tree is already there and skip the abuild?
> abuild does that itself already.
Right.  Sorry for the noise.

Myles

Patch

Index: util/compareboard/compareboard
===================================================================
--- util/compareboard/compareboard	(Revision 0)
+++ util/compareboard/compareboard	(Revision 0)
@@ -0,0 +1,79 @@ 
+#!/bin/bash
+# $1 board name
+
+normalize() {
+# $1 filename
+cat $1 | while read line; do
+	if echo $line | grep '= 0x' > /dev/null; then
+		first=`echo $line | cut -d= -f1`
+		last=`echo $line |cut -d= -f2 |cut -d\; -f1`
+		echo $first = $(($last + 0))\;
+	else
+		echo $line
+	fi
+done
+}
+
+BOARDPATH=`echo $1 | sed s,/,_,g`
+
+A=`mktemp`
+rm -rf $A
+mkdir -p $A
+
+sort coreboot-builds/$BOARDPATH/fallback/ldoptions > $A/old
+sort build/ldoptions > $A/new
+
+sed \
+	-e "/^CONFIG_CONSOLE_/ d" \
+	-e "/^CONFIG_RESET_/ d" \
+	-e "/^CONFIG_XIP_ROM_/ d" \
+	-e "/^CONFIG_PRECOMPRESSED_PAYLOAD / d" \
+	-e "/^CONFIG_MULTIBOOT / d" \
+	-e "/^CONFIG_ARCH_POWERPC / d" \
+	-e "/^CONFIG_RESET / d" \
+	-e "/^CONFIG_ROM_PAYLOAD / d" \
+	-e "/^CONFIG_ROM_SECTION_/ d" \
+	-e "/^CONFIG_UNCOMPRESSED / d" \
+	-e "/^CONFIG_COMPRESS / d" \
+	-e "/^CONFIG_COMPRESSED_PAYLOAD_LZMA / d" \
+	-e "/^CONFIG_ASSEMBLER_DEBUG / d" \
+	-e "/^CONFIG_HAVE_FAILOVER_BOOT / d" \
+	-e "/^CONFIG_FAILOVER_SIZE / d" \
+	-e "/^CONFIG_FALLBACK_SIZE / d" \
+	-e "/^CONFIG_ROMBASE / d" \
+	-e "/^CONFIG_ROM_IMAGE_SIZE / d" \
+	-e "/^CONFIG_STACK_SIZE / d" \
+	-e "/^CONFIG_IDE_BOOT_DRIVE / d" \
+	-e "/^CONFIG_IDE_OFFSET / d" \
+	-e "/^CONFIG_GDB_STUB / d" \
+	$A/old > $A/old.filtered
+sed \
+	-e "/^CONFIG_VENDOR_/ d" \
+	-e "/^CONFIG_ARCH_POWERPC / d" \
+	-e "/^CONFIG_[MAXIMUMDEFAULT]*_CONSOLE_LOGLEVEL_/ d" \
+	-e "/^CONFIG_COREBOOT_ROMSIZE_/ d" \
+	-e "/^CONFIG_BOARD_/ d" \
+	-e "/^CONFIG_[NORTHSOUTH]*BRIDGE_/ d" \
+	-e "/^CONFIG_SUPERIO_/ d" \
+	-e "/^CONFIG_GX1_VIDEOMODE_/ d" \
+	-e "/^CONFIG_CONSOLE_/ d" \
+	-e "/^CONFIG_COREBOOT_V4/ d" \
+	-e "/^CONFIG_PAYLOAD_/ d" \
+	-e "/^CONFIG_XIP_ROM_/ d" \
+	-e "/^CONFIG_MULTIBOOT/ d" \
+	-e "/^CONFIG_HAVE_FAILOVER_BOOT / d" \
+	-e "/^CONFIG_COMPRESSED_PAYLOAD_LZMA / d" \
+	-e "/^CONFIG_CPU_[A-Z]*_MODEL_/ d" \
+	-e "/^CONFIG_CPU_[A-Z]*_SOCKET_/ d" \
+	-e "/^CONFIG_ROMBASE / d" \
+	-e "/^CONFIG_ROM_IMAGE_SIZE / d" \
+	-e "/^CONFIG_STACK_SIZE / d" \
+	-e "/^CONFIG_GDB_STUB / d" \
+	$A/new > $A/new.filtered
+
+normalize $A/old.filtered > $A/old.normalized
+normalize $A/new.filtered > $A/new.normalized
+
+diff -u $A/old.normalized $A/new.normalized |grep ^[+-][^+-]|sed -e "s,^+,p ," -e "s,^-,m ," |sort -k2,2 -k1,1 |sed -e "s,^p ,+," -e "s,^m ,-,"
+
+rm -rf $A

Eigenschaftsänderungen: util/compareboard/compareboard
___________________________________________________________________
Hinzugefügt: svn:executable
   + *

Index: util/kbuildall/kbuildall
===================================================================
--- util/kbuildall/kbuildall	(Revision 4760)
+++ util/kbuildall/kbuildall	(Arbeitskopie)
@@ -60,5 +60,9 @@ 
 	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 -t $dir
+		sh util/compareboard/compareboard $dir | tee $TARGETDIR/$name.variables.txt
+	fi
 	echo "$dir $result" >> $TARGETDIR/_overview.txt
 done