bcm53xx: sysupgrade: check if new kernel fits partition size

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45547 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Rafał Miłecki 2015-04-21 11:21:34 +00:00
parent 495a1b4e5f
commit 680b5b613d
1 changed files with 7 additions and 2 deletions

View File

@ -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)