-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrkandroid_flash
executable file
·68 lines (54 loc) · 1.3 KB
/
rkandroid_flash
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
#!/bin/bash
set -eo pipefail
message() {
echo "$@" 1>&2
}
if [[ $# -ne 1 && $# -ne 2 ]]; then
message "usage: $0 [folder or .zip] [install or update]"
exit 1
fi
FILE="$1"
case $2 in
install|"")
PARTITIONS="uboot trust kernel boot recovery system misc"
;;
update)
PARTITIONS="uboot trust kernel boot recovery system"
;;
*)
message "Unknown mode: $2."
exit 1
esac
read_file() {
if [[ -d "$FILE" ]]; then
cat "$FILE/$1"
elif [[ -f "$FILE" ]]; then
unzip -p "$FILE" "$(basename "$FILE" .zip)/$1"
else
message "Invalid $FILE."
exit 1
fi
}
if ! which rkdeveloptool &>/dev/null; then
cat <<EOF
Please install rkdeveloptool and try again!
git clone https://github.com/rockchip-linux/rkdeveloptool --depth=1 --single-branch"
cd rkdeveloptool"
./configure
make
sudo make install
EOF
fi
wget -c https://github.com/ayufan-rock64/rkbin/raw/master/rk33/rk3328_loader_ddr786_v1.06.243.bin
if ! rkdeveloptool rid; then
rkdeveloptool db rk3328_loader_ddr786_v1.06.243.bin
fi
echo "Updating device parameters..."
read_file "parameter.txt" | rkflashtool P
for i in ${PARTITIONS[@]}; do
echo "Updating $i partition..."
read_file "$i.img" | rkflashtool w $i
done
echo "Rebooting..."
rkflashtool b
echo "Done."