From 46a25c6e8a4b211afe44d9efc1426741f624f700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 6 Jun 2015 17:52:53 +0000 Subject: bcm53xx: fallback to default_do_upgrade if NAND upgrade fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki SVN-Revision: 45915 --- target/linux/bcm53xx/base-files/lib/upgrade/platform.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'target/linux') diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh index 25d22d9528..131f6dd2a7 100644 --- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh @@ -130,6 +130,10 @@ platform_pre_upgrade() { ${offset:+-o $offset} \ -1 $dir/kernel \ -2 $dir/root + [ $? -ne 0 ] && { + echo "Failed to extract TRX partitions." + return + } # Firmwares without UBI image should be flashed "normally" local root_type=$(identify $dir/root) @@ -156,6 +160,10 @@ platform_pre_upgrade() { otrx create /tmp/kernel.trx \ -f $dir/kernel -b $(($linux_length + 28)) \ -f /tmp/null.bin + [ $? -ne 0 ] && { + echo "Failed to create simple TRX with new kernel." + return + } # Prepare UBI image (drop unwanted extra blocks) local ubi_length=0 @@ -163,6 +171,10 @@ platform_pre_upgrade() { ubi_length=$(($ubi_length + 131072)) done dd if=$dir/root of=/tmp/root.ubi bs=131072 count=$((ubi_length / 131072)) 2>/dev/null + [ $? -ne 0 ] && { + echo "Failed to prepare new UBI image." + return + } # Flash mtd write /tmp/kernel.trx firmware -- cgit v1.2.3