aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-04-21 11:21:34 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-04-21 11:21:34 +0000
commit866fe3895da77b96999c77bbb7d23737fd93d34e (patch)
tree3e38e48302c3440d5db6d8dacbd513274702896b /target/linux/bcm53xx
parent457d9caf4db7e28eb50a4a46f456373d463de394 (diff)
downloadupstream-866fe3895da77b96999c77bbb7d23737fd93d34e.tar.gz
upstream-866fe3895da77b96999c77bbb7d23737fd93d34e.tar.bz2
upstream-866fe3895da77b96999c77bbb7d23737fd93d34e.zip
bcm53xx: sysupgrade: check if new kernel fits partition size
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45547
Diffstat (limited to 'target/linux/bcm53xx')
-rw-r--r--target/linux/bcm53xx/base-files/lib/upgrade/platform.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index e53c2513d2..88629549dc 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -152,12 +152,17 @@ platform_pre_upgrade() {
echo "Unable to find \"linux\" partition size"
exit 1
}
- linux_length=$((0x$linux_length + 28))
+ linux_length=$((0x$linux_length))
+ local kernel_length=$(wc -c $dir/kernel | cut -d ' ' -f 1)
+ [ $kernel_length -gt $linux_length ] && {
+ echo "New kernel doesn't fit \"linux\" partition."
+ return
+ }
rm -f /tmp/null.bin
rm -f /tmp/kernel.trx
touch /tmp/null.bin
otrx create /tmp/kernel.trx \
- -f $dir/kernel -b $linux_length \
+ -f $dir/kernel -b $(($linux_length + 28)) \
-f /tmp/null.bin
# Prepare UBI image (drop unwanted extra blocks)