aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/base-files/lib/upgrade
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-06-06 17:52:53 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-06-06 17:52:53 +0000
commit775d0ecf90058059e99942a4d0737151a46f8a61 (patch)
tree8d575ff784684dcfbf43f60dffe5dd871aff8e77 /target/linux/bcm53xx/base-files/lib/upgrade
parent408e385560c79f645b796776bbce73c8f1a38a52 (diff)
downloadupstream-775d0ecf90058059e99942a4d0737151a46f8a61.tar.gz
upstream-775d0ecf90058059e99942a4d0737151a46f8a61.tar.bz2
upstream-775d0ecf90058059e99942a4d0737151a46f8a61.zip
bcm53xx: fallback to default_do_upgrade if NAND upgrade fails
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45915 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/bcm53xx/base-files/lib/upgrade')
-rw-r--r--target/linux/bcm53xx/base-files/lib/upgrade/platform.sh12
1 files changed, 12 insertions, 0 deletions
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