aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2020-02-20 13:40:55 +0100
committerRafał Miłecki <rafal@milecki.pl>2020-03-21 22:31:35 +0100
commit8abefc8896e7138a101fbb3d228946c43321503e (patch)
treef71f2ca74fc2d6f7a881c68792ce822ff62ba46b
parent547f1ec25af59f9e69ae3cb69d1312e63138d4bf (diff)
downloadupstream-8abefc8896e7138a101fbb3d228946c43321503e.tar.gz
upstream-8abefc8896e7138a101fbb3d228946c43321503e.tar.bz2
upstream-8abefc8896e7138a101fbb3d228946c43321503e.zip
bcm53xx: sysupgrade: optimize building UBI image
Use "truncate" to adjust size of existing file instead of "dd" which required creating a copy. This saves space on tmpfs. It may be as low as 2.1 MiB when using OpenWrt default user space and way more (20+ MiB) when flashing vendor firmware. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-rw-r--r--target/linux/bcm53xx/base-files/lib/upgrade/platform.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
index 1686462cde..40b2ef67be 100644
--- a/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm53xx/base-files/lib/upgrade/platform.sh
@@ -1,4 +1,4 @@
-RAMFS_COPY_BIN='osafeloader oseama otrx'
+RAMFS_COPY_BIN='osafeloader oseama otrx truncate'
PART_NAME=firmware
@@ -281,7 +281,7 @@ platform_do_upgrade_nand_trx() {
while [ "$(dd if=$dir/root skip=$ubi_length bs=1 count=4 2>/dev/null)" = "UBI#" ]; do
ubi_length=$(($ubi_length + 131072))
done
- dd if=$dir/root of=/tmp/root.ubi bs=131072 count=$((ubi_length / 131072)) 2>/dev/null
+ truncate -s $ubi_length $dir/root
[ $? -ne 0 ] && {
echo "Failed to prepare new UBI image."
return
@@ -289,7 +289,7 @@ platform_do_upgrade_nand_trx() {
# Flash
mtd write /tmp/kernel.trx firmware || exit 1
- nand_do_upgrade /tmp/root.ubi
+ nand_do_upgrade $dir/root
}
platform_do_upgrade_nand_seama() {