summaryrefslogtreecommitdiff
path: root/scripts/poky-nokia800-flashutil
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2008-04-10 09:50:54 +0000
committerRichard Purdie <richard@openedhand.com>2008-04-10 09:50:54 +0000
commitfaf55131c9b86a8646dd80ca79b44a001b88a87f (patch)
treed8127bd7dd5339145a21c1aa8c6b850f681f05b8 /scripts/poky-nokia800-flashutil
parent5091c0bd8842b2a5f94e47c391dc6fe73eac8901 (diff)
downloadopenembedded-core-faf55131c9b86a8646dd80ca79b44a001b88a87f.tar.gz
openembedded-core-faf55131c9b86a8646dd80ca79b44a001b88a87f.tar.bz2
openembedded-core-faf55131c9b86a8646dd80ca79b44a001b88a87f.tar.xz
openembedded-core-faf55131c9b86a8646dd80ca79b44a001b88a87f.zip
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-xscripts/poky-nokia800-flashutil53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/poky-nokia800-flashutil b/scripts/poky-nokia800-flashutil
new file mode 100755
index 000000000..8d40f1dbf
--- /dev/null
+++ b/scripts/poky-nokia800-flashutil
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2008 OpenedHand Ltd.
+# Contact: andrew@openedhand.com
+#
+# Erase the partition given in $3 (default: rootfs) and flash the contents
+# of image given in $1 into the image $2.
+
+if [ ! -r "$1" ]; then
+ echo "Usage: $0 <image> <destimage> [<partition>]"
+ exit -1
+fi
+
+if [ ! -e "$2" ]; then
+ echo "foo"
+ # Making an empty/erased flash image. Need a correct echo behavior.
+ dd if=/dev/zero of=$2 bs=268435456 count=0 seek=1
+ bash -c 'echo -en \\0377\\0377\\0377\\0377\\0377\\0377\\0377\\0377 > .8b'
+ cat .8b .8b > .16b # OOB is 16 bytes
+ cat .16b .16b .16b .16b .16b .16b .16b .16b > .8sec
+ cat .8sec .8sec .8sec .8sec .8sec .8sec .8sec .8sec > .64sec
+ cat .64sec .64sec .64sec .64sec .64sec .64sec .64sec .64sec > .512sec
+ cat .512sec .512sec .512sec .512sec > .2ksec
+ cat .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec .2ksec > .16k
+ cat .16k .16k .16k .16k .16k .16k .16k .16k > .128k
+ # N800 NAND is 512k sectors big
+ cat .128k .128k .128k .128k >> $2
+ rm -rf .8b .16b .8sec .64sec .512sec .2ksec .16k, .128k
+fi
+
+if [ "$3" != "" ]; then
+ case "$3" in
+ config)
+ partition=/dev/mtd1
+ page=64
+ ;;
+ initfs)
+ partition=/dev/mtd3
+ page=1280
+ ;;
+ rootfs)
+ partition=/dev/mtd4
+ page=2304
+ ;;
+ *)
+ echo "Unknown partition $2"
+ exit -1
+ esac
+else
+ partition=/dev/mtd4
+ page=2304
+fi
+
+dd if=$1 of=$2 conv=notrunc bs=2048 seek=$page