summaryrefslogtreecommitdiff
path: root/packages/zaurus-updater
diff options
context:
space:
mode:
authorMatthias Hentges <oe@hentges.net>2007-12-25 15:08:11 +0000
committerMatthias Hentges <oe@hentges.net>2007-12-25 15:08:11 +0000
commit21188c7e9dd291cb1e2ae3da839556bdfbe795cd (patch)
tree1a252621f779160c9f33134c29c2e16ff23ff17d /packages/zaurus-updater
parent58d08348e701f6efb483546e39e029f3cb8df429 (diff)
zaurus-updater: Add support for installing and updating u-boot, disabled by default.
Diffstat (limited to 'packages/zaurus-updater')
-rw-r--r--packages/zaurus-updater/zaurus-updater.bb2
-rw-r--r--packages/zaurus-updater/zaurus-updater/updater.sh67
2 files changed, 65 insertions, 4 deletions
diff --git a/packages/zaurus-updater/zaurus-updater.bb b/packages/zaurus-updater/zaurus-updater.bb
index fb4d6e2584..052560dcc9 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 = "r19"
+PR = "r20"
PACKAGES = ""
PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/packages/zaurus-updater/zaurus-updater/updater.sh b/packages/zaurus-updater/zaurus-updater/updater.sh
index ed558be941..22d4b3914d 100644
--- a/packages/zaurus-updater/zaurus-updater/updater.sh
+++ b/packages/zaurus-updater/zaurus-updater/updater.sh
@@ -39,6 +39,12 @@
# - Unify format of do_flashing()...
# - Display ${PR} of zaurus-updater.bb to the user
# - Polish HDD installer messages
+#
+# 2007.12.25 Matthias 'CoreDump' Hentges
+# -Add support for installing / updating u-boot
+
+# Set to "yes" to enable
+ENABLE_UBOOT_UPDATER="no"
DATAPATH=$1
TMPPATH=/tmp/update
@@ -289,6 +295,53 @@ do_flashing()
fi
}
+update_uboot() {
+ # The flashing part of this function is based on pdaXrom's
+ # updater.sh
+
+ if test "$ENABLE_UBOOT_UPDATER" != "yes" -o -z "$1"
+ then
+ echo "u-boot updates not allowed."
+ return
+ fi
+
+ echo ""
+ echo "Installing u-boot bootloader:"
+
+ DATASIZE=`wc -c $TARGETFILE`
+ FSIZE=`echo $DATASIZE | cut -d' ' -f1`
+
+ echo -n "* Creating backup ($FSIZE Bytes)..."
+ if ( nandlogical /dev/mtd1 READ 0 $FSIZE /tmp/sharploader.bin ) > /dev/null 2>&1
+ then
+ echo "Ok"
+
+ echo -n "* Flashing u-boot..."
+ if ( nandlogical /dev/mtd1 WRITE 0 $FSIZE $1 ) > /dev/null 2>&1
+ then
+ echo "Success"
+ else
+ echo "FAILED"
+ echo "ERROR: Installation of u-boot failed!"
+
+ echo -n "* Trying to restore backup..."
+ if ( nandlogical /dev/mtd1 WRITE 0 $FSIZE /tmp/sharploader.bin ) > /dev/null 2>&1
+ then
+ echo "Success"
+ echo "Your old bootloader has been restored"
+ else
+ echo "FAILED"
+ echo "Sorry, it's NAND-Restore time for you =("
+ fi
+ fi
+ else
+ echo "FAILED"
+ echo "Could not create backup, aborting!"
+ echo "Your bootloader has not been altered in any way."
+ exit 1
+ fi
+}
+
### Check model ###
/sbin/writerominfo
MODEL=`cat /proc/deviceinfo/product`
@@ -328,7 +381,7 @@ mkdir -p $TMPPATH > /dev/null 2>&1
cd $DATAPATH/
-for TARGETFILE in 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
do
if [ ! -e $TARGETFILE ]
then
@@ -388,10 +441,18 @@ do
hdimage1.tgz)
if [ $UNPACKED_ROOTFS = 0 ]
then
- do_rootfs_extraction
+ do_rootfs_extraction
fi
;;
-
+
+ u-boot.bin)
+ if [ FLASHED_UBOOT != 1 ]
+ then
+ update_uboot "$TARGETFILE"
+ FLASHED_UBOOT="1"
+ fi
+ ;;
+
*)
;;
esac