summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openedhand.com>2008-01-18 16:22:28 +0000
committerMarcin Juszkiewicz <hrw@openedhand.com>2008-01-18 16:22:28 +0000
commit8318e9aaabcf0ee3500316b1fba678269d3fe0f4 (patch)
tree3f883cabc8c8aede4ff7713b11116f8872c96134
parentc09736f1048d0e42bb0fc5975223e2b5506e1324 (diff)
downloadpoky-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
-rw-r--r--meta/packages/zaurus-updater/akita/updater.sh252
-rw-r--r--meta/packages/zaurus-updater/c7x0/updater.sh242
-rw-r--r--meta/packages/zaurus-updater/poodle/updater.sh231
-rwxr-xr-xmeta/packages/zaurus-updater/spitz/updater.sh280
-rw-r--r--meta/packages/zaurus-updater/tosa/updater.sh241
-rw-r--r--meta/packages/zaurus-updater/zaurus-updater.bb6
-rw-r--r--meta/packages/zaurus-updater/zaurus-updater/updater.sh481
7 files changed, 486 insertions, 1247 deletions
diff --git a/meta/packages/zaurus-updater/akita/updater.sh b/meta/packages/zaurus-updater/akita/updater.sh
deleted file mode 100644
index 5399e5254e..0000000000
--- a/meta/packages/zaurus-updater/akita/updater.sh
+++ /dev/null
@@ -1,252 +0,0 @@
1#!/bin/sh
2
3
4DATAPATH=$1
5TMPPATH=/tmp/update
6TMPDATA=$TMPPATH/tmpdata.bin
7TMPHEAD=$TMPPATH/tmphead.bin
8
9WFLG_KERNEL=0
10WFLG_INITRD=0
11WFLG_MVERSION=0
12
13RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
14if [ "$RO_MTD_LINE" = "" ]; then
15 RO_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
16fi
17RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
18RO_MTD_SIZE_HEX=`echo $RO_MTD_LINE | cut -d" " -f2`
19RO_MTD=/dev/mtd$RO_MTD_NO
20RO_MTDBLK=/dev/mtdblock$RO_MTD_NO
21RO_MTD_SIZE=`dc 0x$RO_MTD_SIZE_HEX 1024 /`
22
23RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
24if [ "$RW_MTD_LINE" = "" ]; then
25 RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
26fi
27RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
28RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`
29RW_MTD=/dev/mtd$RW_MTD_NO
30RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
31RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`
32
33LOGOCAL_MTD=/dev/mtd1
34
35VERBLOCK=0x48000
36MVRBLOCK=0x70000
37
38RESULT=0
39
40Cleanup(){
41 rm -f $VTMPNAME > /dev/null 2>&1
42 rm -f $MTMPNAME > /dev/null 2>&1
43 rm $CTRLPATH/* > /dev/null 2>&1
44 rm $DATAPATH/* > /dev/null 2>&1
45 exit $1
46}
47trap 'Cleanup 1' 1 15
48trap '' 2 3
49
50
51### Check model ###
52/sbin/writerominfo
53MODEL=`cat /proc/deviceinfo/product`
54echo 'MODEL:'$MODEL
55case "$MODEL" in
56 SL-C700) ;;
57 SL-C750) ;;
58 SL-C760) ;;
59 SL-C860) ;;
60 SL-C1000) ;;
61 SL-B500) ;;
62 SL-5600) ;;
63 *)
64 echo 'ERROR:Invalid model!'
65 echo 'Please reset'
66 while true
67 do
68 done
69 ;;
70esac
71
72mkdir -p $TMPPATH > /dev/null 2>&1
73
74cd $DATAPATH/
75
76for TARGETFILE in zImage.bin zimage.bin ZIMAGE.BIN initrd.bin INITRD.BIN mversion.bin MVERSION.BIN
77do
78 if [ -e $TARGETFILE ]
79 then
80 rm -f $TMPPATH/*.bin > /dev/null 2>&1
81 DATASIZE=`wc -c $TARGETFILE`
82 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
83
84 #echo $TARGETFILE':'$DATASIZE'bytes'
85 TARGETTYPE=Invalid
86 case "$TARGETFILE" in
87 zImage.bin) TARGETTYPE=Kernel;;
88 zimage.bin) TARGETTYPE=Kernel;;
89 ZIMAGE.BIN) TARGETTYPE=Kernel;;
90 initrd.bin) TARGETTYPE=RoFs;;
91 INITRD.BIN) TARGETTYPE=RoFs;;
92 mversion.bin) TARGETTYPE=MasterVer;;
93 MVERSION.BIN) TARGETTYPE=MasterVer;;
94 *)
95 continue
96 ;;
97 esac
98
99 case "$TARGETTYPE" in
100 Kernel)
101 if [ $WFLG_KERNEL != 0 ]
102 then
103 continue
104 fi
105 WFLG_KERNEL=1
106 echo 'kernel'
107 ISLOGICAL=1
108 MODULEID=5
109 MODULESIZE=0x13C000
110 ADDR=`dc 0xE0000`
111 ISFORMATTED=1
112 DATAPOS=0
113 ONESIZE=524288
114 HDTOP=`expr $DATASIZE - 16`
115 /sbin/bcut -a $HDTOP -s 16 -o $TMPHEAD $TARGETFILE
116 ;;
117 RoFs)
118 if [ $WFLG_INITRD != 0 ]
119 then
120 continue
121 fi
122 WFLG_INITRD=1
123 echo 'RO file system'
124 ISLOGICAL=0
125 MODULEID=6
126 MODULESIZE=0x1900000
127 ADDR=0
128 ISFORMATTED=0
129 TARGET_MTD=$RO_MTD
130 DATAPOS=16
131 ONESIZE=1048576
132 /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
133 ;;
134 MasterVer)
135 if [ $WFLG_MVERSION != 0 ]
136 then
137 continue
138 fi
139 WFLG_MVERSION=1
140 echo 'Master version'
141 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
142 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
143 /sbin/verchg -m $MTMPNAME $TARGETFILE 0 0 > /dev/null 2>&1
144 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
145 rm -f $MTMPNAME > /dev/null 2>&1
146 echo 'Success!'
147 continue
148 ;;
149 *)
150 continue
151 ;;
152 esac
153
154
155 #format?
156 if [ $ISFORMATTED = 0 ]
157 then
158 echo -n 'Flash erasing...'
159 /sbin/eraseall $TARGET_MTD 2> /dev/null > /dev/null
160 #/sbin/eraseall $TARGET_MTD 2
161 echo 'done'
162 ISFORMATTED=1
163 fi
164
165 echo ''
166 echo '0% 100%'
167 PROGSTEP=`expr $DATASIZE / $ONESIZE + 1`
168 PROGSTEP=`expr 25 / $PROGSTEP`
169 if [ $PROGSTEP = 0 ]
170 then
171 PROGSTEP=1
172 fi
173
174 #00 means header information
175 VTMPNAME=$TMPPATH'/vtmp'`date '+%s'`'.tmp'
176 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
177 /sbin/nandlogical $LOGOCAL_MTD READ $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
178 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
179
180 #echo 'found header'
181 /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
182 /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
183
184 if [ "$MODEL" = "SL-C1000" ] && [ $TARGETTYPE = Kernel ]; then
185 echo $TARGETFILE':'$DATASIZE'bytes'
186 echo ' ' > /tmp/data
187 /sbin/nandlogical $LOGOCAL_MTD WRITE 0x60100 16 /tmp/data > /dev/null 2>&1
188 /sbin/nandlogical $LOGOCAL_MTD WRITE 0xe0000 $DATASIZE $TARGETFILE > /dev/null 2>&1
189 /sbin/nandlogical $LOGOCAL_MTD WRITE 0x21bff0 16 /tmp/data > /dev/null 2>&1
190 #loop
191 else
192 while [ $DATAPOS -lt $DATASIZE ]
193 do
194 #data create
195 bcut -a $DATAPOS -s $ONESIZE -o $TMPDATA $TARGETFILE
196 TMPSIZE=`wc -c $TMPDATA`
197 TMPSIZE=`echo $TMPSIZE | cut -d' ' -f1`
198 DATAPOS=`expr $DATAPOS + $TMPSIZE`
199
200 #handle data file
201 #echo 'ADDR='$ADDR
202 #echo 'SIZE='$TMPSIZE
203 #echo 'TMPDATA='$TMPDATA
204 if [ $ISLOGICAL = 0 ]
205 then
206 next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1`
207 if [ "$next_addr" = "" ]; then
208 echo "ERROR:flash write"
209 rm $TMPDATA > /dev/null 2>&1
210 RESULT=3
211 break;
212 fi
213 ADDR=$next_addr
214 else
215 /sbin/nandlogical $LOGOCAL_MTD WRITE $ADDR $DATASIZE $TMPDATA > /dev/null 2>&1
216 ADDR=`expr $ADDR + $TMPSIZE`
217 fi
218
219 rm $TMPDATA > /dev/null 2>&1
220
221 #progress
222 SPNUM=0
223 while [ $SPNUM -lt $PROGSTEP ]
224 do
225 echo -n '.'
226 SPNUM=`expr $SPNUM + 1`
227 done
228 done
229
230 fi
231
232 echo ''
233
234#finish
235 rm -f $TMPPATH/*.bin > /dev/null 2>&1
236
237 if [ $RESULT = 0 ]
238 then
239 /sbin/nandlogical $LOGOCAL_MTD WRITE $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
240 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
241
242 rm -f $VTMPNAME > /dev/null 2>&1
243 rm -f $MTMPNAME > /dev/null 2>&1
244 echo 'Success!'
245 else
246 echo 'Error!'
247 exit $RESULT
248 fi
249 fi
250done
251
252exit 0
diff --git a/meta/packages/zaurus-updater/c7x0/updater.sh b/meta/packages/zaurus-updater/c7x0/updater.sh
deleted file mode 100644
index 290030ca2d..0000000000
--- a/meta/packages/zaurus-updater/c7x0/updater.sh
+++ /dev/null
@@ -1,242 +0,0 @@
1#!/bin/sh
2
3
4DATAPATH=$1
5TMPPATH=/tmp/update
6TMPDATA=$TMPPATH/tmpdata.bin
7TMPHEAD=$TMPPATH/tmphead.bin
8
9WFLG_KERNEL=0
10WFLG_INITRD=0
11WFLG_MVERSION=0
12
13RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
14if [ "$RO_MTD_LINE" = "" ]; then
15 RO_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
16fi
17RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
18RO_MTD_SIZE_HEX=`echo $RO_MTD_LINE | cut -d" " -f2`
19RO_MTD=/dev/mtd$RO_MTD_NO
20RO_MTDBLK=/dev/mtdblock$RO_MTD_NO
21RO_MTD_SIZE=`dc 0x$RO_MTD_SIZE_HEX 1024 /`
22
23RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
24if [ "$RW_MTD_LINE" = "" ]; then
25 RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
26fi
27RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
28RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`
29RW_MTD=/dev/mtd$RW_MTD_NO
30RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
31RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`
32
33LOGOCAL_MTD=/dev/mtd1
34
35VERBLOCK=0x48000
36MVRBLOCK=0x70000
37
38RESULT=0
39
40Cleanup(){
41 rm -f $VTMPNAME > /dev/null 2>&1
42 rm -f $MTMPNAME > /dev/null 2>&1
43 rm $CTRLPATH/* > /dev/null 2>&1
44 rm $DATAPATH/* > /dev/null 2>&1
45 exit $1
46}
47trap 'Cleanup 1' 1 15
48trap '' 2 3
49
50
51### Check model ###
52/sbin/writerominfo
53MODEL=`cat /proc/deviceinfo/product`
54echo 'MODEL:'$MODEL
55case "$MODEL" in
56 SL-7500) ;;
57 SL-C700) ;;
58 SL-C750) ;;
59 SL-C760) ;;
60 SL-C860) ;;
61 SL-B500) ;;
62 SL-5600) ;;
63 *)
64 echo 'ERROR:Invalid model!'
65 echo 'Please reset'
66 while true
67 do
68 done
69 ;;
70esac
71
72mkdir -p $TMPPATH > /dev/null 2>&1
73
74cd $DATAPATH/
75
76for TARGETFILE in zImage.bin zimage.bin ZIMAGE.BIN initrd.bin INITRD.BIN mversion.bin MVERSION.BIN
77do
78 if [ -e $TARGETFILE ]
79 then
80 rm -f $TMPPATH/*.bin > /dev/null 2>&1
81 DATASIZE=`wc -c $TARGETFILE`
82 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
83
84 #echo $TARGETFILE':'$DATASIZE'bytes'
85 TARGETTYPE=Invalid
86 case "$TARGETFILE" in
87 zImage.bin) TARGETTYPE=Kernel;;
88 zimage.bin) TARGETTYPE=Kernel;;
89 ZIMAGE.BIN) TARGETTYPE=Kernel;;
90 initrd.bin) TARGETTYPE=RoFs;;
91 INITRD.BIN) TARGETTYPE=RoFs;;
92 mversion.bin) TARGETTYPE=MasterVer;;
93 MVERSION.BIN) TARGETTYPE=MasterVer;;
94 *)
95 continue
96 ;;
97 esac
98
99 case "$TARGETTYPE" in
100 Kernel)
101 if [ $WFLG_KERNEL != 0 ]
102 then
103 continue
104 fi
105 WFLG_KERNEL=1
106 echo 'kernel'
107 ISLOGICAL=1
108 MODULEID=5
109 MODULESIZE=0x13C000
110 ADDR=`dc 0xE0000`
111 ISFORMATTED=1
112 DATAPOS=0
113 ONESIZE=524288
114 HDTOP=`expr $DATASIZE - 16`
115 /sbin/bcut -a $HDTOP -s 16 -o $TMPHEAD $TARGETFILE
116 ;;
117 RoFs)
118 if [ $WFLG_INITRD != 0 ]
119 then
120 continue
121 fi
122 WFLG_INITRD=1
123 echo 'RO file system'
124 ISLOGICAL=0
125 MODULEID=6
126 MODULESIZE=0x1900000
127 ADDR=0
128 ISFORMATTED=0
129 TARGET_MTD=$RO_MTD
130 DATAPOS=16
131 ONESIZE=1048576
132 /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
133 ;;
134 MasterVer)
135 if [ $WFLG_MVERSION != 0 ]
136 then
137 continue
138 fi
139 WFLG_MVERSION=1
140 echo 'Master version'
141 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
142 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
143 /sbin/verchg -m $MTMPNAME $TARGETFILE 0 0 > /dev/null 2>&1
144 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
145 rm -f $MTMPNAME > /dev/null 2>&1
146 echo 'Success!'
147 continue
148 ;;
149 *)
150 continue
151 ;;
152 esac
153
154
155 #format?
156 if [ $ISFORMATTED = 0 ]
157 then
158 echo -n 'Flash erasing...'
159 /sbin/eraseall $TARGET_MTD 2> /dev/null > /dev/null
160 #/sbin/eraseall $TARGET_MTD 2
161 echo 'done'
162 ISFORMATTED=1
163 fi
164
165 echo ''
166 echo '0% 100%'
167 PROGSTEP=`expr $DATASIZE / $ONESIZE + 1`
168 PROGSTEP=`expr 25 / $PROGSTEP`
169 if [ $PROGSTEP = 0 ]
170 then
171 PROGSTEP=1
172 fi
173
174 #00 means header information
175 VTMPNAME=$TMPPATH'/vtmp'`date '+%s'`'.tmp'
176 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
177 /sbin/nandlogical $LOGOCAL_MTD READ $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
178 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
179
180 #echo 'found header'
181 /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
182 /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
183
184 #loop
185 while [ $DATAPOS -lt $DATASIZE ]
186 do
187 #data create
188 bcut -a $DATAPOS -s $ONESIZE -o $TMPDATA $TARGETFILE
189 TMPSIZE=`wc -c $TMPDATA`
190 TMPSIZE=`echo $TMPSIZE | cut -d' ' -f1`
191 DATAPOS=`expr $DATAPOS + $TMPSIZE`
192
193 #handle data file
194 #echo 'ADDR='$ADDR
195 #echo 'SIZE='$TMPSIZE
196 if [ $ISLOGICAL = 0 ]
197 then
198 next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1`
199 if [ "$next_addr" = "" ]; then
200 echo "ERROR:flash write"
201 rm $TMPDATA > /dev/null 2>&1
202 RESULT=3
203 break;
204 fi
205 ADDR=$next_addr
206 else
207 /sbin/nandlogical $LOGOCAL_MTD WRITE $ADDR $DATASIZE $TMPDATA > /dev/null 2>&1
208 ADDR=`expr $ADDR + $TMPSIZE`
209 fi
210
211 rm $TMPDATA > /dev/null 2>&1
212
213 #progress
214 SPNUM=0
215 while [ $SPNUM -lt $PROGSTEP ]
216 do
217 echo -n '.'
218 SPNUM=`expr $SPNUM + 1`
219 done
220 done
221
222 echo ''
223
224#finish
225 rm -f $TMPPATH/*.bin > /dev/null 2>&1
226
227 if [ $RESULT = 0 ]
228 then
229 /sbin/nandlogical $LOGOCAL_MTD WRITE $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
230 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
231
232 rm -f $VTMPNAME > /dev/null 2>&1
233 rm -f $MTMPNAME > /dev/null 2>&1
234 echo 'Success!'
235 else
236 echo 'Error!'
237 exit $RESULT
238 fi
239 fi
240done
241
242exit 0
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
diff --git a/meta/packages/zaurus-updater/spitz/updater.sh b/meta/packages/zaurus-updater/spitz/updater.sh
deleted file mode 100755
index a748334cc7..0000000000
--- a/meta/packages/zaurus-updater/spitz/updater.sh
+++ /dev/null
@@ -1,280 +0,0 @@
1#!/bin/sh
2
3#
4# Noodles' simpler update script. SL-C3000 only for the moment.
5#
6
7DATAPATH=$1
8TMPPATH=/tmp/update
9TMPDATA=$TMPPATH/tmpdata.bin
10TMPHEAD=$TMPPATH/tmphead.bin
11
12WFLG_KERNEL=0
13WFLG_INITRD=0
14WFLG_HDD=0
15
16RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
17if [ "$RO_MTD_LINE" = "" ]; then
18 RO_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
19fi
20RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
21RO_MTD_SIZE_HEX=`echo $RO_MTD_LINE | cut -d" " -f2`
22RO_MTD=/dev/mtd$RO_MTD_NO
23RO_MTDBLK=/dev/mtdblock$RO_MTD_NO
24RO_MTD_SIZE=`dc 0x$RO_MTD_SIZE_HEX 1024 /`
25
26RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
27if [ "$RW_MTD_LINE" = "" ]; then
28 RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
29fi
30RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
31RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`
32RW_MTD=/dev/mtd$RW_MTD_NO
33RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
34RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`
35
36LOGOCAL_MTD=/dev/mtd1
37
38VERBLOCK=0x48000
39MVRBLOCK=0x70000
40
41RESULT=0
42
43Cleanup(){
44 rm -f $VTMPNAME > /dev/null 2>&1
45 rm -f $MTMPNAME > /dev/null 2>&1
46 rm $CTRLPATH/* > /dev/null 2>&1
47 exit $1
48}
49trap 'Cleanup 1' 1 15
50trap '' 2 3
51
52get_dev_pcmcia()
53{
54while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR;
55do
56 echo $DEVS
57done
58}
59get_dev_pcmcia_slot()
60{
61 grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia
62}
63sleep 1
64IDE1=`get_dev_pcmcia_slot 1`
65if [ "$IDE1" = "" ]; then
66 echo "Error!! There is no HDD. Now retrying..."
67 while [ "$IDE1" = "" ]; do
68 IDE1=`get_dev_pcmcia_slot 1`
69 done
70 echo "Found HDD!!"
71fi
72
73#LINUXFMT=ext2
74LINUXFMT=ext3
75MKE2FSOPT=
76if [ "$LINUXFMT" = "ext3" ]; then
77 MKE2FSOPT=-j
78fi
79
80
81### Check model ###
82/sbin/writerominfo
83MODEL=`cat /proc/deviceinfo/product`
84if [ "$MODEL" != "SL-C3000" ] && [ "$MODEL" != "SL-C3100" ] && [ "$MODEL" != "SL-C3200" ]
85then
86 echo 'MODEL:'$MODEL
87 echo 'ERROR:Invalid model!'
88 echo 'Please reset'
89 while true
90 do
91 done
92fi
93
94### Check that we have a valid tar
95for TARNAME in gnu-tar GNU-TAR
96do
97 if [ -e $DATAPATH/$TARNAME ]
98 then
99 TARBIN=$DATAPATH/$TARNAME
100 fi
101done
102
103if [ ! -e $TARBIN ]; then
104 echo 'Please place a valid copy of tar as "gnu-tar" on your card'
105 echo 'Please reset'
106 while true
107 do
108 done
109fi
110
111mkdir -p $TMPPATH > /dev/null 2>&1
112
113cd $DATAPATH/
114
115#
116# First do the kernel.
117#
118for TARGETFILE in zImage.bin zimage.bin ZIMAGE.BIN
119do
120 if [ -e $TARGETFILE -a $WFLG_KERNEL = 0 ]
121 then
122 # Get the size of the kernel.
123 DATASIZE=`wc -c $TARGETFILE`
124 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
125
126 echo 'Updating kernel.'
127 echo $TARGETFILE':'$DATASIZE' bytes'
128 /sbin/nandlogical $LOGOCAL_MTD WRITE 0xe0000 $DATASIZE \
129 $TARGETFILE > /dev/null 2>&1
130
131 WFLG_KERNEL=1
132
133 fi
134done
135
136#
137# Now do the initrd.
138#
139for TARGETFILE in initrd.bin INITRD.BIN
140do
141 if [ -e $TARGETFILE -a $WFLG_INITRD = 0 ]
142 then
143 rm -f $TMPPATH/*.bin > /dev/null 2>&1
144 DATASIZE=`wc -c $TARGETFILE`
145 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
146
147 WFLG_INITRD=1
148 echo 'RO file system'
149 MODULEID=6
150 MODULESIZE=0x500000
151 ADDR=0
152 TARGET_MTD=$RO_MTD
153 DATAPOS=16
154 ONESIZE=1048576
155 /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
156
157 echo -n 'Flash erasing...'
158 /sbin/eraseall $TARGET_MTD 2> /dev/null > /dev/null
159 echo 'done'
160
161 echo ''
162 echo '0% 100%'
163 PROGSTEP=`expr $DATASIZE / $ONESIZE + 1`
164 PROGSTEP=`expr 28 / $PROGSTEP`
165 if [ $PROGSTEP = 0 ]
166 then
167 PROGSTEP=1
168 fi
169
170 #00 means header information
171 VTMPNAME=$TMPPATH'/vtmp'`date '+%s'`'.tmp'
172 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
173 /sbin/nandlogical $LOGOCAL_MTD READ $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
174 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
175
176 #echo 'found header'
177 /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
178 /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
179
180 #loop
181 while [ $DATAPOS -lt $DATASIZE ]
182 do
183 #data create
184 bcut -a $DATAPOS -s $ONESIZE -o $TMPDATA $TARGETFILE
185 TMPSIZE=`wc -c $TMPDATA`
186 TMPSIZE=`echo $TMPSIZE | cut -d' ' -f1`
187 DATAPOS=`expr $DATAPOS + $TMPSIZE`
188
189 #handle data file
190 #echo 'ADDR='$ADDR
191 #echo 'SIZE='$TMPSIZE
192 next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1`
193 if [ "$next_addr" = "" ]; then
194 echo "ERROR:flash write"
195 rm $TMPDATA > /dev/null 2>&1
196 RESULT=3
197 break;
198 fi
199 ADDR=$next_addr
200
201 rm $TMPDATA > /dev/null 2>&1
202
203 #progress
204 SPNUM=0
205 while [ $SPNUM -lt $PROGSTEP ]
206 do
207 echo -n '.'
208 SPNUM=`expr $SPNUM + 1`
209 done
210 done
211
212 echo ''
213
214 #finish
215 rm -f $TMPPATH/*.bin > /dev/null 2>&1
216
217 if [ $RESULT = 0 ]
218 then
219 /sbin/nandlogical $LOGOCAL_MTD WRITE $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
220 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
221
222 rm -f $VTMPNAME > /dev/null 2>&1
223 rm -f $MTMPNAME > /dev/null 2>&1
224 echo 'Success!'
225 else
226 echo 'Error!'
227 exit $RESULT
228 fi
229 fi
230done
231
232## HDD image
233for TARGETFILE in hdimage1.tgz HDIMAGE1.TGZ
234do
235 if [ -e $TARGETFILE ]; then
236 if [ $WFLG_HDD != 0 ]
237 then
238 continue
239 fi
240 WFLG_HDD=1
241 echo ''
242 echo 'HDD RO file system'
243 if [ ! -f /hdd1/NotAvailable ]; then
244 umount /hdd1
245 fi
246 echo 'Now formatting...'
247 mke2fs $MKE2FSOPT /dev/${IDE1}1 2> /dev/null > /dev/null
248 e2fsck -p /dev/${IDE1}1 > /dev/null
249 if [ "$?" != "0" ]; then
250 echo "Error!"
251 exit "$?"
252 fi
253
254 mount -t $LINUXFMT -o noatime /dev/${IDE1}1 /hdd1
255 if [ "$?" != "0" ]; then
256 echo "Error!"
257 exit "$?"
258 fi
259
260 cd /hdd1
261 echo 'Now extracting...'
262 gzip -dc $DATAPATH/$TARGETFILE | $TARBIN xf -
263 if [ "$?" != "0" ]; then
264 echo "Error!"
265 exit "$?"
266 fi
267
268 echo 'Success!'
269
270 #This can be useful for debugging
271 #/bin/sh -i
272
273 # remount as RO
274 cd /
275 umount /hdd1
276 mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
277 fi
278done
279
280exit 0
diff --git a/meta/packages/zaurus-updater/tosa/updater.sh b/meta/packages/zaurus-updater/tosa/updater.sh
deleted file mode 100644
index 6d30aba231..0000000000
--- a/meta/packages/zaurus-updater/tosa/updater.sh
+++ /dev/null
@@ -1,241 +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`
51if [ "$MODEL" != "SL-6000" ] > /dev/null 2>&1
52then
53 echo 'MODEL:'$MODEL
54 echo 'ERROR:Invalid model!'
55 echo 'Please reset'
56 while true
57 do
58 done
59fi
60
61mkdir -p $TMPPATH > /dev/null 2>&1
62
63cd $DATAPATH/
64
65if [ -e consolescroll ]
66then
67 ./consolescroll
68fi
69
70for TARGETFILE in zImage zImage.bin zimage.bin ZIMAGE ZIMAGE.BIN initrd.bin INITRD.BIN mversion.bin MVERSION.BIN
71do
72 if [ -e $TARGETFILE ]
73 then
74 rm -f $TMPPATH/*.bin > /dev/null 2>&1
75 DATASIZE=`wc -c $TARGETFILE`
76 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
77
78 #echo $TARGETFILE':'$DATASIZE'bytes'
79 TARGETTYPE=Invalid
80 case "$TARGETFILE" in
81 zImage) TARGETTYPE=Kernel;;
82 zimage.bin) TARGETTYPE=Kernel;;
83 ZIMAGE) TARGETTYPE=Kernel;;
84 initrd.bin) TARGETTYPE=RoFs;;
85 INITRD.BIN) TARGETTYPE=RoFs;;
86 mversion.bin) TARGETTYPE=MasterVer;;
87 MVERSION.BIN) TARGETTYPE=MasterVer;;
88 *)
89 continue
90 ;;
91 esac
92 case "$TARGETTYPE" in
93 Kernel)
94 echo 'kernel'
95 ISLOGICAL=1
96 MODULEID=5
97 MODULESIZE=0x13C000
98 ADDR=`dc 0xE0000`
99 ISFORMATTED=1
100 DATAPOS=0
101 ONESIZE=524288
102 HDTOP=`expr $DATASIZE - 16`
103 /sbin/bcut -a $HDTOP -s 16 -o $TMPHEAD $TARGETFILE
104 ;;
105 RoFs)
106 echo 'RO file system'
107 ISLOGICAL=0
108 MODULEID=6
109 MODULESIZE=0x1E00000
110 ADDR=0
111 ISFORMATTED=0
112 TARGET_MTD=$RO_MTD
113 DATAPOS=16
114 ONESIZE=1048576
115 /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
116 ;;
117 MasterVer)
118 echo 'Maser version'
119 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
120 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
121 /sbin/verchg -m $MTMPNAME $TARGETFILE 0 0 > /dev/null 2>&1
122 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
123 rm -f $MTMPNAME > /dev/null 2>&1
124 echo 'Success!'
125 continue
126 ;;
127 *)
128 continue;
129 ;;
130 esac
131
132 #check version
133 /sbin/bcut -s 6 -o $TMPDATA $TMPHEAD
134 if [ `cat $TMPDATA` != "SHARP!" ] > /dev/null 2>&1
135 then
136 #no version info...
137 rm -f $TMPHEAD > /dev/null 2>&1
138 DATAPOS=0
139 fi
140
141 #format?
142 if [ $ISFORMATTED = 0 ]
143 then
144 echo -n 'Flash erasing...'
145 /sbin/eraseall $TARGET_MTD 2> /dev/null > /dev/null
146 #/sbin/eraseall $TARGET_MTD 2
147 echo 'done'
148 ISFORMATTED=1
149 fi
150
151 echo ''
152 echo '0% 100%'
153 PROGSTEP=`expr $DATASIZE / $ONESIZE + 1`
154 PROGSTEP=`expr 28 / $PROGSTEP`
155 if [ $PROGSTEP = 0 ]
156 then
157 PROGSTEP=1
158 fi
159
160 #header information
161 if [ -e $TMPHEAD ]
162 then
163 VTMPNAME=$TMPPATH'/vtmp'`date '+%s'`'.tmp'
164 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
165 /sbin/nandlogical $LOGOCAL_MTD READ $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
166 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
167
168 #echo 'found header'
169 /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
170 /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1
171 fi
172
173 #loop
174 while [ $DATAPOS -lt $DATASIZE ]
175 do
176 #data create
177 bcut -a $DATAPOS -s $ONESIZE -o $TMPDATA $TARGETFILE
178 TMPSIZE=`wc -c $TMPDATA`
179 TMPSIZE=`echo $TMPSIZE | cut -d' ' -f1`
180 DATAPOS=`expr $DATAPOS + $TMPSIZE`
181
182 #handle data file
183 #echo 'ADDR='$ADDR
184 #echo 'SIZE='$TMPSIZE
185 if [ $ISLOGICAL = 0 ]
186 then
187 next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1`
188 if [ "$next_addr" = "" ]; then
189 echo "ERROR:flash write"
190 rm $TMPDATA > /dev/null 2>&1
191 RESULT=3
192 break;
193 fi
194 ADDR=$next_addr
195 else
196 /sbin/nandlogical $LOGOCAL_MTD WRITE $ADDR $DATASIZE $TMPDATA > /dev/null 2>&1
197 ADDR=`expr $ADDR + $TMPSIZE`
198 fi
199
200 rm $TMPDATA > /dev/null 2>&1
201
202 #progress
203 SPNUM=0
204 while [ $SPNUM -lt $PROGSTEP ]
205 do
206 echo -n '.'
207 SPNUM=`expr $SPNUM + 1`
208 done
209 done
210
211 echo ''
212
213#finish
214 rm -f $TMPPATH/*.bin > /dev/null 2>&1
215
216 if [ $RESULT = 0 ]
217 then
218 if [ -e $VTMPNAME ]
219 then
220 /sbin/nandlogical $LOGOCAL_MTD WRITE $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
221 rm -f $VTMPNAME > /dev/null 2>&1
222 fi
223 if [ -e $MTMPNAME ]
224 then
225 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
226 rm -f $MTMPNAME > /dev/null 2>&1
227 fi
228 echo 'Success!'
229 else
230 echo 'Error!'
231# exit $RESULT
232 fi
233 fi
234done
235
236#exit 0
237
238echo 'Please reset'
239while true
240do
241done
diff --git a/meta/packages/zaurus-updater/zaurus-updater.bb b/meta/packages/zaurus-updater/zaurus-updater.bb
index 05c7a9ca3a..052560dcc9 100644
--- a/meta/packages/zaurus-updater/zaurus-updater.bb
+++ b/meta/packages/zaurus-updater/zaurus-updater.bb
@@ -1,7 +1,7 @@
1DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update" 1DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update"
2DEPENDS = "encdec-updater-native" 2DEPENDS = "encdec-updater-native"
3LICENSE = "zaurus-updater" 3LICENSE = "zaurus-updater"
4PR = "r6" 4PR = "r20"
5 5
6PACKAGES = "" 6PACKAGES = ""
7PACKAGE_ARCH = "${MACHINE_ARCH}" 7PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -11,6 +11,10 @@ SRC_URI = "file://updater.sh \
11 file://gnu-tar.gz" 11 file://gnu-tar.gz"
12S = "${WORKDIR}" 12S = "${WORKDIR}"
13 13
14do_configure() {
15 sed -i "s/ZAURUS_UPDATER_VERSION/${PR}/" "${S}/updater.sh"
16}
17
14do_compile() { 18do_compile() {
15 encdec-updater -e updater.sh 19 encdec-updater -e updater.sh
16} 20}
diff --git a/meta/packages/zaurus-updater/zaurus-updater/updater.sh b/meta/packages/zaurus-updater/zaurus-updater/updater.sh
new file mode 100644
index 0000000000..22d4b3914d
--- /dev/null
+++ b/meta/packages/zaurus-updater/zaurus-updater/updater.sh
@@ -0,0 +1,481 @@
1#!/bin/sh
2#
3# One updater.sh to rule them all
4#
5# 2006.10.24 Marcin 'Hrw' Juszkiewicz
6# - started work on common updater.sh
7# - works on poodle, c760, spitz
8# - breaks on tosa
9#
10# 2007.10.08 Marcin 'Hrw' Juszkiewicz
11# - do not allow to flash files bigger then partition size
12# - created functions for common stuff
13#
14# 2007.11.18 Dmitry 'Lumag' Baryshkov
15# - fixes
16# - tosa unbreak
17#
18# 2007.11.19 Marcin 'Hrw' Juszkiewicz
19# - size check unbreak
20# - c760/c860 has bigger rootfs - use it
21#
22# 2007.11.23 Koen Kooi
23# - consistent error messages
24# - fix flashing from case sensitive filesystem (e.g. ext2)
25#
26# 2007.11.23 Matthias 'CoreDump' Hentges
27# - Always treat MTD_PART_SIZE as HEX when comparing sizes
28# - Thanks to ZeroChaos for debugging
29#
30# 2007.12.04 Matthias 'CoreDump' Hentges
31# - Unb0rk flashing of Akita kernels
32#
33# 2007.12.10 Marcin 'Hrw' Juszkiewicz
34# - Reformatted file - please use spaces not tabs
35# - "version check" is only on Tosa and Poodle - breaks other machines
36#
37# 2007.12.23 Matthias 'CoreDump' Hentges
38# - Fix kernel install on spitz machines
39# - Unify format of do_flashing()...
40# - Display ${PR} of zaurus-updater.bb to the user
41# - Polish HDD installer messages
42#
43# 2007.12.25 Matthias 'CoreDump' Hentges
44# -Add support for installing / updating u-boot
45
46# Set to "yes" to enable
47ENABLE_UBOOT_UPDATER="no"
48
49DATAPATH=$1
50TMPPATH=/tmp/update
51TMPDATA=$TMPPATH/tmpdata.bin
52TMPHEAD=$TMPPATH/tmphead.bin
53
54FLASHED_KERNEL=0
55FLASHED_ROOTFS=0
56UNPACKED_ROOTFS=0 # spitz only
57
58RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
59if [ "$RO_MTD_LINE" = "" ]; then
60 RO_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
61fi
62RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
63RO_MTD=/dev/mtd$RO_MTD_NO
64ROOTFS_SIZE=`echo $RO_MTD_LINE | cut -d" " -f2`
65
66LOGOCAL_MTD=/dev/mtd1
67
68VERBLOCK=0x48000
69MVRBLOCK=0x70000
70
71RESULT=0
72
73Cleanup()
74{
75 rm -f $VTMPNAME > /dev/null 2>&1
76 rm -f $MTMPNAME > /dev/null 2>&1
77 exit $1
78}
79
80trap 'Cleanup 1' 1 15
81trap '' 2 3
82
83get_dev_pcmcia()
84{
85 while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR;
86 do
87 echo $DEVS
88 done
89}
90
91get_dev_pcmcia_slot()
92{
93 grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia
94}
95
96check_for_hdd()
97{
98 IDE1=`get_dev_pcmcia_slot 1`
99 if [ "$IDE1" = "" ]; then
100 echo "Error: There is no microdrive. Retrying..."
101 while [ "$IDE1" = "" ]; do
102 IDE1=`get_dev_pcmcia_slot 1`
103 done
104 echo "Microdrive found."
105 fi
106
107 LINUXFMT=ext3
108 MKE2FSOPT=-j
109}
110
111check_for_tar()
112{
113 ### Check that we have a valid tar
114 for TARNAME in gnu-tar GNU-TAR
115 do
116 if [ -e $DATAPATH/$TARNAME ]
117 then
118 TARBIN=$DATAPATH/$TARNAME
119 fi
120 done
121
122 if [ ! -e $TARBIN ]; then
123 echo 'Error: Please place a valid copy of tar as "gnu-tar" on your card.'
124 echo 'Please reset'
125 while true
126 do
127 done
128 fi
129}
130
131do_rootfs_extraction()
132{
133 UNPACKED_ROOTFS=1
134 echo 'Installing HDD root file system'
135 if [ ! -f /hdd1/NotAvailable ]; then
136 umount /hdd1
137 fi
138 echo -n '* Now formatting...'
139 mke2fs $MKE2FSOPT /dev/${IDE1}1 > /dev/null 2>&1
140 e2fsck -p /dev/${IDE1}1 > /dev/null
141 if [ "$?" != "0" ]; then
142 echo "FAILED"
143 echo "Error: Unable to create filesystem on microdrive!"
144 exit "$?"
145 else
146 echo "Done"
147 fi
148
149 mount -t $LINUXFMT -o noatime /dev/${IDE1}1 /hdd1
150 if [ "$?" != "0" ]; then
151 echo "Error: Unable to mount microdrive!"
152 exit "$?"
153 fi
154
155 cd /hdd1
156 echo -n '* Now extracting (this can take over 5m)...'
157 gzip -dc $DATAPATH/$TARGETFILE | $TARBIN xf -
158 if [ "$?" != "0" ]; then
159 echo "FAILED"
160 echo "Error: Unable to extract root filesystem archive!"
161 exit "$?"
162 else
163 echo "Done"
164 fi
165
166 echo 'HDD Installation Finished.'
167
168 # remount as RO
169 cd /
170 umount /hdd1
171 mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
172}
173
174do_flashing()
175{
176 if [ $DATASIZE -gt `printf "%d" $MTD_PART_SIZE` ]
177 then
178 echo "Error: File is too big to flash!"
179 echo "$FLASH_TYPE: [$DATASIZE] > [`printf "%d" ${MTD_PART_SIZE}`]"
180 return
181 fi
182
183 if [ "$ZAURUS" = "tosa" ] || [ "$ZAURUS" = "poodle" ]
184 then
185 #check version
186 /sbin/bcut -s 6 -o $TMPDATA $TMPHEAD
187
188 if [ `cat $TMPDATA` != "SHARP!" ] > /dev/null 2>&1
189 then
190 #no version info...
191 rm -f $TMPHEAD > /dev/null 2>&1
192 DATAPOS=0
193 fi
194 fi
195
196 if [ $ISFORMATTED = 0 ]
197 then
198 /sbin/eraseall $TARGET_MTD > /dev/null 2>&1
199 ISFORMATTED=1
200 fi
201
202 if [ -e $TMPHEAD ]
203 then
204 VTMPNAME=$TMPPATH'/vtmp'`date '+%s'`'.tmp'
205 MTMPNAME=$TMPPATH'/mtmp'`date '+%s'`'.tmp'
206 /sbin/nandlogical $LOGOCAL_MTD READ $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
207 /sbin/nandlogical $LOGOCAL_MTD READ $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
208
209 /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MTD_PART_SIZE > /dev/null 2>&1
210 /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MTD_PART_SIZE > /dev/null 2>&1
211 fi
212
213 # Looks like Akita and Spitz are unique when it comes to kernel flashing
214
215 if [ "$ZAURUS" = "akita" -o "$ZAURUS" = "c3x00" ] && [ "$FLASH_TYPE" = "kernel" ]
216 then
217# echo $TARGETFILE':'$DATASIZE'bytes'
218 echo ""
219 echo -n "Installing SL-Cxx00 kernel..."
220 echo ' ' > /tmp/data
221 test "$ZAURUS" = "akita" && /sbin/nandlogical $LOGOCAL_MTD WRITE 0x60100 16 /tmp/data > /dev/null 2>&1
222 /sbin/nandlogical $LOGOCAL_MTD WRITE 0xe0000 $DATASIZE $TARGETFILE > /dev/null 2>&1
223 test "$ZAURUS" = "akita" && /sbin/nandlogical $LOGOCAL_MTD WRITE 0x21bff0 16 /tmp/data > /dev/null 2>&1
224 echo "Done"
225 else
226
227 echo ''
228 echo '0% 100%'
229 PROGSTEP=`expr $DATASIZE / $ONESIZE + 1`
230 PROGSTEP=`expr 25 / $PROGSTEP`
231
232 if [ $PROGSTEP = 0 ]
233 then
234 PROGSTEP=1
235 fi
236
237 #loop
238 while [ $DATAPOS -lt $DATASIZE ]
239 do
240 #data create
241 bcut -a $DATAPOS -s $ONESIZE -o $TMPDATA $TARGETFILE
242 TMPSIZE=`wc -c $TMPDATA`
243 TMPSIZE=`echo $TMPSIZE | cut -d' ' -f1`
244 DATAPOS=`expr $DATAPOS + $TMPSIZE`
245
246 #handle data file
247 if [ $ISLOGICAL = 0 ]
248 then
249 next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1`
250 if [ "$next_addr" = "" ]; then
251 echo "Error: flash write"
252 rm $TMPDATA > /dev/null 2>&1
253 RESULT=3
254 break;
255 fi
256 ADDR=$next_addr
257 else
258 /sbin/nandlogical $LOGOCAL_MTD WRITE $ADDR $DATASIZE $TMPDATA > /dev/null 2>&1
259 ADDR=`expr $ADDR + $TMPSIZE`
260 fi
261
262 rm $TMPDATA > /dev/null 2>&1
263
264 #progress
265 SPNUM=0
266 while [ $SPNUM -lt $PROGSTEP ]
267 do
268 echo -n '.'
269 SPNUM=`expr $SPNUM + 1`
270 done
271 done
272 fi
273 echo ''
274
275 #finish
276 rm -f $TMPPATH/*.bin > /dev/null 2>&1
277
278 if [ $RESULT = 0 ]
279 then
280 if [ -e $VTMPNAME ]
281 then
282 /sbin/nandlogical $LOGOCAL_MTD WRITE $VERBLOCK 0x4000 $VTMPNAME > /dev/null 2>&1
283 rm -f $VTMPNAME > /dev/null 2>&1
284 fi
285
286 if [ -e $MTMPNAME ]
287 then
288 /sbin/nandlogical $LOGOCAL_MTD WRITE $MVRBLOCK 0x4000 $MTMPNAME > /dev/null 2>&1
289 rm -f $MTMPNAME > /dev/null 2>&1
290 fi
291
292 [ "$FLASH_TYPE" != "kernel" ] && echo 'Done.'
293 else
294 echo 'Error!'
295 fi
296}
297
298update_uboot() {
299 # The flashing part of this function is based on pdaXrom's
300 # updater.sh
301
302 if test "$ENABLE_UBOOT_UPDATER" != "yes" -o -z "$1"
303 then
304 echo "u-boot updates not allowed."
305 return
306 fi
307
308 echo ""
309 echo "Installing u-boot bootloader:"
310
311 DATASIZE=`wc -c $TARGETFILE`
312 FSIZE=`echo $DATASIZE | cut -d' ' -f1`
313
314 echo -n "* Creating backup ($FSIZE Bytes)..."
315 if ( nandlogical /dev/mtd1 READ 0 $FSIZE /tmp/sharploader.bin ) > /dev/null 2>&1
316 then
317 echo "Ok"
318
319 echo -n "* Flashing u-boot..."
320 if ( nandlogical /dev/mtd1 WRITE 0 $FSIZE $1 ) > /dev/null 2>&1
321 then
322 echo "Success"
323 else
324 echo "FAILED"
325 echo "ERROR: Installation of u-boot failed!"
326
327 echo -n "* Trying to restore backup..."
328 if ( nandlogical /dev/mtd1 WRITE 0 $FSIZE /tmp/sharploader.bin ) > /dev/null 2>&1
329 then
330 echo "Success"
331 echo "Your old bootloader has been restored"
332 else
333 echo "FAILED"
334 echo "Sorry, it's NAND-Restore time for you =("
335 fi
336 fi
337 else
338 echo "FAILED"
339 echo "Could not create backup, aborting!"
340 echo "Your bootloader has not been altered in any way."
341 exit 1
342 fi
343}
344
345### Check model ###
346/sbin/writerominfo
347MODEL=`cat /proc/deviceinfo/product`
348case "$MODEL" in
349 SL-B500|SL-5600)
350 ZAURUS='poodle'
351 ;;
352 SL-6000)
353 ZAURUS='tosa'
354 ;;
355 SL-C1000)
356 ZAURUS='akita'
357 ;;
358 SL-C700|SL-C750|SL-7500|SL-C760|SL-C860)
359 ZAURUS='c7x0'
360 ;;
361 SL-C3000|SL-C3100|SL-C3200)
362 ZAURUS='c3x00'
363 check_for_hdd
364 check_for_tar
365 ;;
366 *)
367 echo 'MODEL: '$MODEL 'is unsupported'
368 echo ''
369 echo 'Please reset'
370 while true
371 do
372 done
373 ;;
374esac
375
376clear
377echo "---- Universal Zaurus Updater ZAURUS_UPDATER_VERSION ----"
378echo 'MODEL: '$MODEL' ('$ZAURUS')'
379
380mkdir -p $TMPPATH > /dev/null 2>&1
381
382cd $DATAPATH/
383
384for TARGETFILE in u-boot.bin U-BOOT.BIN zimage zImage zImage.bin zimage.bin ZIMAGE ZIMAGE.BIN initrd.bin INITRD.BIN hdimage1.tgz HDIMAGE1.TGZ
385do
386 if [ ! -e $TARGETFILE ]
387 then
388 continue
389 fi
390
391 rm -f $TMPPATH/*.bin > /dev/null 2>&1
392 DATASIZE=`wc -c $TARGETFILE`
393 DATASIZE=`echo $DATASIZE | cut -d' ' -f1`
394
395 # make TARGETFILE lowercase
396 TARGETFILE_LC=`echo $TARGETFILE|tr A-Z a-z`
397
398 case "$TARGETFILE_LC" in
399
400 zimage|zimage.bin)
401 if [ $FLASHED_KERNEL != 0 ]
402 then
403 continue
404 fi
405 FLASHED_KERNEL=1
406 ISLOGICAL=1
407 MODULEID=5
408 MTD_PART_SIZE=0x13C000
409 ADDR=`dc 0xE0000`
410 ISFORMATTED=1
411 DATAPOS=0
412 ONESIZE=524288
413 HDTOP=`expr $DATASIZE - 16`
414 /sbin/bcut -a $HDTOP -s 16 -o $TMPHEAD $TARGETFILE
415 FLASH_TYPE="kernel"
416 do_flashing
417 FLASH_TYPE=""
418 ;;
419
420 initrd.bin)
421 if [ $FLASHED_ROOTFS != 0 ]
422 then
423 continue
424 fi
425 echo 'root file system'
426 FLASHED_ROOTFS=1
427 ISLOGICAL=0
428 MODULEID=6
429 MTD_PART_SIZE="0x$ROOTFS_SIZE"
430 ADDR=0
431 ISFORMATTED=0
432 TARGET_MTD=$RO_MTD
433 DATAPOS=16
434 ONESIZE=1048576
435 /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
436 FLASH_TYPE="rootfs"
437 do_flashing
438 FLASH_TYPE=""
439 ;;
440
441 hdimage1.tgz)
442 if [ $UNPACKED_ROOTFS = 0 ]
443 then
444 do_rootfs_extraction
445 fi
446 ;;
447
448 u-boot.bin)
449 if [ FLASHED_UBOOT != 1 ]
450 then
451 update_uboot "$TARGETFILE"
452 FLASHED_UBOOT="1"
453 fi
454 ;;
455
456 *)
457 ;;
458 esac
459done
460
461# reboot
462exit 0
463
464# bcut usage: bcut [OPTION] <input file>
465
466# -a: start position
467# -s: cut size
468# -o: output file
469
470# ModuleId informations used by verchg Sharp binary:
471#
472# 0 - master
473# 1 - Maintaince
474# 2 - Diagnostics
475# 3 - rescue kernel
476# 4 - rescue rootfs
477# 5 - normal kernel
478# 6 - normal rootfs
479# 7 - /home/
480# 8 - parameter (whatever it means)
481#