[OpenWrt-Devel] [PATCH] ath79: enable all space on Netgear ar9344-based WNDR routers

Michal Cieslakiewicz michal.cieslakiewicz at wp.pl
Tue Nov 19 10:17:37 EST 2019


Hello David,

Two questions were raised just after publishing 'all-flash-space' patch.
Now I am ready to provide more information on these issues:

0. Downgrade to vendor firmware.

It is possible. Just don't forget to erase both ubi concat partitions:
'mtd -r erase ubi' does the job fine.

1. Sysupgrade:

> > 
> > Have you tried if this breaks sysupgrade from an older OpenWrt
> > firmware? I'm not sure if an UBI resize works without additional
> > steps.
> > 

You were right, rootfs_data volume stays small after sysupgrade. My
approach is to execute 'ubirsvol' command for /dev/ubi0_1 and allocate
all available space. There are caveats however:

* command cannot be run after rootfs_data is mounted (device busy)
* command cannot be run in sysupgrade sequence (sysupgrade works in old
  system that is not mtd-concat aware)

I came out with a solution - to plug into preinit phase after ubi is
available but before ubi rootfs_data volume is started and incorporated
into overlayfs. Here is script (only for ath79/nand target so path is
target/linux/ath79/nand/base-files/lib/preinit/78_ubi_grow_rootfs_data).
I've tested it by running sysupgrade on my WNDR4300 and volume was
resized correctly.

----
#!/bin/sh

grow_ubi_volume() {
	local free_lebs="$(ubinfo /dev/ubi0 | awk '$1=="Amount" && $3=="available" { print $6 }')"
	local used_lebs="$(ubinfo /dev/ubi0_$1 | awk '$1=="Size:" { print $2 }')"

	if [ $free_lebs -eq 0 ] ; then
		return
	fi

	echo "- grow ubi volume (id $1) -"
	ubirsvol /dev/ubi0 -n $1 -S $(($used_lebs+$free_lebs))
}

do_grow_ubi_rootfs_data() {
	local board_name="$(cat /tmp/sysinfo/board_name || echo '')"

	case "$board_name" in
		netgear,wndr3700-v4|\
		netgear,wndr4300)
			grow_ubi_volume 1
		;;
	esac
}

boot_hook_add preinit_main do_grow_ubi_rootfs_data
----

I'll gladly read your opinion on above solution. Can it be accepted into mainline ?

Best regards
Michal

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list