forked from ariaboard-com/rockchip_rk3568_linux_sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rkflash.sh
executable file
·181 lines (161 loc) · 3.18 KB
/
rkflash.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
#!/bin/bash
COMMON_DIR=$(cd `dirname $0`; pwd)
if [ -h $0 ]
then
CMD=$(realpath $0)
COMMON_DIR=$(dirname $CMD)
fi
TOP_DIR=$(realpath $COMMON_DIR/../../..)
UPGRADETOOL=$TOP_DIR/tools/linux/Linux_Upgrade_Tool/Linux_Upgrade_Tool/upgrade_tool
ROCKDEV_DIR=$TOP_DIR/rockdev
LOADER=$ROCKDEV_DIR/MiniLoaderAll.bin
PARAMETER=$ROCKDEV_DIR/parameter.txt
UBOOT=$ROCKDEV_DIR/uboot.img
TRUST=$ROCKDEV_DIR/trust.img
BOOT=$ROCKDEV_DIR/boot.img
RECOVERY=$ROCKDEV_DIR/recovery.img
OEM=$ROCKDEV_DIR/oem.img
MISC=$ROCKDEV_DIR/misc.img
ROOTFS=$ROCKDEV_DIR/rootfs.img
USERDATA=$ROCKDEV_DIR/userdata.img
UPDATE=$ROCKDEV_DIR/update.img
if [ ! -n "$1" ];then
echo "flash norecovery images as default"
FLASH_TYPE=norecovery
else
FLASH_TYPE="$1"
fi
if [ $FLASH_TYPE = all ]
then
$UPGRADETOOL ul $LOADER
$UPGRADETOOL di -p $PARAMETER
$UPGRADETOOL di -uboot $UBOOT
$UPGRADETOOL di -trust $TRUST
$UPGRADETOOL di -b $BOOT
$UPGRADETOOL di -r $RECOVERY
$UPGRADETOOL di -m $MISC
$UPGRADETOOL di -oem $OEM
$UPGRADETOOL di -userdata $USERDATA
$UPGRADETOOL di -rootfs $ROOTFS
$UPGRADETOOL rd
fi
if [ $FLASH_TYPE = tb ]
then
$UPGRADETOOL ul $LOADER
$UPGRADETOOL di -p $PARAMETER
$UPGRADETOOL di -uboot $UBOOT
$UPGRADETOOL di -b $BOOT
$UPGRADETOOL rd
fi
if [ $FLASH_TYPE = norecovery ]; then
$UPGRADETOOL ul $LOADER
$UPGRADETOOL di -p $PARAMETER
$UPGRADETOOL di -uboot $UBOOT
$UPGRADETOOL di -trust $TRUST
$UPGRADETOOL di -b $BOOT
$UPGRADETOOL di -oem $OEM
$UPGRADETOOL di -userdata $USERDATA
$UPGRADETOOL di -rootfs $ROOTFS
$UPGRADETOOL rd
fi
if [ $FLASH_TYPE = loader ]
then
if [ -n "$2" ];then
LOADER=$2
fi
echo "flash loader: $LOADER"
$UPGRADETOOL ul $LOADER
exit 0
fi
if [ $FLASH_TYPE = parameter ]
then
if [ -n "$2" ];then
PARAMETER=$2
fi
echo "flash parameter: $PARAMETER"
$UPGRADETOOL di -p $PARAMETER
fi
if [ $FLASH_TYPE = resource ]
then
if [ -n "$2" ];then
RESOURCE=$2
fi
echo "flash resource: $RESOURCE"
$UPGRADETOOL di -resource $RESOURCE
fi
if [ $FLASH_TYPE = uboot ]
then
if [ -n "$2" ];then
UBOOT=$2
fi
echo "flash uboot: $UBOOT"
$UPGRADETOOL di -uboot $UBOOT
fi
if [ $FLASH_TYPE = trust ]
then
if [ -n "$2" ];then
TRUST=$2
fi
echo "flash trust: $TRUST"
$UPGRADETOOL di -trust $TRUST
fi
if [ $FLASH_TYPE = boot ]
then
if [ -n "$2" ];then
BOOT=$2
fi
echo "flash boot: $BOOT"
$UPGRADETOOL di -b $BOOT
fi
if [ $FLASH_TYPE = recovery ]
then
if [ -n "$2" ];then
RECOVERY=$2
fi
echo "flash recovery: $RECOVERY"
$UPGRADETOOL di -r $RECOVERY
fi
if [ $FLASH_TYPE = misc ]
then
if [ -n "$2" ];then
MISC=$2
fi
echo "flash misc: $MISC"
$UPGRADETOOL di -misc $MISC
fi
if [ $FLASH_TYPE = oem ]
then
if [ -n "$2" ];then
OEM=$2
fi
echo "flash oem: $OEM"
$UPGRADETOOL di -oem $OEM
fi
if [ $FLASH_TYPE = userdata ]
then
if [ -n "$2" ];then
USERDATA=$2
fi
echo "flash userdata: $USERDATA"
$UPGRADETOOL di -userdata $USERDATA
fi
if [ $FLASH_TYPE = rootfs ]
then
if [ -n "$2" ];then
ROOTFS=$2
fi
echo "flash rootfs: $ROOTFS"
$UPGRADETOOL di -rootfs $ROOTFS
fi
if [ $FLASH_TYPE = update ]
then
$UPGRADETOOL uf $UPDATE
fi
if [ $FLASH_TYPE = rd ]
then
$UPGRADETOOL rd
fi
if [ $FLASH_TYPE = erase ]
then
$UPGRADETOOL EF $LOADER
fi