summaryrefslogtreecommitdiffstats
path: root/meta/recipes-bsp/zaurus-updater
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-bsp/zaurus-updater
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-bsp/zaurus-updater')
-rw-r--r--meta/recipes-bsp/zaurus-updater/encdec-updater.bb18
-rw-r--r--meta/recipes-bsp/zaurus-updater/encdec-updater/encdec-updater.c80
-rw-r--r--meta/recipes-bsp/zaurus-updater/zaurus-updater.bb36
-rw-r--r--meta/recipes-bsp/zaurus-updater/zaurus-updater/gnu-tar.gzbin0 -> 242146 bytes
-rw-r--r--meta/recipes-bsp/zaurus-updater/zaurus-updater/updater.sh481
5 files changed, 615 insertions, 0 deletions
diff --git a/meta/recipes-bsp/zaurus-updater/encdec-updater.bb b/meta/recipes-bsp/zaurus-updater/encdec-updater.bb
new file mode 100644
index 0000000000..c59d0e2976
--- /dev/null
+++ b/meta/recipes-bsp/zaurus-updater/encdec-updater.bb
@@ -0,0 +1,18 @@
1SECTION = "console/utils"
2LICENSE = "GPL"
3DESCRIPTION = "A tool to encode and decode the Sharp Zaurus updater.sh script"
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}
17
18BBCLASSEXTEND = "native" \ No newline at end of file
diff --git a/meta/recipes-bsp/zaurus-updater/encdec-updater/encdec-updater.c b/meta/recipes-bsp/zaurus-updater/encdec-updater/encdec-updater.c
new file mode 100644
index 0000000000..b894623c65
--- /dev/null
+++ b/meta/recipes-bsp/zaurus-updater/encdec-updater/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/recipes-bsp/zaurus-updater/zaurus-updater.bb b/meta/recipes-bsp/zaurus-updater/zaurus-updater.bb
new file mode 100644
index 0000000000..a621761d66
--- /dev/null
+++ b/meta/recipes-bsp/zaurus-updater/zaurus-updater.bb
@@ -0,0 +1,36 @@
1DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update"
2DEPENDS = "encdec-updater-native"
3LICENSE = "zaurus-updater"
4PR = "r20"
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
14inherit deploy
15
16do_configure() {
17 sed -i "s/ZAURUS_UPDATER_VERSION/${PR}/" "${S}/updater.sh"
18}
19
20do_compile() {
21 encdec-updater -e updater.sh
22}
23
24do_deploy() {
25 install -m 0755 updater.sh ${DEPLOYDIR}/updater.sh.${MACHINE}
26
27 case ${MACHINE} in
28 spitz )
29 install -m 0755 gnu-tar ${DEPLOYDIR}/gnu-tar
30 ;;
31 *)
32 ;;
33 esac
34}
35
36addtask deploy before do_populate_sysroot after do_compile
diff --git a/meta/recipes-bsp/zaurus-updater/zaurus-updater/gnu-tar.gz b/meta/recipes-bsp/zaurus-updater/zaurus-updater/gnu-tar.gz
new file mode 100644
index 0000000000..93d1a43704
--- /dev/null
+++ b/meta/recipes-bsp/zaurus-updater/zaurus-updater/gnu-tar.gz
Binary files differ
diff --git a/meta/recipes-bsp/zaurus-updater/zaurus-updater/updater.sh b/meta/recipes-bsp/zaurus-updater/zaurus-updater/updater.sh
new file mode 100644
index 0000000000..22d4b3914d
--- /dev/null
+++ b/meta/recipes-bsp/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#