-
Notifications
You must be signed in to change notification settings - Fork 9
/
flash_firmware.sh
executable file
·57 lines (50 loc) · 1.16 KB
/
flash_firmware.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
#!/usr/bin/env bash
#
# Flash firmware zip generated by xiaomi-flashable-firmware-creator
# (https://xiaomifirmwareupdater.com/) on marble
#
# Author: Adithya R (@ghostrider_reborn)
function wait_exit() {
read -p "Press enter to exit..."
exit $1
}
# Firmware zip must be stored as firmware.zip
if [ ! -f "firmware.zip" ]; then
echo "Error: firmware.zip not found, download and place it first."
wait_exit 1
fi
echo "Extracting firmware.zip..."
unzip -o firmware.zip -d firmware
partitions=(
"abl"
"aop"
"aop_config"
"bluetooth"
"cpucp"
"devcfg"
"dsp"
"featenabler"
"hyp"
"imagefv"
"keymaster"
"modem"
"qupfw"
"shrm"
"tz"
"uefi"
"uefisecapp"
"xbl"
"xbl_config"
"xbl_ramdump"
)
tools_path="platform-tools-linux"
[ "$(uname -s)" = "Darwin" ] && tools_path="platform-tools-darwin"
for partition in ${partitions[@]}; do
echo -e "\nFlashing $partition..."
if ! "./$tools_path/fastboot" flash ${partition}_ab firmware/firmware-update/$partition.img; then
echo -e "\nError: Flashing $partition failed!"
wait_exit 1
fi
done
echo -e "\nCompleted succesfully!"
wait_exit