forked from MrChromebox/coreboot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-uefi.sh
executable file
·47 lines (41 loc) · 1.27 KB
/
build-uefi.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
#!/usr/bin/env bash
#
set -e
platforms=('snb_ivb' 'hsw' 'byt' 'bdw' 'bsw' 'skl' 'apl' 'kbl' 'whl' 'glk' \
'cml' 'jsl' 'tgl' 'str' 'zen2' 'adl')
build_targets=()
json_file=cbmodels.json
rom_path=https://www.mrchromebox.tech/files/firmware/full_rom/
echo -e "{" > $json_file
if [ -z "$1" ]; then
for subdir in "${platforms[@]}"; do
for cfg in configs/$subdir/config*.*; do
build_targets+=("$(basename $cfg | cut -f2 -d'.')")
done
done
else
build_targets=($@)
fi
# get git rev
rev=$(git describe --tags --dirty)
for device in "${build_targets[@]}"; do
filename="coreboot_edk2-${device}-mrchromebox_$(date +"%Y%m%d").rom"
rm -f ~/dev/firmware/${filename}*
rm -rf ./build
cfg_file=$(find ./configs -name "config.$device.uefi")
cp "$cfg_file" .config
echo "CONFIG_LOCALVERSION=\"${rev}\"" >> .config
make clean
make olddefconfig
make -j$(nproc)
cp ./build/coreboot.rom ./${filename}
sha1sum ${filename} > ${filename}.sha1
echo -e "\t\"${device}\": {" >> $json_file
echo -e "\t\t\"url\": \"${rom_path}${filename}\"," >> $json_file
echo -e "\t\t\"sha1\": \"$(cat ${filename}.sha1 | awk 'NR==1{print $1}')\"" >> $json_file
echo -e "\t}," >> $json_file
mv ${filename}* ~/dev/firmware/
done
echo -e "}" >> $json_file
# remove last comma
sed -i 's/\(.*\),/\1/' $json_file