-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sh
executable file
·343 lines (288 loc) · 11.1 KB
/
build.sh
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
#!/bin/bash
set -euo pipefail
usage() {
echo "${0} CMD"
echo "Available CMDs:"
echo -e "\tz690a_ddr4 - build Dasharo image compatible with MSI PRO Z690-A (WIFI) DDR4"
echo -e "\tz690a_ddr5 - build Dasharo image compatible with MSI PRO Z690-A (WIFI)"
echo -e "\tz790p_ddr4 - build Dasharo image compatible with MSI PRO Z790-P (WIFI) DDR4"
echo -e "\tz790p_ddr5 - build Dasharo image compatible with MSI PRO Z790-P (WIFI)"
echo -e "\tvp66xx - build Dasharo for Protectli VP66xx"
echo -e "\tvp46xx - build Dasharo for Protectli VP46xx"
echo -e "\tvp32xx - build Dasharo for Protectli VP32xx"
echo -e "\tvp2430 - build Dasharo for Protectli VP2430"
echo -e "\tvp2420 - build Dasharo for Protectli VP2420"
echo -e "\tvp2410 - build Dasharo for Protectli VP2410"
echo -e "\tV1210 - build Dasharo for Protectli V1210"
echo -e "\tV1410 - build Dasharo for Protectli V1410"
echo -e "\tV1610 - build Dasharo for Protectli V1610"
echo -e "\tapu2 - build Dasharo for PC Engines APU2"
echo -e "\tapu3 - build Dasharo for PC Engines APU3"
echo -e "\tapu4 - build Dasharo for PC Engines APU4"
echo -e "\tapu6 - build Dasharo for PC Engines APU6"
echo -e "\toptiplex_9010 - build Dasharo compatible with Dell OptiPlex 7010/9010"
echo -e "\tqemu - build Dasharo for QEMU Q35"
echo -e "\tqemu_full - build Dasharo for QEMU Q35 with all menus available"
echo -e "\todroid_h4 - build Dasharo compatible with Hardkernel ODROID H4"
}
SDKVER="2024-02-18_732134932b"
function build_optiplex_9010 {
DEFCONFIG="configs/config.dell_optiplex_9010_sff_uefi_txt"
FW_VERSION=v0.1.0-rc1
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
cp "${DEFCONFIG}" .config
git submodule update --init --checkout
echo "Building Dasharo compatible with Dell OptiPlex 7010/9010 (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom ${BOARD}_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/${BOARD}_${FW_VERSION}.rom"
sha256sum ${BOARD}_${FW_VERSION}.rom > ${BOARD}_${FW_VERSION}.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_msi {
DEFCONFIG="configs/config.${BOARD}_$1"
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
cp "${DEFCONFIG}" .config
git submodule update --init --checkout
echo "Building Dasharo compatible with MSI PRO $2(WIFI) (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom ${BOARD}_${FW_VERSION}_$1.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/${BOARD}_${FW_VERSION}_$1.rom"
sha256sum ${BOARD}_${FW_VERSION}_$1.rom > ${BOARD}_${FW_VERSION}_$1.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_protectli_vault {
DEFCONFIG="configs/config.protectli_${BOARD}"
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
if [ ! -d 3rdparty/dasharo-blobs/protectli ]; then
git submodule update --init --checkout
fi
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:2021-09-23_b0d87f753c \
/bin/bash -c "make distclean"
cp $DEFCONFIG .config
echo "Building Dasharo for Protectli $BOARD (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom protectli_${BOARD}_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/protectli_${BOARD}_${FW_VERSION}.rom"
sha256sum protectli_${BOARD}_${FW_VERSION}.rom > protectli_${BOARD}_${FW_VERSION}.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_v1x10 {
DEFCONFIG="configs/config.protectli_vault_jsl_$1"
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
if [ ! -d 3rdparty/dasharo-blobs/protectli ]; then
git submodule update --init --checkout
fi
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
cp $DEFCONFIG .config
echo "Building Dasharo for Protectli $1 (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom protectli_$1_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/protectli_$1_${FW_VERSION}.rom"
sha256sum protectli_$1_${FW_VERSION}.rom > protectli_$1_${FW_VERSION}.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_pcengines {
VARIANT=$1
DEFCONFIG="configs/config.pcengines_uefi_${VARIANT}"
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
# checkout several submodules needed by these boards (some others are checked
# out by coreboot's Makefile)
git submodule update --init --force --checkout \
3rdparty/dasharo-blobs \
3rdparty/vboot
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
cp $DEFCONFIG .config
echo "Building Dasharo for PC Engines ${VARIANT^^*} (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom pcengines_${VARIANT}_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/pcengines_${VARIANT}_${FW_VERSION}.rom"
sha256sum pcengines_${VARIANT}_${FW_VERSION}.rom > pcengines_${VARIANT}_${FW_VERSION}.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_qemu {
DEFCONFIG="configs/config.emulation_qemu_x86_q35_uefi${1:-}"
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
# checkout several submodules needed by these boards (some others are checked
# out by coreboot's Makefile)
git submodule update --init --force --checkout \
3rdparty/dasharo-blobs
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
cp $DEFCONFIG .config
echo "Building Dasharo for QEMU Q35 (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom qemu_q35_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/qemu_q35_${FW_VERSION}.rom"
sha256sum qemu_q35_${FW_VERSION}.rom > qemu_q35_${FW_VERSION}.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_odroid_h4 {
DEFCONFIG="configs/config.hardkernel_odroid_h4"
FW_VERSION=$(cat ${DEFCONFIG} | grep CONFIG_LOCALVERSION | cut -d '=' -f 2 | tr -d '"')
# checkout several submodules needed by these boards (some others are checked
# out by coreboot's Makefile)
git submodule update --init --force --checkout \
3rdparty/dasharo-blobs
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make distclean"
cp $DEFCONFIG .config
echo "Building Dasharo compatbile with Hardkernel ODROID H4 (version $FW_VERSION)"
docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \
-v $HOME/.ssh:/home/coreboot/.ssh \
-w /home/coreboot/coreboot coreboot/coreboot-sdk:$SDKVER \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom hardkernel_odroid_h4_${FW_VERSION}.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/hardkernel_odroid_h4_${FW_VERSION}.rom"
sha256sum hardkernel_odroid_h4_${FW_VERSION}.rom > hardkernel_odroid_h4_${FW_VERSION}.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
CMD="$1"
case "$CMD" in
"ddr4" | "z690a_ddr4")
BOARD="msi_ms7d25"
build_msi ddr4 "Z690-A DDR4 "
;;
"ddr5" | "z690a_ddr5")
BOARD="msi_ms7d25"
build_msi ddr5 "Z690-A DDR5 "
;;
"z790p_ddr4")
BOARD="msi_ms7e06"
build_msi ddr4 "Z790-P DDR4 "
;;
"z790p_ddr5")
BOARD="msi_ms7e06"
build_msi ddr5 "Z790-P DDR5 "
;;
"vp66xx" | "VP66XX")
BOARD="vp66xx"
build_protectli_vault
;;
"vp46xx" | "VP46XX")
BOARD="vp46xx"
build_protectli_vault
;;
"vp32xx" | "VP32XX")
BOARD="vp32xx"
build_protectli_vault
;;
"vp2410" | "VP2410")
BOARD="vp2410"
build_protectli_vault
;;
"vp2420" | "VP2420")
BOARD="vp2420"
build_protectli_vault
;;
"vp2430" | "VP2430")
BOARD="vp2430"
build_protectli_vault
;;
"v1210" | "V1210" )
build_v1x10 "v1210"
;;
"v1211" | "V1211" )
build_v1x10 "v1211"
;;
"v1410" | "V1410" )
build_v1x10 "v1410"
;;
"v1610" | "V1610" )
build_v1x10 "v1610"
;;
"apu2" | "APU2" )
build_pcengines "apu2"
;;
"apu3" | "APU3" )
build_pcengines "apu3"
;;
"apu4" | "APU4" )
build_pcengines "apu4"
;;
"apu6" | "APU6" )
build_pcengines "apu6"
;;
"optiplex_9010" | "optiplex_7010" )
BOARD=optiplex_9010
build_optiplex_9010
;;
"qemu" | "QEMU" | "q35" | "Q35" )
build_qemu
;;
"qemu_full" | "QEMU_full" | "q35_full" | "Q35_full" )
build_qemu "_all_menus"
;;
"odroid_h4" | "odroid_H4" | "ODROID_H4" )
build_odroid_h4
;;
*)
echo "Invalid command: \"$CMD\""
usage
;;
esac