summaryrefslogtreecommitdiff
path: root/build-x60
blob: 3ce896a50d5550e3c800d75f4d54a7440d9282e1 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#!/bin/bash

#  build-x60 script: builds the Lenovo ThinkPad X60 ROM's
#
#	Copyright (C) 2014 Francis Rowe
#
#    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/>.
#

# DO NOT RUN THIS DIRECTLY!
# Use "build"

# Build the ROM's (for X60):
# ----------------------------------------------------------------------------------------------------------------------

cd coreboot
rm -rf .config

# ThinkPad X60: prepare coreboot and build it:
cp ../resources/libreboot/config/x60config .config
make
cp build/coreboot.rom .
make clean
# ThinkPad X60: prepare coreboot and build it (with debugging enabled):
cp coreboot.rom coreboot_serial.rom
# ThinkPad X60: prepare the ROM's that will have alternative (dvorak) configs inserted 
cp coreboot.rom coreboot_dvorak.rom
cp coreboot_serial.rom coreboot_serial_dvorak.rom
# ThinkPad X60: prepare the ROM's that will have alternative (uk dvorak) configs inserted
cp coreboot.rom coreboot_ukdvorak.rom
cp coreboot_serial.rom coreboot_serial_ukdvorak.rom
# ThinkPad X60: prepare the ROM's that will have alternative (uk qwerty) configs inserted
cp coreboot.rom coreboot_ukqwerty.rom
cp coreboot_serial.rom coreboot_serial_ukqwerty.rom
rm -rf .config
rm -rf x60
mkdir x60
# move the ROM's into the newly created x60 directory
mv coreboot*rom x60

# Insert additional configs and other files into the ROM's:
# ---------------------------------------------------------------------------------------------------------------------

# ThinkPad X60: prepare finished coreboot.rom
# Configuration: US Qwerty keyboard layout in GRUB payload. No MemTest86+. No serial output. (for those without dock).
mv x60/coreboot.rom util/cbfstool
cp ../resources/grub/config/x60/grub.cfg util/cbfstool
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60
rm -rf grub.cfg
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare finished coreboot_dvorak.rom
# Configuration: US Dvorak keyboard layout in GRUB payload. No MemTest86+. No serial output. (for those without dock)
mv x60/coreboot_dvorak.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_dvorak.cfg util/cbfstool/grub.cfg
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_dvorak.rom
rm -rf grub.cfg
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare finished coreboot_ukdvorak.rom
# Configuration: UK Dvorak keyboard layout in GRUB payload. No MemTest86+. No serial output. (for those without dock)
mv x60/coreboot_ukdvorak.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_ukdvorak.cfg util/cbfstool/grub.cfg
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_ukdvorak.rom
rm -rf grub.cfg
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare finished coreboot_ukqwerty.rom
# Configuration: UK Qwerty keyboard layout in GRUB payload. No MemTest86+. No serial output. (for those without dock)
mv x60/coreboot_ukqwerty.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_ukqwerty.cfg util/cbfstool/grub.cfg
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_ukqwerty.rom
rm -rf grub.cfg
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare a finished coreboot_serial.rom
# Configuration: US Qwerty keyboard layout in GRUB payload. MemTest86+ included. Serial output enabled. (for those with dock).
mv x60/coreboot_serial.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_serial.cfg util/cbfstool/grub.cfg
cp ../memtest86+-5.01/memtest util/cbfstool
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f memtest -n memtest -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_serial.rom
rm -rf grub.cfg
rm -rf memtest
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare a finished coreboot_serial_dvorak.rom
# Configuration: US Dvorak keyboard layout in GRUB payload. MemTest86+ included. Serial output enabled. (for those with dock)
mv x60/coreboot_serial_dvorak.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_serial_dvorak.cfg util/cbfstool/grub.cfg
cp ../memtest86+-5.01/memtest util/cbfstool
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f memtest -n memtest -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_serial_dvorak.rom
rm -rf grub.cfg
rm -rf memtest
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare a finished coreboot_serial_ukdvorak.rom
# Configuration: UK Dvorak keyboard layout in GRUB payload. MemTest86+ included. Serial output enabled. (for those with dock)
mv x60/coreboot_serial_ukdvorak.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_serial_ukdvorak.cfg util/cbfstool/grub.cfg
cp ../memtest86+-5.01/memtest util/cbfstool
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f memtest -n memtest -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_serial_ukdvorak.rom
rm -rf grub.cfg
rm -rf memtest
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# ThinkPad X60: prepare a finished coreboot_serial_ukqwerty.rom
# Configuration: UK Qwerty keyboard layout in GRUB payload. MemTest86+ included. Serial output enabled. (for those with dock)
mv x60/coreboot_serial_ukqwerty.rom util/cbfstool/coreboot.rom
cp ../resources/grub/config/x60/grub_serial_ukqwerty.cfg util/cbfstool/grub.cfg
cp ../memtest86+-5.01/memtest util/cbfstool
cp ../resources/grub/background/background1024x768.png util/cbfstool/background.png
cp ../resources/grub/font/dejavusansmono.pf2 util/cbfstool
cd util/cbfstool
./cbfstool coreboot.rom add -f grub.cfg -n grub.cfg -t raw
./cbfstool coreboot.rom add -f memtest -n memtest -t raw
./cbfstool coreboot.rom add -f background.png -n background.png -t raw
./cbfstool coreboot.rom add -f dejavusansmono.pf2 -n dejavusansmono.pf2 -t raw
./cbfstool coreboot.rom print
dd if=coreboot.rom of=top64k.bin bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x10000] count=64k
dd if=coreboot.rom bs=1 skip=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k | hexdump
dd if=top64k.bin of=coreboot.rom bs=1 seek=$[$(stat -c %s coreboot.rom) - 0x20000] count=64k conv=notrunc
mv coreboot.rom ../../x60/coreboot_serial_ukqwerty.rom
rm -rf grub.cfg
rm -rf memtest
rm -rf background.png
rm -rf dejavusansmono.pf2
cd ../../

# Now we clean up and prepare the binary archive ready for release.
# ----------------------------------------------------------------------------------------------------------------------------

# now we are back in the main coreboot directory

# ThinkPad X60 ROM's:
# delete the old ROM's
rm -rf ../bin/x60
# now put the new ROM's in ./bin
mv x60 ../bin

# go back to main source directory
cd ../