summaryrefslogtreecommitdiffstats
path: root/meta/packages/zaurus-updater/poodle/updater.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/zaurus-updater/poodle/updater.sh')
-rw-r--r--meta/packages/zaurus-updater/poodle/updater.sh231
1 files changed, 0 insertions, 231 deletions
diff --git a/meta/packages/zaurus-updater/poodle/updater.sh b/meta/packages/zaurus-updater/poodle/updater.sh
deleted file mode 100644
index a5e3f846ea..0000000000
--- a/meta/packages/zaurus-updater/poodle/updater.sh
+++ /dev/null
@@ -1,231 +0,0 @@
1#!/bin/sh
2
3
4DATAPATH=$1
5TMPPATH=/tmp/update
6TMPDATA=$TMPPATH/tmpdata.bin
7TMPHEAD=$TMPPATH/tmphead.bin
8
9
10RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
11if [ "$RO_MTD_LINE" = "" ]; then
12 RO_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
13fi
14RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
15RO_MTD_SIZE_HEX=`echo $RO_MTD_LINE | cut -d" " -f2`
16RO_MTD=/dev/mtd$RO_MTD_NO
17RO_MTDBLK=/dev/mtdblock$RO_MTD_NO
18RO_MTD_SIZE=`dc 0x$RO_MTD_SIZE_HEX 1024 /`
19
20RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
21if [ "$RW_MTD_LINE" = "" ]; then
22 RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
23fi
24RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
25RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`
26RW_MTD=/dev/mtd$RW_MTD_NO
27RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
28RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`
29
30LOGOCAL_MTD=/dev/mtd1
31
32VERBLOCK=0x48000
33MVRBLOCK=0x70000
34
35RESULT=0
36
37Cleanup(){
38 rm -f $VTMPNAME > /dev/null 2>&1
39 rm -f $MTMPNAME > /dev/null 2>&1
40 rm $CTRLPATH/* > /dev/null 2>&1
41 rm $DATAPATH/* > /dev/null 2>&1
42 exit $1
43}
44trap 'Cleanup 1' 1 15
45trap '' 2 3
46
47
48### Check model ###
49/sbin/writerominfo
50MODEL=`cat /proc/deviceinfo/product`
51echo 'MODEL:'$MODEL
52case "$MODEL" in
53 SL-B500) ;;
54 SL-5600) ;;
55 *)
56 echo 'ERROR:Invalid model!'
57 echo 'Please reset'
58 while true
59 do
60 done
61 ;;
62esac
63
64mkdir -p $TMPPATH > /dev/null 2>&1
65
66cd $DATAPATH/
67
68if [ -e consolescroll ]
69then
70 ./consolescroll
71fi
72
73for TARGETFILE in zImage zimage zimage.bin initrd.bin mversion.bin
74do
75 if [ -e $TARGETFILE ]
76 then
77 rm -f $TMPPATH/*.bin > /dev/null 2>&1
78 DATASIZE=`wc -c $TARGETFILE`
79 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
80
81 #echo $TARGETFILE':'$DATASIZE'bytes'
82 case "$TARGETFILE" in
83 zImage|zimage|zimage.bin)
84 echo 'kernel'
85 ISLOGICAL=1
86 MODULEID=5
87 MODULESIZE=0x13C000
88 ADDR=`dc 0xE0000`
89 ISFORMATTED=1
90 DATAPOS=0
91 ONESIZE=524288
92 HDTOP=`expr $DATASIZE - 16`
93 /sbin/bcut -a $HDTOP -s 16 -o $TMPHEAD $TARGETFILE
94 ;;
95 initrd.bin)
96 echo 'RO file system'
97 ISLOGICAL=0
98 MODULEID=6
99 MODULESIZE=0x1600000
100 ADDR=0
101 ISFORMATTED=0
102 TARGET_MTD=$RO_MTD
103 DATAPOS=16
104 ONESIZE=1048576
105 /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
106 ;;
107 mversion.bin)
108 echo 'Master version'
109 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
110 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
111 /sbin/verchg -m $MTMPNAME $TARGETFILE 0 0 > /dev/null 2>&1
112 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
113 rm -f $MTMPNAME > /dev/null 2>&1
114 echo 'Success!'
115 continue
116 ;;
117 *)
118 continue;
119 ;;
120 esac
121
122 #check version
123 /sbin/bcut -s 6 -o $TMPDATA $TMPHEAD
124 if [ `cat $TMPDATA` != "SHARP!" ] > /dev/null 2>&1
125 then
126 #no version info...
127 rm -f $TMPHEAD > /dev/null 2>&1
128 DATAPOS=0
129 fi
130
131 #format?
132 if [ $ISFORMATTED = 0 ]
133 then
134 echo -n 'Flash erasing...'
135 /sbin/eraseall $TARGET_MTD 2> /dev/null > /dev/null
136 #/sbin/eraseall $TARGET_MTD 2
137 echo 'done'
138 ISFORMATTED=1
139 fi
140
141 echo ''
142 echo '0% 100%'
143 PROGSTEP=`expr $DATASIZE / $ONESIZE + 1`
144 PROGSTEP=`expr 25 / $PROGSTEP`
145 if [ $PROGSTEP = 0 ]
146 then
147 PROGSTEP=1
148 fi
149
150 #header information
151 if [ -e $TMPHEAD ]
152 then
153 VTMPNAME=$TMPPATH'/vtmp'`date '+%s'`'.tmp'
154 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
155 /sbin/nandlogical $LOGOCAL_MTD READ $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
156 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
157
158 #echo 'found header'
159 /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
160 /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
161 fi
162
163 #loop
164 while [ $DATAPOS -lt $DATASIZE ]
165 do
166 #data create
167 bcut -a $DATAPOS -s $ONESIZE -o $TMPDATA $TARGETFILE
168 TMPSIZE=`wc -c $TMPDATA`
169 TMPSIZE=`echo $TMPSIZE | cut -d' ' -f1`
170 DATAPOS=`expr $DATAPOS + $TMPSIZE`
171
172 #handle data file
173 #echo 'ADDR='$ADDR
174 #echo 'SIZE='$TMPSIZE
175 if [ $ISLOGICAL = 0 ]
176 then
177 next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1`
178 if [ "$next_addr" = "" ]; then
179 echo "ERROR:flash write"
180 rm $TMPDATA > /dev/null 2>&1
181 RESULT=3
182 break;
183 fi
184 ADDR=$next_addr
185 else
186 /sbin/nandlogical $LOGOCAL_MTD WRITE $ADDR $DATASIZE $TMPDATA > /dev/null 2>&1
187 ADDR=`expr $ADDR + $TMPSIZE`
188 fi
189
190 rm $TMPDATA > /dev/null 2>&1
191
192 #progress
193 SPNUM=0
194 while [ $SPNUM -lt $PROGSTEP ]
195 do
196 echo -n '.'
197 SPNUM=`expr $SPNUM + 1`
198 done
199 done
200
201 echo ''
202
203#finish
204 rm -f $TMPPATH/*.bin > /dev/null 2>&1
205
206 if [ $RESULT = 0 ]
207 then
208 if [ -e $VTMPNAME ]
209 then
210 /sbin/nandlogical $LOGOCAL_MTD WRITE $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
211 rm -f $VTMPNAME > /dev/null 2>&1
212 fi
213 if [ -e $MTMPNAME ]
214 then
215 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
216 rm -f $MTMPNAME > /dev/null 2>&1
217 fi
218 echo 'Success!'
219 else
220 echo 'Error!'
221# exit $RESULT
222 fi
223 fi
224done
225
226#exit 0
227
228echo 'Please reset'
229while true
230do
231done