diff options
author | Richard Purdie <richard@openedhand.com> | 2008-04-10 09:50:54 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-04-10 09:50:54 +0000 |
commit | faf55131c9b86a8646dd80ca79b44a001b88a87f (patch) | |
tree | d8127bd7dd5339145a21c1aa8c6b850f681f05b8 /scripts/poky-nokia800-flashutil | |
parent | 5091c0bd8842b2a5f94e47c391dc6fe73eac8901 (diff) | |
download | poky-faf55131c9b86a8646dd80ca79b44a001b88a87f.tar.gz |
scripts: Add support for nokia800 to runqemu
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4226 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'scripts/poky-nokia800-flashutil')
-rwxr-xr-x | scripts/poky-nokia800-flashutil | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/poky-nokia800-flashutil b/scripts/poky-nokia800-flashutil new file mode 100755 index 0000000000..8d40f1dbf9 --- /dev/null +++ b/scripts/poky-nokia800-flashutil | |||
@@ -0,0 +1,53 @@ | |||
1 | #! /bin/sh | ||
2 | # Copyright (C) 2008 OpenedHand Ltd. | ||
3 | # Contact: andrew@openedhand.com | ||
4 | # | ||
5 | # Erase the partition given in $3 (default: rootfs) and flash the contents | ||
6 | # of image given in $1 into the image $2. | ||
7 | |||
8 | if [ ! -r "$1" ]; then | ||
9 | echo "Usage: $0 <image> <destimage> [<partition>]" | ||
10 | exit -1 | ||
11 | fi | ||
12 | |||
13 | if [ ! -e "$2" ]; then | ||
14 | echo "foo" | ||
15 | # Making an empty/erased flash image. Need a correct echo behavior. | ||
16 | dd if=/dev/zero of=$2 bs=268435456 count=0 seek=1 | ||
17 | bash -c 'echo -en \\0377\\0377\\0377\\0377\\0377\\0377\\0377\\0377 > .8b' | ||
18 | cat .8b .8b > .16b # OOB is 16 bytes | ||
19 | cat .16b .16b .16b .16b .16b .16b .16b .16b > .8sec | ||
20 | cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec | ||
21 | cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec | ||
22 | cat .512sec .512sec .512sec .512sec > .2ksec | ||
23 | cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16k | ||
24 | cat .16k .16k .16k .16k .16k .16k .16k .16k > .128k | ||
25 | # N800 NAND is 512k sectors big | ||
26 | cat .128k .128k .128k .128k >> $2 | ||
27 | rm -rf .8b .16b .8sec .64sec .512sec .2ksec .16k, .128k | ||
28 | fi | ||
29 | |||
30 | if [ "$3" != "" ]; then | ||
31 | case "$3" in | ||
32 | config) | ||
33 | partition=/dev/mtd1 | ||
34 | page=64 | ||
35 | ;; | ||
36 | initfs) | ||
37 | partition=/dev/mtd3 | ||
38 | page=1280 | ||
39 | ;; | ||
40 | rootfs) | ||
41 | partition=/dev/mtd4 | ||
42 | page=2304 | ||
43 | ;; | ||
44 | *) | ||
45 | echo "Unknown partition $2" | ||
46 | exit -1 | ||
47 | esac | ||
48 | else | ||
49 | partition=/dev/mtd4 | ||
50 | page=2304 | ||
51 | fi | ||
52 | |||
53 | dd if=$1 of=$2 conv=notrunc bs=2048 seek=$page | ||