zaurus-updater: add support for home partition reflashing
PATCH 1/1 zaurus-updater: add support for home partition reflashing
Sometimes one needs to clean/reflash the home partition. Add support for flashing home.bin/HOME.BIN files onto "home" mtd device.
--- packages/zaurus-updater/zaurus-updater.bb | 2 +- packages/zaurus-updater/zaurus-updater/updater.sh | 38 +++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-)
packages/zaurus-updater/zaurus-updater.bb +1 -1
@@ -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}"
packages/zaurus-updater/zaurus-updater/updater.sh +36 -2
@@ -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"
Signature · 1 line
1.5.6.5
Dne Sat, 29 Nov 2008 03:48:48 +0300
Dmitry Baryshkov <[email protected]> napsal(a):
Quoted 3 lines
Sometimes one needs to clean/reflash the home partition. Add support for flashing home.bin/HOME.BIN files onto "home" mtd device.
Somebody may found it useful (e. g. for initial setup).
Note that on models with HDD it will not do what is expected. It will format 2nd NAND partition, but /home is on /dev/hda2.
When you are discussing updater, I would like to discuss few additional changes:
1. Decrease number of reserved sectors while formatting the HDD. 5% is far too much of space unusable for packages installation. I have 5% free, but unable to run applications using /tmp. I propose 0% (or only a few blocks).
2. Support for langpacks. OE does not create langpack yet, but it would be nice to be able to flash localized system.
3. I am using post-flash customization using a combination of additional files and patches. It would be nice to have something like that directly as an updater feature.
Signature · 2 lines
Stanislav Brabec http://www.penguin.cz/~utx/zaurus
2008/11/29 Stanislav Brabec <[email protected]>:
Quoted 11 lines
Dne Sat, 29 Nov 2008 03:48:48 +0300
Dmitry Baryshkov <[email protected]> napsal(a):Quoted 3 lines
Sometimes one needs to clean/reflash the home partition. Add support for flashing home.bin/HOME.BIN files onto "home" mtd device.
Somebody may found it useful (e. g. for initial setup).
Note that on models with HDD it will not do what is expected. It will format 2nd NAND partition, but /home is on
/dev/hda2.
I don't know what it will format actually. Does the NAND have the "home"-labeled partition on those devices?
Quoted 8 lines
When you are discussing updater, I would like to discuss few additional changes:
1. Decrease number of reserved sectors while formatting the HDD. 5% is far too much of space unusable for packages installation. I have 5% free, but unable to run applications using /tmp. I propose 0% (or only a few blocks).
You can use tune2fs at any time, IIRC, can't you?
Quoted 2 lines
2. Support for langpacks. OE does not create langpack yet, but it would be nice to be able to flash localized system.
As a Russian user, it's definitely +1.
Quoted 3 lines
3. I am using post-flash customization using a combination of additional files and patches. It would be nice to have something like that directly as an updater feature.
It may be nice to have smth. like:
[snip]
if [ -x post-updater-hook.sh ]
then
. post-updater-hook.sh
fi
[snip]
However I dunno if other developers will agree on this?
Signature · 2 lines
With best wishes Dmitry
Quoted 7 lines · Dmitry
Quoted 3 lines · 2008/11/29 Stanislav Brabec wrote:
Note that on models with HDD it will not do what is expected. It will format 2nd NAND partition, but /home is on
/dev/hda2.I don't know what it will format actually. Does the NAND have the "home"-labeled partition on those devices?
On SL-C3000 it probably does not.
On SL-C3100 it has and int contains Sharp ROM /home.
On SL-C3200 it has and it is broken due to bad partitioning table in kernel. Not easy to fix, as kernel cannot differentiate between SL-C3100 and SL-C3200 yet.
Imaging tool just now creates two images: flash and HDD. HDD uses /dev/hda2 as /home, flash uses NAND as /home. AFAIK nobody tests flash image.
Quoted 6 lines
Quoted 4 lines
1. Decrease number of reserved sectors while formatting the HDD. 5% is far too much of space unusable for packages installation. I have 5% free, but unable to run applications using /tmp. I propose 0% (or only a few blocks).
You can use tune2fs at any time, IIRC, can't you?
Yes, you can. This operation is possible even on mounted device. But tune2fs is not part of the default image, and you need additional reboot. I guess that reserved sectors don't have a real meaning on Zaurus.
Quoted 4 lines
Quoted 2 lines
2. Support for langpacks. OE does not create langpack yet, but it would be nice to be able to flash localized system.
As a Russian user, it's definitely +1.
Its support would be only a first step. Creating them is a more complicated task.
Quoted 4 lines
Quoted 3 lines
3. I am using post-flash customization using a combination of additional files and patches. It would be nice to have something like that directly as an updater feature.
Quoted 8 lines
It may be nice to have smth. like:
[snip]
if [ -xpost-updater-hook.sh]
then
.post-updater-hook.sh
fi
[snip]
Yes, it looks flexible. If the hook script will return 1, shell can be launched.
________________________________________________________________________
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
Quoted 9 lines · Stanislav Brabec
Quoted 5 lines · Dmitry
Quoted 2 lines · 2008/11/29 Stanislav Brabec wrote:
2. Support for langpacks. OE does not create langpack yet, but it would be nice to be able to flash localized system.
As a Russian user, it's definitely +1.
Its support would be only a first step. Creating them is a more complicated task.
As a first step angstrom is now generating feed config files for the locale feeds:
regards,
Koen