diff options
author | Marcin Juszkiewicz <hrw@openedhand.com> | 2008-01-18 16:22:28 +0000 |
---|---|---|
committer | Marcin Juszkiewicz <hrw@openedhand.com> | 2008-01-18 16:22:28 +0000 |
commit | 8318e9aaabcf0ee3500316b1fba678269d3fe0f4 (patch) | |
tree | 3f883cabc8c8aede4ff7713b11116f8872c96134 /meta/packages/zaurus-updater/poodle | |
parent | c09736f1048d0e42bb0fc5975223e2b5506e1324 (diff) | |
download | poky-8318e9aaabcf0ee3500316b1fba678269d3fe0f4.tar.gz |
zaurus-updater: replaced all machine ones with unified one (from OE)
It was tested on all supported Zaurus models and is used by Ångström by
default. First version was written in October 2006.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3550 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/zaurus-updater/poodle')
-rw-r--r-- | meta/packages/zaurus-updater/poodle/updater.sh | 231 |
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 | |||
4 | DATAPATH=$1 | ||
5 | TMPPATH=/tmp/update | ||
6 | TMPDATA=$TMPPATH/tmpdata.bin | ||
7 | TMPHEAD=$TMPPATH/tmphead.bin | ||
8 | |||
9 | |||
10 | RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1` | ||
11 | if [ "$RO_MTD_LINE" = "" ]; then | ||
12 | RO_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1` | ||
13 | fi | ||
14 | RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2` | ||
15 | RO_MTD_SIZE_HEX=`echo $RO_MTD_LINE | cut -d" " -f2` | ||
16 | RO_MTD=/dev/mtd$RO_MTD_NO | ||
17 | RO_MTDBLK=/dev/mtdblock$RO_MTD_NO | ||
18 | RO_MTD_SIZE=`dc 0x$RO_MTD_SIZE_HEX 1024 /` | ||
19 | |||
20 | RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1` | ||
21 | if [ "$RW_MTD_LINE" = "" ]; then | ||
22 | RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1` | ||
23 | fi | ||
24 | RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2` | ||
25 | RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2` | ||
26 | RW_MTD=/dev/mtd$RW_MTD_NO | ||
27 | RW_MTDBLK=/dev/mtdblock$RW_MTD_NO | ||
28 | RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /` | ||
29 | |||
30 | LOGOCAL_MTD=/dev/mtd1 | ||
31 | |||
32 | VERBLOCK=0x48000 | ||
33 | MVRBLOCK=0x70000 | ||
34 | |||
35 | RESULT=0 | ||
36 | |||
37 | Cleanup(){ | ||
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 | } | ||
44 | trap 'Cleanup 1' 1 15 | ||
45 | trap '' 2 3 | ||
46 | |||
47 | |||
48 | ### Check model ### | ||
49 | /sbin/writerominfo | ||
50 | MODEL=`cat /proc/deviceinfo/product` | ||
51 | echo 'MODEL:'$MODEL | ||
52 | case "$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 | ;; | ||
62 | esac | ||
63 | |||
64 | mkdir -p $TMPPATH > /dev/null 2>&1 | ||
65 | |||
66 | cd $DATAPATH/ | ||
67 | |||
68 | if [ -e consolescroll ] | ||
69 | then | ||
70 | ./consolescroll | ||
71 | fi | ||
72 | |||
73 | for TARGETFILE in zImage zimage zimage.bin initrd.bin mversion.bin | ||
74 | do | ||
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 | ||
224 | done | ||
225 | |||
226 | #exit 0 | ||
227 | |||
228 | echo 'Please reset' | ||
229 | while true | ||
230 | do | ||
231 | done | ||