-
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·135 lines (110 loc) · 3.99 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·135 lines (110 loc) · 3.99 KB
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
#!/usr/bin/env bash
function usage {
echo -e "Usage:"
echo -e "$0 CMD"
echo -e "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)"
exit 1
}
if [ $# -le 0 ]; then
usage
fi
function extract_lan_rom()
{
if which UEFIExtract &> /dev/null; then
echo "Downloading and extracting original firmware"
wget https://download.msi.com/bos_exe/mb/7D25v13.zip 2> /dev/null && \
unzip 7D25v13.zip > /dev/null
if [[ -f 7D25v13/E7D25IMS.130 ]]; then
echo "Extracting LAN ROM from vendor firmware"
UEFIExtract 7D25v13/E7D25IMS.130 DEB917C0-C56A-4860-A05B-BF2F22EBB717 \
-o ./lanrom -m body > /dev/null && \
cp lanrom/body_1.bin LanRom.efi && \
rm -rf lanrom 7D25v13 7D25v13.zip && \
echo "LAN ROM extracted successfully" && \
return 0
fi
echo "Failed to extract LAN ROM. Network boot will not work."
return 1
else
echo "UEFIExtract not found, but it's required to extract LAN ROM!"
echo "Install it from: https://github.com/LongSoft/UEFITool/releases/download/A59/UEFIExtract_NE_A59_linux_x86_64.zip"
echo "Failed to extract LAN ROM. Network boot will not work."
return 1
fi
}
function build_image_z690 {
version=$(git describe --abbrev=1 --tags --always --dirty --match "msi_ms7d25*")
version=${version//msi_ms7d25_/}
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 configs/config.msi_ms7d25_$1 .config
extract_lan_rom
if [ $? -eq 0 ]; then
echo "CONFIG_EDK2_LAN_ROM_DRIVER=\"LanRom.efi\"" >> .config
fi
git submodule update --init --checkout
echo "Building Dasharo compatible with MSI PRO Z690-A (WIFI) $2(version $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:2021-09-23_b0d87f753c \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom msi_ms7d25_${version}_$1.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/msi_ms7d25_${version}_$1.rom"
sha256sum msi_ms7d25_${version}_$1.rom > msi_ms7d25_${version}_$1.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
function build_image_z790 {
version=$(git describe --abbrev=1 --tags --always --dirty --match "msi_ms7e06*")
version=${version//msi_ms7e06_/}
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 configs/config.msi_ms7e06_$1 .config
extract_lan_rom
if [ $? -eq 0 ]; then
echo "CONFIG_EDK2_LAN_ROM_DRIVER=\"LanRom.efi\"" >> .config
fi
git submodule update --init --checkout
echo "Building Dasharo compatible with MSI PRO Z790-P (WIFI) $2(version $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:2021-09-23_b0d87f753c \
/bin/bash -c "make olddefconfig && make -j$(nproc)"
cp build/coreboot.rom msi_ms7e06_${version}_$1.rom
if [ $? -eq 0 ]; then
echo "Result binary placed in $PWD/msi_ms7e06_${version}_$1.rom"
sha256sum msi_ms7e06_${version}_$1.rom > msi_ms7e06_${version}_$1.rom.sha256
else
echo "Build failed!"
exit 1
fi
}
CMD="$1"
case "$CMD" in
"ddr4" | "z690a_ddr4")
build_image_z690 ddr4 "DDR4 "
;;
"ddr5" | "z690a_ddr5")
build_image_z690 ddr5 "DDR5 "
;;
"z790p_ddr4")
build_image_z790 ddr4 "DDR4 "
;;
"z790p_ddr5")
build_image_z790 ddr5 "DDR5 "
;;
*)
echo "Invalid command: \"$CMD\""
;;
esac