Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Subject: [PATCH] zaurus-updater: add support for home partition reflashing
Date: Sat, 29 Nov 2008 03:48:48 +0300	[thread overview]
Message-ID: <1227919728-4878-1-git-send-email-dbaryshkov@gmail.com> (raw)

Sometimes one needs to clean/reflash the home partition.
Add support for flashing home.bin/HOME.BIN files onto "home" mtd
device.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 packages/zaurus-updater/zaurus-updater.bb         |    2 +-
 packages/zaurus-updater/zaurus-updater/updater.sh |   38 +++++++++++++++++++-
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/packages/zaurus-updater/zaurus-updater.bb b/packages/zaurus-updater/zaurus-updater.bb
index 56f067c..6ed1c5f 100644
--- a/packages/zaurus-updater/zaurus-updater.bb
+++ b/packages/zaurus-updater/zaurus-updater.bb
@@ -1,7 +1,7 @@
 DESCRIPTION = "Encrypted shellscript for the Zaurus ROM update"
 DEPENDS = "encdec-updater-native"
 LICENSE = "zaurus-updater"
-PR = "r21"
+PR = "r22"
 
 PACKAGES = ""
 PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/packages/zaurus-updater/zaurus-updater/updater.sh b/packages/zaurus-updater/zaurus-updater/updater.sh
index 22d4b39..f195aff 100644
--- a/packages/zaurus-updater/zaurus-updater/updater.sh
+++ b/packages/zaurus-updater/zaurus-updater/updater.sh
@@ -42,6 +42,9 @@
 #
 # 2007.12.25 Matthias 'CoreDump' Hentges
 # -Add support for installing / updating u-boot
+#
+# 2008.11.23 Dmitry 'lumag' Baryshkov
+# - Add support for reflashing home partitions
 
 # Set to "yes" to enable
 ENABLE_UBOOT_UPDATER="no"
@@ -53,6 +56,7 @@ TMPHEAD=$TMPPATH/tmphead.bin
 
 FLASHED_KERNEL=0
 FLASHED_ROOTFS=0
+FLASHED_HOMEFS=0
 UNPACKED_ROOTFS=0   # spitz only
 
 RO_MTD_LINE=`cat /proc/mtd | grep "root" | tail -n 1`
@@ -63,6 +67,14 @@ RO_MTD_NO=`echo $RO_MTD_LINE | cut -d: -f1 | cut -dd -f2`
 RO_MTD=/dev/mtd$RO_MTD_NO
 ROOTFS_SIZE=`echo $RO_MTD_LINE | cut -d" " -f2`
 
+RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
+if [ "$RW_MTD_LINE" = "" ]; then
+    RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
+fi
+RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
+RW_MTD=/dev/mtd$RW_MTD_NO
+HOMEFS_SIZE=`echo $RO_MTD_LINE | cut -d" " -f2`
+
 LOGOCAL_MTD=/dev/mtd1
 
 VERBLOCK=0x48000
@@ -381,7 +393,7 @@ mkdir -p $TMPPATH > /dev/null 2>&1
 
 cd $DATAPATH/
 
-for 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
+for 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 home.bin HOME.BIN
 do
     if [ ! -e $TARGETFILE ]
     then
@@ -438,6 +450,28 @@ do
         FLASH_TYPE=""
         ;;
 
+    home.bin)
+        if [ $FLASHED_HOMEFS != 0 ]
+        then
+            continue
+        fi
+        echo 'home file system'
+        FLASHED_HOMEFS=1
+        ISLOGICAL=0
+        ADDR=0
+        ISFORMATTED=0
+        MTD_PART_SIZE="0x$HOMEFS_SIZE"
+        ADDR=0
+        ISFORMATTED=0
+        TARGET_MTD=$RW_MTD
+        DATAPOS=0
+        ONESIZE=1048576
+        FLASH_TYPE="home"
+        /sbin/bcut -s 16 -o $TMPHEAD $TARGETFILE
+        do_flashing
+        FLASH_TYPE=""
+        ;;
+
     hdimage1.tgz)
         if [ $UNPACKED_ROOTFS = 0 ]
         then
@@ -446,7 +480,7 @@ do
         ;;
     
     u-boot.bin)
-    	if [ FLASHED_UBOOT != 1 ]
+        if [ $FLASHED_UBOOT != 1 ]
 	then
 		update_uboot "$TARGETFILE"
 		FLASHED_UBOOT="1"
-- 
1.5.6.5




             reply	other threads:[~2008-11-29  0:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-29  0:48 Dmitry Baryshkov [this message]
2008-11-29 20:32 ` [PATCH] zaurus-updater: add support for home partition reflashing Stanislav Brabec
2008-12-01  2:10   ` Dmitry
2008-12-01 10:15     ` Stanislav Brabec
2008-12-01 10:44       ` Koen Kooi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1227919728-4878-1-git-send-email-dbaryshkov@gmail.com \
    --to=dbaryshkov@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox