summaryrefslogtreecommitdiffstats
path: root/build
blob: b9e783386b647b932a7556db30dfe24864c1f436 (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
#!/bin/bash

#
#  build script: builds the ROM images and puts them in ./bin/
#
#	Copyright (C) 2014 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/>.
#

# Build the ROM's

# MAKE SURE THAT YOU RAN "buildall" OR "builddeps" *AT LEAST ONCE*
# BEFORE RUNNING THIS!

echo "running 'make clean' in coreboot"

# prepare coreboot
cd coreboot

# run "make clean" in coreboot (will re-build later)
make clean
rm -rf grub.elf 

# come back to main directory
cd ../

echo "finished running 'make clean' in coreboot"

# Build the GRUB payload (ELF executable):
# ----------------------------------------------------------------------------------------------------------------------

echo "generating grub.elf payload"

cd resources/utilities/grub-assemble

# Generate grub.elf inside the directory
./gen.sh

# Replace the old one
rm -rf ../../../coreboot/grub.elf
mv grub.elf ../../../coreboot/

# come back to main directory
cd ../../../

echo "finished generating grub.elf payload (it's now in coreboot/ directory)"

# Build the ROM's (for flashing)
# ----------------------------------------------------------------------------------------------------------------------

# ROM images for supported Thinkpads
# (x60 also means x60s)
for board in x60 t60 x60t
do
	# Build the ROM (with GRUB payload)
	./buildrom-withgrub $board

	# These are needed for the 'bucts' workarounds on X60/T60
	cd bin/$board
	for rom in $(find -type f)
	do
		dd if=$rom of=top64k.bin bs=1 skip=$[$(stat -c %s $rom) - 0x10000] count=64k
		dd if=$rom bs=1 skip=$[$(stat -c %s $rom) - 0x20000] count=64k | hexdump
		dd if=top64k.bin of=$rom bs=1 seek=$[$(stat -c %s $rom) - 0x20000] count=64k conv=notrunc
		rm -rf top64k.bin
	done
	cd ../../
done

# build macbook21 rom
./buildrom-withgrub macbook21

echo "BUILD COMPLETE. ROM IMAGES ARE IN ./bin/"

# ------------------- DONE ----------------------