summaryrefslogtreecommitdiffstats
path: root/util/compareboard/compareboard
blob: 4b92fb8fe600462772dbbb51efa23ae69ecf03bd (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/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 tmp.XXXXXXXXXX`
rm -rf $A
mkdir -p $A

sort coreboot-builds/$BOARDPATH/fallback/ldoptions > $A/old
sort build/ldoptions > $A/new

if [ `grep -c "^CONFIG_NORTHBRIDGE_AMD_AMDFAM10" $A/new` -eq 0 ]; then
	sed \
		-e "/^CONFIG_AMDMCT / d" \
		-e "/^CONFIG_C[BD]B / d" \
		-e "/^CONFIG_EXT_CONF_SUPPORT / d" \
		-e "/^CONFIG_EXT_RT_TBL_SUPPORT / d" \
		-e "/^CONFIG_HT3_SUPPORT / d" \
		$A/old > $A/old.tmp && mv $A/old.tmp $A/old
fi

if [ `grep -c "^CONFIG_NORTHBRIDGE_AMD_AMDK8" $A/new` -eq 0 ]; then
	sed \
		-e "/^CONFIG_K8_HT_FREQ_1G_SUPPORT / d" \
		$A/old > $A/old.tmp && mv $A/old.tmp $A/old
fi

if [ `grep -c "^CONFIG_NORTHBRIDGE_AMD_AMDFAM10" $A/new` -eq 0 -a `grep -c "^CONFIG_NORTHBRIDGE_AMD_AMDK8" $A/new` -eq 0 ]; then
	sed \
		-e "/^CONFIG_APIC_ID_OFFSET / d" \
		-e "/^CONFIG_CPU_SOCKET_TYPE / d" \
		-e "/^CONFIG_DIMM_SUPPORT / d" \
		-e "/^CONFIG_HT_CHAIN_UNITID_BASE / d" \
		-e "/^CONFIG_HT_CHAIN_END_UNITID_BASE / d" \
		-e "/^CONFIG_HW_MEM_HOLE_SIZE_AUTO_INC / d" \
		-e "/^CONFIG_HW_MEM_HOLE_SIZEK / d" \
		-e "/^CONFIG_MEM_TRAIN_SEQ / d" \
		-e "/^CONFIG_SB_HT_CHAIN_ON_BUS0 / d" \
		-e "/^CONFIG_SB_HT_CHAIN_UNITID_OFFSET_ONLY / d" \
		$A/old > $A/old.tmp && mv $A/old.tmp $A/old
fi

sed \
	-e "/^CONFIG_CONSOLE_/ d" \
	-e "/^CONFIG_RESET_/ d" \
	-e "/^CONFIG_XIP_ROM_/ d" \
	-e "/^CONFIG_PRECOMPRESSED_PAYLOAD / d" \
	-e "/^CONFIG_K8_MEM_BANK_B_ONLY / 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_GDB_STUB / d" \
	-e "/^CONFIG_VIDEO_MB / d" \
	-e "/^CONFIG_PCIE_CONFIGSPACE_HOLE / 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_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" \
	-e "/^CONFIG_VIDEO_MB / d" \
	-e "/^CONFIG_EXPERT / d" \
	-e "/^CONFIG_SSE / d" \
	-e "/^CONFIG_VGA_BIOS / d" \
	-e "/^CONFIG_WARNINGS_ARE_ERRORS / d" \
	-e "/^CONFIG_TINY_BOOTBLOCK / d" \
	-e "/^CONFIG_BIG_BOOTBLOCK / d" \
	-e "/^CONFIG_BOOTBLOCK_NORTHBRIDGE_INIT / d" \
	-e "/^CONFIG_BOOTBLOCK_SOUTHBRIDGE_INIT / 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 ,-," | \
    while read line; do
	key=`echo $line|cut -f1 -d\=`
	value=`echo $line|cut -f2 -d\= | tr -d \\;`
	printf "%s = 0x%x\n" "$key" $value
    done

rm -rf $A