summaryrefslogtreecommitdiffstats
path: root/ich9macchange
blob: 683fb627c7596f64d93baa494a26b6fbd78c3d01 (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
#!/bin/bash

#  ich9macchange script: uses ich9gen to change the MAC address on GM45/GS45 machines.
#
#	Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

set -u -e -v

arch="unknown"
if [ $(uname -i) = "i686" ] || [ $(uname -m) = "i686" ]; then
	arch="i686"
elif [ $(uname -i) = "x86_64" ] || [ $(uname -m) = "x86_64" ]; then
	arch="x86_64"
elif [ $(uname -i) = "armv7l" ] || [ $(uname -m) = "armv7l" ]; then
	arch="armv7l"
else
	echo "This script must be run on an i686, x86_64 or armv7l host."
	exit 1
fi

if (( $# != 1 )); then
	echo "Usage: ./ich9macchange XX:XX:XX:XX:XX:XX"
	echo "(XX replaced with hex from your desired MAC address)"
	exit 1
fi

path="unknown"
if [ -f "DEBLOB" ]; then
	path="./resources/utilities/ich9deblob/ich9gen"
else
	path="./ich9deblob/$arch/ich9gen"
fi

$(echo $path) --macaddress $1

for board in "x200" "r400"
do
	for size in "8m" "4m"
	do
		cd bin/"$board"_"$size"b/
		for rom in $(ls)
		do
			dd if=../../ich9fdgbe_"$size".bin of="$rom" bs=1 count=12k conv=notrunc
		done
		cd ../../
	done
done

rm -f ich9fdgbe_4m.bin
rm -f ich9fdgbe_8m.bin
rm -f mkgbe.c
rm -f mkgbe.h