summaryrefslogtreecommitdiffstats
path: root/meta/packages/zaurus-updater
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-07-21 10:10:31 +0000
committerRichard Purdie <richard@openedhand.com>2006-07-21 10:10:31 +0000
commitb2f192faabe412adce79534e22efe9fb69ee40e2 (patch)
tree7076c49d4286f8a1733650bd8fbc7161af200d57 /meta/packages/zaurus-updater
parent2cf0eadf9f730027833af802d7e6c90b44248f80 (diff)
downloadpoky-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.gz
Rename /openembedded/ -> /meta/
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/zaurus-updater')
-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/encdec-updater-native.bb6
-rw-r--r--meta/packages/zaurus-updater/encdec-updater.bb16
-rw-r--r--meta/packages/zaurus-updater/files/encdec-updater.c80
-rw-r--r--meta/packages/zaurus-updater/files/gnu-tar.gzbin0 -> 242146 bytes
-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.bb31
10 files changed, 1379 insertions, 0 deletions
diff --git a/meta/packages/zaurus-updater/akita/updater.sh b/meta/packages/zaurus-updater/akita/updater.sh
new file mode 100644
index 0000000000..5399e5254e
--- /dev/null
+++ b/meta/packages/zaurus-updater/akita/updater.sh
@@ -0,0 +1,252 @@
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
new file mode 100644
index 0000000000..290030ca2d
--- /dev/null
+++ b/meta/packages/zaurus-updater/c7x0/updater.sh
@@ -0,0 +1,242 @@
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/encdec-updater-native.bb b/meta/packages/zaurus-updater/encdec-updater-native.bb
new file mode 100644
index 0000000000..d6593193f7
--- /dev/null
+++ b/meta/packages/zaurus-updater/encdec-updater-native.bb
@@ -0,0 +1,6 @@
1include encdec-updater.bb
2inherit native
3
4do_stage() {
5 install -m 0755 encdec-updater ${STAGING_BINDIR}
6}
diff --git a/meta/packages/zaurus-updater/encdec-updater.bb b/meta/packages/zaurus-updater/encdec-updater.bb
new file mode 100644
index 0000000000..797a762ebf
--- /dev/null
+++ b/meta/packages/zaurus-updater/encdec-updater.bb
@@ -0,0 +1,16 @@
1SECTION = "console/utils"
2LICENSE = "GPL"
3DESCRIPTION = "A tool to encode and decode the Sharp Zaurus updater.sh skript"
4
5SRC_URI = "file://encdec-updater.c"
6
7COMPATIBLE_MACHINE = '(poodle|c7x0|spitz|akita|tosa)'
8
9do_compile() {
10 ${CC} -o encdec-updater ${WORKDIR}/encdec-updater.c
11}
12
13do_install() {
14 install -d ${D}${bindir}
15 install -m 0755 encdec-updater ${D}${bindir}/
16}
diff --git a/meta/packages/zaurus-updater/files/encdec-updater.c b/meta/packages/zaurus-updater/files/encdec-updater.c
new file mode 100644
index 0000000000..b894623c65
--- /dev/null
+++ b/meta/packages/zaurus-updater/files/encdec-updater.c
@@ -0,0 +1,80 @@
1//
2//
3// Sharp Zaurus SL-C7x0 updater.sh script encoder/decoder
4//
5// mailto:sash@cacko.biz
6//
7//
8
9#include <stdio.h>
10
11unsigned char enctab[] = {
12 0x4a,0xf7,0x77,0x62,0xb0,0xe3,0xd8,0xf6,0xd1,0x98,0x09,0x2e,0x19,0x0c,0x0d,0x7c,
13 0x04,0xe0,0x6b,0x22,0x10,0x08,0x15,0x16,0xb9,0x28,0x83,0x1f,0x91,0x06,0xfa,0xe8,
14 0xbd,0xc6,0x21,0x32,0x23,0x6f,0x01,0x26,0x5f,0x03,0x33,0xb6,0x35,0xac,0x2d,0x0a,
15 0x6e,0x6c,0xfc,0xc4,0x29,0x34,0x2b,0x42,0x25,0x66,0xc9,0x3e,0x87,0xb4,0x74,0xf2,
16 0x11,0x20,0x41,0xb3,0x27,0x14,0xc1,0xcd,0x3d,0x80,0xd5,0x7f,0xcf,0x4c,0x4d,0xca,
17 0x75,0x51,0xc8,0xa6,0x17,0xf0,0x55,0x82,0x79,0xdc,0x59,0x5a,0x5b,0xb8,0x5d,0x40,
18 0x64,0x58,0xff,0xc5,0xab,0xc0,0xae,0xeb,0xa3,0xad,0xea,0x6a,0x37,0x3b,0x73,0x9a,
19 0x88,0x3a,0xe1,0x68,0x0b,0xec,0xc7,0x76,0xf9,0x38,0x57,0xdd,0x49,0x96,0x95,0x7a,
20 0x50,0x2a,0x4e,0xdb,0x00,0x48,0xd7,0x86,0x47,0x94,0xa0,0x1c,0x8b,0x8c,0x8d,0x92,
21 0x45,0x90,0x7e,0x56,0x93,0xef,0x1a,0x52,0x97,0xbc,0x99,0xb5,0x7d,0x72,0x9d,0x9c,
22 0xfb,0x24,0xa1,0xa2,0x07,0x46,0xa5,0x02,0x69,0xe6,0xa9,0xd3,0x30,0xba,0xd6,0x84,
23 0x63,0x13,0x1b,0xb2,0x1d,0xaf,0x36,0x8e,0xb7,0x53,0x05,0xbb,0x12,0x78,0x8f,0xbe,
24 0x71,0xbf,0xe4,0x1e,0x9e,0xa4,0xe5,0x2f,0x9b,0x31,0x67,0x4b,0xcb,0x43,0xc3,0xce,
25 0x44,0x3c,0x0f,0xd2,0xaa,0xd4,0xed,0xa7,0x7b,0x18,0xd0,0xda,0x0e,0x54,0xf1,0xde,
26 0xdf,0xa8,0x3f,0xe2,0x6d,0xcc,0xf8,0x70,0xe7,0x61,0xe9,0x85,0x65,0x2c,0x39,0xee,
27 0x60,0x81,0x89,0xc2,0xf3,0xf4,0xf5,0x8a,0x5c,0x5e,0xd9,0x4f,0x9f,0xb1,0xfd,0xfe,
28};
29
30unsigned char decode_c(unsigned char c)
31{
32 int i;
33 for (i = 0; i < 256; i++) {
34 if (c == enctab[i]) return i;
35 }
36 printf("Internal bug: encode_c()\n");
37 exit(1);
38 return 0;
39}
40
41unsigned char encode_c(unsigned char c)
42{
43 int i;
44 return enctab[c];
45}
46
47int main(int argc, char *argv[])
48{
49 int i, decode;
50 int c;
51 FILE *inf, *outf;
52 char name[256];
53
54 if (argc < 3) {
55 printf("Decode file:\n\tencsh -d file.sh\nEncode file:\n\tencsh -c file.sh\n");
56 exit(1);
57 }
58
59 if (strcmp(argv[1], "-d")) decode = 1;
60 else decode = 0;
61
62 strcpy(name, argv[2]);
63 strcat(name, ".$$$$");
64
65 inf = fopen(argv[2], "rb");
66 outf = fopen(name, "wb");
67
68 while ((c = fgetc(inf)) >= 0) {
69 if (decode) c = decode_c(c);
70 else c = encode_c(c);
71 fputc(c, outf);
72 }
73
74 fclose(inf);
75 fclose(outf);
76
77 rename(name, argv[2]);
78
79 return 0;
80}
diff --git a/meta/packages/zaurus-updater/files/gnu-tar.gz b/meta/packages/zaurus-updater/files/gnu-tar.gz
new file mode 100644
index 0000000000..93d1a43704
--- /dev/null
+++ b/meta/packages/zaurus-updater/files/gnu-tar.gz
Binary files differ
diff --git a/meta/packages/zaurus-updater/poodle/updater.sh b/meta/packages/zaurus-updater/poodle/updater.sh
new file mode 100644
index 0000000000..a5e3f846ea
--- /dev/null
+++ b/meta/packages/zaurus-updater/poodle/updater.sh
@@ -0,0 +1,231 @@
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
new file mode 100755
index 0000000000..07d81b1bda
--- /dev/null
+++ b/meta/packages/zaurus-updater/spitz/updater.sh
@@ -0,0 +1,280 @@
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" ]
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
new file mode 100644
index 0000000000..6d30aba231
--- /dev/null
+++ b/meta/packages/zaurus-updater/tosa/updater.sh
@@ -0,0 +1,241 @@
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
new file mode 100644
index 0000000000..26cf1e5453
--- /dev/null
+++ b/meta/packages/zaurus-updater/zaurus-updater.bb
@@ -0,0 +1,31 @@
1DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update"
2DEPENDS = "encdec-updater-native"
3LICENSE = "zaurus-updater"
4PR = "r5"
5
6PACKAGES = ""
7PACKAGE_ARCH = "${MACHINE_ARCH}"
8COMPATIBLE_MACHINE = '(poodle|c7x0|spitz|akita|tosa)'
9
10SRC_URI = "file://updater.sh \
11 file://gnu-tar.gz"
12S = "${WORKDIR}"
13
14do_compile() {
15 encdec-updater -e updater.sh
16}
17
18do_deploy() {
19 install -d ${DEPLOY_DIR_IMAGE}
20 install -m 0755 updater.sh ${DEPLOY_DIR_IMAGE}/updater.sh.${MACHINE}
21
22 case ${MACHINE} in
23 spitz )
24 install -m 0755 gnu-tar ${DEPLOY_DIR_IMAGE}/gnu-tar
25 ;;
26 *)
27 ;;
28 esac
29}
30
31addtask deploy before do_build after do_compile