mirror of
https://github.com/openwrt/openwrt.git
synced 2025-02-01 16:58:22 +00:00
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>
This commit is contained in:
parent
547f1ec25a
commit
8abefc8896
@ -1,4 +1,4 @@
|
|||||||
RAMFS_COPY_BIN='osafeloader oseama otrx'
|
RAMFS_COPY_BIN='osafeloader oseama otrx truncate'
|
||||||
|
|
||||||
PART_NAME=firmware
|
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
|
while [ "$(dd if=$dir/root skip=$ubi_length bs=1 count=4 2>/dev/null)" = "UBI#" ]; do
|
||||||
ubi_length=$(($ubi_length + 131072))
|
ubi_length=$(($ubi_length + 131072))
|
||||||
done
|
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 ] && {
|
[ $? -ne 0 ] && {
|
||||||
echo "Failed to prepare new UBI image."
|
echo "Failed to prepare new UBI image."
|
||||||
return
|
return
|
||||||
@ -289,7 +289,7 @@ platform_do_upgrade_nand_trx() {
|
|||||||
|
|
||||||
# Flash
|
# Flash
|
||||||
mtd write /tmp/kernel.trx firmware || exit 1
|
mtd write /tmp/kernel.trx firmware || exit 1
|
||||||
nand_do_upgrade /tmp/root.ubi
|
nand_do_upgrade $dir/root
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_do_upgrade_nand_seama() {
|
platform_do_upgrade_nand_seama() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user