3
3
source /etc/device_config
4
4
5
5
file=/sys/kernel/config/usb_gadget/composite_gadget/functions/mass_storage.0/lun.0/file
6
- bootimage=/mnt/boot.frm
7
- conf=/mnt/config.txt
6
+ bootimage=/mnt/msd/ boot.frm
7
+ conf=/mnt/msd/ config.txt
8
8
img=/opt/vfat.img
9
9
10
10
ini_parser () {
@@ -82,7 +82,7 @@ process_ini() {
82
82
ini_parser $FILE " SYSTEM"
83
83
ini_parser $FILE " USB_ETHERNET"
84
84
85
- rm -f /mnt/SUCCESS_ENV_UPDATE /mnt/FAILED_INVALID_UBOOT_ENV /mnt/CAL_STATUS
85
+ rm -f /mnt/msd/ SUCCESS_ENV_UPDATE /mnt/msd/ FAILED_INVALID_UBOOT_ENV /mnt/msd /CAL_STATUS
86
86
87
87
88
88
fw_printenv qspiboot
@@ -102,9 +102,9 @@ process_ini() {
102
102
fw_setenv -s /opt/fw_set.tmp
103
103
rm /opt/fw_set.tmp
104
104
flash_indication_off
105
- touch /mnt/SUCCESS_ENV_UPDATE
105
+ touch /mnt/msd/ SUCCESS_ENV_UPDATE
106
106
else
107
- touch /mnt/FAILED_INVALID_UBOOT_ENV
107
+ touch /mnt/msd/ FAILED_INVALID_UBOOT_ENV
108
108
fi
109
109
110
110
ini_parser $FILE " ACTIONS"
@@ -121,20 +121,29 @@ process_ini() {
121
121
122
122
if [ " $diagnostic_report " == " 1" ]
123
123
then
124
- make_diagnostic_report /mnt/diagnostic_report
124
+ make_diagnostic_report /mnt/msd/ diagnostic_report
125
125
fi
126
126
127
127
if [ " $calibrate " -gt " 70000000" ]
128
128
then
129
- calibrate $calibrate > /mnt/CAL_STATUS
129
+ calibrate $calibrate > /mnt/msd/CAL_STATUS
130
+ fi
131
+
132
+ echo here_1: > /mnt/msd/status
133
+
134
+ if [ " $revert_passwd " == " 1" ]
135
+ then
136
+ echo here $revert_passwd >> /mnt/msd/status
137
+ rm -f /mnt/jffs2/etc/passwd /mnt/jffs2/etc/group /mnt/jffs2/etc/password.md5 /mnt/jffs2/etc/shadow 2>&1 >> /mnt/msd/status
138
+ echo here_2: >> /mnt/msd/status
130
139
fi
131
140
132
141
md5sum $FILE > /opt/config.md5
133
142
}
134
143
135
144
handle_boot_frm () {
136
145
FILE=" $1 "
137
- rm -f /mnt/BOOT_SUCCESS /mnt/BOOT_FAILED /mnt/FAILED_MTD_PARTITION_ERROR /mnt/FAILED_BOOT_CHSUM_ERROR
146
+ rm -f /mnt/msd/ BOOT_SUCCESS /mnt/msd/ BOOT_FAILED /mnt/msd/ FAILED_MTD_PARTITION_ERROR /mnt/msd /FAILED_BOOT_CHSUM_ERROR
138
147
head -3 /proc/mtd | sed ' s/00010000/00001000/g' > /opt/mtd
139
148
140
149
md5=` tail -c 33 ${FILE} `
@@ -153,14 +162,14 @@ handle_boot_frm () {
153
162
diff -w /opt/mtd /opt/mtd-info.txt
154
163
if [ $? -eq 0 ]; then
155
164
flash_indication_on
156
- dd if=/opt/boot.bin of=/dev/mtdblock0 bs=64k && dd if=/opt/u-boot-env.bin of=/dev/mtdblock1 bs=64k && do_reset=1 && touch /mnt/BOOT_SUCCESS || touch /mnt/BOOT_FAILED
165
+ dd if=/opt/boot.bin of=/dev/mtdblock0 bs=64k && dd if=/opt/u-boot-env.bin of=/dev/mtdblock1 bs=64k && do_reset=1 && touch /mnt/msd/ BOOT_SUCCESS || touch /mnt/msd /BOOT_FAILED
157
166
flash_indication_off
158
167
else
159
- cat /opt/mtd /opt/mtd-info.txt > /mnt/FAILED_MTD_PARTITION_ERROR
168
+ cat /opt/mtd /opt/mtd-info.txt > /mnt/msd/ FAILED_MTD_PARTITION_ERROR
160
169
do_reset=0
161
170
fi
162
171
else
163
- echo $md5 $frm > /mnt/FAILED_BOOT_CHSUM_ERROR
172
+ echo $md5 $frm > /mnt/msd/ FAILED_BOOT_CHSUM_ERROR
164
173
do_reset=0
165
174
fi
166
175
@@ -172,18 +181,18 @@ handle_boot_frm () {
172
181
handle_frimware_frm () {
173
182
FILE=" $1 "
174
183
MAGIC=" $2 "
175
- rm -f /mnt/SUCCESS /mnt/FAILED /mnt/FAILED_FIRMWARE_CHSUM_ERROR
184
+ rm -f /mnt/msd/ SUCCESS /mnt/msd/ FAILED /mnt/msd /FAILED_FIRMWARE_CHSUM_ERROR
176
185
md5=` tail -c 33 ${FILE} `
177
186
head -c -33 ${FILE} > /opt/firmware.frm
178
187
FRM_SIZE=` cat /opt/firmware.frm | wc -c | xargs printf " %X\n" `
179
188
frm=` md5sum /opt/firmware.frm | cut -d ' ' -f 1`
180
189
if [ " $frm " = " $md5 " ]
181
190
then
182
191
flash_indication_on
183
- grep -q " ${MAGIC} " /opt/firmware.frm && dd if=/opt/firmware.frm of=/dev/mtdblock3 bs=64k && fw_setenv fit_size ${FRM_SIZE} && do_reset=1 && touch /mnt/SUCCESS || touch /mnt/FAILED
192
+ grep -q " ${MAGIC} " /opt/firmware.frm && dd if=/opt/firmware.frm of=/dev/mtdblock3 bs=64k && fw_setenv fit_size ${FRM_SIZE} && do_reset=1 && touch /mnt/msd/ SUCCESS || touch /mnt/msd /FAILED
184
193
flash_indication_off
185
194
else
186
- echo $frm $md5 > /mnt/FAILED_FIRMWARE_CHSUM_ERROR
195
+ echo $frm $md5 > /mnt/msd/ FAILED_FIRMWARE_CHSUM_ERROR
187
196
do_reset=0
188
197
fi
189
198
200
209
then
201
210
do_reset=0
202
211
losetup /dev/loop7 $img -o 512
203
- mount /dev/loop7 /mnt
212
+ mkdir -p /mnt/msd
213
+ mount /dev/loop7 /mnt/msd
204
214
205
- if [[ -s /mnt/$TARGET -fw-* .zip ]]
215
+ if [[ -s /mnt/msd/ $TARGET -fw-* .zip ]]
206
216
then
207
- mv /mnt/$TARGET -fw-* .zip /opt/
208
- unzip -o /opt/$TARGET -fw-* .zip * .frm -d /mnt
217
+ mv /mnt/msd/ $TARGET -fw-* .zip /opt/
218
+ unzip -o /opt/$TARGET -fw-* .zip * .frm -d /mnt/msd
209
219
rm /opt/$TARGET -fw-* .zip
210
220
fi
211
221
222
232
md5sum -c /opt/config.md5 || process_ini $conf
223
233
224
234
if [ " $TARGET " == " m2k" ]; then
225
- if [[ -s /mnt/${CALIBFILENAME} ]]; then
235
+ if [[ -s /mnt/msd/ ${CALIBFILENAME} ]]; then
226
236
md5sum -c /opt/${CALIBFILENAME} .md5
227
237
if [ $? -ne 0 ]; then
228
- cp /mnt/${CALIBFILENAME} /mnt_jffs2 /${CALIBFILENAME} && do_reset=1
238
+ cp /mnt/msd/ ${CALIBFILENAME} /mnt/jffs2 /${CALIBFILENAME} && do_reset=1
229
239
fi
230
240
231
241
else
232
- rm /mnt_jffs2 /${CALIBFILENAME} && do_reset=1
242
+ rm /mnt/jffs2 /${CALIBFILENAME} && do_reset=1
233
243
fi
234
244
235
- if [[ -s /mnt/${CALIBFILENAME_FACTORY} ]]; then
236
- if [[ ! -s /mnt_jffs2 /${CALIBFILENAME_FACTORY} ]]; then
237
- cp /mnt/${CALIBFILENAME_FACTORY} /mnt_jffs2 /${CALIBFILENAME_FACTORY}
245
+ if [[ -s /mnt/msd/ ${CALIBFILENAME_FACTORY} ]]; then
246
+ if [[ ! -s /mnt/jffs2 /${CALIBFILENAME_FACTORY} ]]; then
247
+ cp /mnt/msd/ ${CALIBFILENAME_FACTORY} /mnt/jffs2 /${CALIBFILENAME_FACTORY}
238
248
do_reset=1
239
249
fi
240
250
fi
245
255
reset
246
256
fi
247
257
248
- cp /opt/ipaddr-* /mnt 2> /dev/null
258
+ cp /opt/ipaddr-* /mnt/msd 2> /dev/null
249
259
250
- umount /mnt
260
+ umount /mnt/msd
251
261
# losetup -d /dev/loop7
252
262
echo $img > $file
253
263
flash_indication_off
0 commit comments