diff options
Diffstat (limited to 'openembedded/packages')
-rw-r--r-- | openembedded/packages/zaurus-updater/borzoi/updater.sh | 273 | ||||
-rw-r--r-- | openembedded/packages/zaurus-updater/zaurus-updater.bb | 4 |
2 files changed, 155 insertions, 122 deletions
diff --git a/openembedded/packages/zaurus-updater/borzoi/updater.sh b/openembedded/packages/zaurus-updater/borzoi/updater.sh index 621c339b5d..0c18966fdb 100644 --- a/openembedded/packages/zaurus-updater/borzoi/updater.sh +++ b/openembedded/packages/zaurus-updater/borzoi/updater.sh | |||
@@ -1,5 +1,8 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # | ||
4 | # Noodles' simpler update script. SL-C3000 only for the moment. | ||
5 | # | ||
3 | 6 | ||
4 | DATAPATH=$1 | 7 | DATAPATH=$1 |
5 | TMPPATH=/tmp/update | 8 | TMPPATH=/tmp/update |
@@ -8,7 +11,7 @@ TMPHEAD=$TMPPATH/tmphead.bin | |||
8 | 11 | ||
9 | WFLG_KERNEL=0 | 12 | WFLG_KERNEL=0 |
10 | WFLG_INITRD=0 | 13 | WFLG_INITRD=0 |
11 | WFLG_MVERSION=0 | 14 | WFLG_HDD=0 |
12 | 15 | ||
13 | RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1` | 16 | RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1` |
14 | if [ "$RO_MTD_LINE" = "" ]; then | 17 | if [ "$RO_MTD_LINE" = "" ]; then |
@@ -41,131 +44,124 @@ Cleanup(){ | |||
41 | rm -f $VTMPNAME > /dev/null 2>&1 | 44 | rm -f $VTMPNAME > /dev/null 2>&1 |
42 | rm -f $MTMPNAME > /dev/null 2>&1 | 45 | rm -f $MTMPNAME > /dev/null 2>&1 |
43 | rm $CTRLPATH/* > /dev/null 2>&1 | 46 | rm $CTRLPATH/* > /dev/null 2>&1 |
44 | rm $DATAPATH/* > /dev/null 2>&1 | ||
45 | exit $1 | 47 | exit $1 |
46 | } | 48 | } |
47 | trap 'Cleanup 1' 1 15 | 49 | trap 'Cleanup 1' 1 15 |
48 | trap '' 2 3 | 50 | trap '' 2 3 |
49 | 51 | ||
52 | get_dev_pcmcia() | ||
53 | { | ||
54 | while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR; | ||
55 | do | ||
56 | echo $DEVS | ||
57 | done | ||
58 | } | ||
59 | get_dev_pcmcia_slot() | ||
60 | { | ||
61 | grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia | ||
62 | } | ||
63 | sleep 1 | ||
64 | IDE1=`get_dev_pcmcia_slot 1` | ||
65 | if [ "$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!!" | ||
71 | fi | ||
72 | |||
73 | #LINUXFMT=ext2 | ||
74 | LINUXFMT=ext3 | ||
75 | MKE2FSOPT= | ||
76 | if [ "$LINUXFMT" = "ext3" ]; then | ||
77 | MKE2FSOPT=-j | ||
78 | fi | ||
79 | |||
50 | 80 | ||
51 | ### Check model ### | 81 | ### Check model ### |
52 | /sbin/writerominfo | 82 | /sbin/writerominfo |
53 | MODEL=`cat /proc/deviceinfo/product` | 83 | MODEL=`cat /proc/deviceinfo/product` |
54 | echo 'MODEL:'$MODEL | 84 | if [ "$MODEL" != "SL-C3000" ] && [ "$MODEL" != "SL-C3100" ] |
55 | case "$MODEL" in | 85 | then |
56 | SL-C700) ;; | 86 | echo 'MODEL:'$MODEL |
57 | SL-C750) ;; | ||
58 | SL-C760) ;; | ||
59 | SL-C860) ;; | ||
60 | SL-C3100) ;; | ||
61 | SL-B500) ;; | ||
62 | SL-5600) ;; | ||
63 | *) | ||
64 | echo 'ERROR:Invalid model!' | 87 | echo 'ERROR:Invalid model!' |
65 | echo 'Please reset' | 88 | echo 'Please reset' |
66 | while true | 89 | while true |
67 | do | 90 | do |
68 | done | 91 | done |
69 | ;; | 92 | fi |
70 | esac | 93 | |
94 | ### Check that we have a valid tar | ||
95 | for TARNAME in gnu-tar GNU-TAR | ||
96 | do | ||
97 | if [ -e $DATAPATH/$TARNAME ] | ||
98 | then | ||
99 | TARBIN=$DATAPATH/$TARNAME | ||
100 | fi | ||
101 | done | ||
102 | |||
103 | if [ ! -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 | ||
109 | fi | ||
71 | 110 | ||
72 | mkdir -p $TMPPATH > /dev/null 2>&1 | 111 | mkdir -p $TMPPATH > /dev/null 2>&1 |
73 | 112 | ||
74 | cd $DATAPATH/ | 113 | cd $DATAPATH/ |
75 | 114 | ||
76 | for TARGETFILE in zImage.bin zimage.bin ZIMAGE.BIN initrd.bin INITRD.BIN mversion.bin MVERSION.BIN | 115 | # |
116 | # First do the kernel. | ||
117 | # | ||
118 | for TARGETFILE in zImage.bin zimage.bin ZIMAGE.BIN | ||
77 | do | 119 | do |
78 | if [ -e $TARGETFILE ] | 120 | if [ -e $TARGETFILE -a $WFLG_KERNEL = 0 ] |
79 | then | 121 | then |
80 | rm -f $TMPPATH/*.bin > /dev/null 2>&1 | 122 | # Get the size of the kernel. |
81 | DATASIZE=`wc -c $TARGETFILE` | 123 | DATASIZE=`wc -c $TARGETFILE` |
82 | DATASIZE=`echo $DATASIZE | cut -d' ' -f1` | 124 | DATASIZE=`echo $DATASIZE | cut -d' ' -f1` |
83 | 125 | ||
84 | #echo $TARGETFILE':'$DATASIZE'bytes' | 126 | echo 'Updating kernel.' |
85 | TARGETTYPE=Invalid | 127 | echo $TARGETFILE':'$DATASIZE' bytes' |
86 | case "$TARGETFILE" in | 128 | /sbin/nandlogical $LOGOCAL_MTD WRITE 0xe0000 $DATASIZE \ |
87 | zImage.bin) TARGETTYPE=Kernel;; | 129 | $TARGETFILE > /dev/null 2>&1 |
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 | 130 | ||
131 | WFLG_KERNEL=1 | ||
154 | 132 | ||
155 | #format? | 133 | fi |
156 | if [ $ISFORMATTED = 0 ] | 134 | done |
157 | then | 135 | |
158 | echo -n 'Flash erasing...' | 136 | # |
159 | /sbin/eraseall $TARGET_MTD 2> /dev/null > /dev/null | 137 | # Now do the initrd. |
160 | #/sbin/eraseall $TARGET_MTD 2 | 138 | # |
161 | echo 'done' | 139 | for TARGETFILE in initrd.bin INITRD.BIN |
162 | ISFORMATTED=1 | 140 | do |
163 | fi | 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' | ||
164 | 160 | ||
165 | echo '' | 161 | echo '' |
166 | echo '0% 100%' | 162 | echo '0% 100%' |
167 | PROGSTEP=`expr $DATASIZE / $ONESIZE + 1` | 163 | PROGSTEP=`expr $DATASIZE / $ONESIZE + 1` |
168 | PROGSTEP=`expr 25 / $PROGSTEP` | 164 | PROGSTEP=`expr 28 / $PROGSTEP` |
169 | if [ $PROGSTEP = 0 ] | 165 | if [ $PROGSTEP = 0 ] |
170 | then | 166 | then |
171 | PROGSTEP=1 | 167 | PROGSTEP=1 |
@@ -181,14 +177,7 @@ do | |||
181 | /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1 | 177 | /sbin/verchg -v $VTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1 |
182 | /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1 | 178 | /sbin/verchg -m $MTMPNAME $TMPHEAD $MODULEID $MODULESIZE > /dev/null 2>&1 |
183 | 179 | ||
184 | if [ "$MODEL" = "SL-C3100" ] && [ $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 | 180 | #loop |
191 | else | ||
192 | while [ $DATAPOS -lt $DATASIZE ] | 181 | while [ $DATAPOS -lt $DATASIZE ] |
193 | do | 182 | do |
194 | #data create | 183 | #data create |
@@ -200,21 +189,14 @@ do | |||
200 | #handle data file | 189 | #handle data file |
201 | #echo 'ADDR='$ADDR | 190 | #echo 'ADDR='$ADDR |
202 | #echo 'SIZE='$TMPSIZE | 191 | #echo 'SIZE='$TMPSIZE |
203 | #echo 'TMPDATA='$TMPDATA | 192 | next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1` |
204 | if [ $ISLOGICAL = 0 ] | 193 | if [ "$next_addr" = "" ]; then |
205 | then | 194 | echo "ERROR:flash write" |
206 | next_addr=`/sbin/nandcp -a $ADDR $TMPDATA $TARGET_MTD 2>/dev/null | fgrep "mtd address" | cut -d- -f2 | cut -d\( -f1` | 195 | rm $TMPDATA > /dev/null 2>&1 |
207 | if [ "$next_addr" = "" ]; then | 196 | RESULT=3 |
208 | echo "ERROR:flash write" | 197 | break; |
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 | 198 | fi |
199 | ADDR=$next_addr | ||
218 | 200 | ||
219 | rm $TMPDATA > /dev/null 2>&1 | 201 | rm $TMPDATA > /dev/null 2>&1 |
220 | 202 | ||
@@ -227,11 +209,9 @@ do | |||
227 | done | 209 | done |
228 | done | 210 | done |
229 | 211 | ||
230 | fi | ||
231 | |||
232 | echo '' | 212 | echo '' |
233 | 213 | ||
234 | #finish | 214 | #finish |
235 | rm -f $TMPPATH/*.bin > /dev/null 2>&1 | 215 | rm -f $TMPPATH/*.bin > /dev/null 2>&1 |
236 | 216 | ||
237 | if [ $RESULT = 0 ] | 217 | if [ $RESULT = 0 ] |
@@ -249,4 +229,55 @@ do | |||
249 | fi | 229 | fi |
250 | done | 230 | done |
251 | 231 | ||
232 | ## HDD image | ||
233 | for TARGETFILE in hdimage1.tgz HDIMAGE1.TGZ | ||
234 | do | ||
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 | |||
262 | #This can be useful for debugging | ||
263 | #/bin/sh -i | ||
264 | |||
265 | |||
266 | echo 'Now extracting...' | ||
267 | gzip -dc $DATAPATH/$TARGETFILE | $TARBIN xf - | ||
268 | if [ "$?" != "0" ]; then | ||
269 | echo "Error!" | ||
270 | exit "$?" | ||
271 | fi | ||
272 | |||
273 | echo 'Success!' | ||
274 | |||
275 | |||
276 | # remount as RO | ||
277 | cd / | ||
278 | umount /hdd1 | ||
279 | mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1 | ||
280 | fi | ||
281 | done | ||
282 | |||
252 | exit 0 | 283 | exit 0 |
diff --git a/openembedded/packages/zaurus-updater/zaurus-updater.bb b/openembedded/packages/zaurus-updater/zaurus-updater.bb index ecbf353d2d..42e80c4ab7 100644 --- a/openembedded/packages/zaurus-updater/zaurus-updater.bb +++ b/openembedded/packages/zaurus-updater/zaurus-updater.bb | |||
@@ -1,9 +1,11 @@ | |||
1 | DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update" | 1 | DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update" |
2 | DEPENDS = "encdec-updater-native" | 2 | DEPENDS = "encdec-updater-native" |
3 | LICENSE = "zaurus-updater" | 3 | LICENSE = "zaurus-updater" |
4 | PACKAGE_ARCH = "${MACHINE}" | ||
5 | PR = "r2" | 4 | PR = "r2" |
6 | 5 | ||
6 | PACKAGES = "" | ||
7 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
8 | |||
7 | SRC_URI = "file://updater.sh \ | 9 | SRC_URI = "file://updater.sh \ |
8 | file://gnu-tar.gz" | 10 | file://gnu-tar.gz" |
9 | S = "${WORKDIR}" | 11 | S = "${WORKDIR}" |