Re: [OpenWrt-Devel] [PATCH 2/4] ubinize-image: Change the rootfs to a static volume

2014-11-16 Thread Maxime Ripard
On Sun, Nov 16, 2014 at 10:54:18AM +0100, Daniel Golle wrote:
> Hi Maxime,
> 
> first of all sorry for the late reply.
> 
> On Mon, Oct 27, 2014 at 11:16:13AM +0100, Maxime Ripard wrote:
> > Hi Daniel,
> > > This will break things if rootfs is a read-write UBIFS volume which should
> > > by dynamic.
> > 
> > Indeed, but is this something that is usually done in OpenWRT?
> 
> Yes. Similar to having the option of using either JFFS2 (rw) or SquashFS (ro)
> as rootfs on NOR-based devices, allowing users to use UBIFS (rw) rootfs can
> make sense depending on the requirements further down the road.

Ok.

Who makes this decision? The user? The target? Someone else?

> > > I also saw weird things happening when trying to access static
> > > volumes in U-Boot and thus avoided them for now.
> > > Please also consider that ubootenv* and kernel could be static volumes as
> > > well, however, that needs to be tested with a more recent U-Boot (I hope
> > > it'll work).
> > 
> > Indeed, the kernel and bootloader might be static too.
> > 
> > The only other solution I could think of was to force the size of the
> > ubifs rootfs image to something like 10MB in our case. Which looks a
> > bit counter-productive.
> 
> I don't understand why that would be needed.
> From what I saw, support for static volumes is hardly being used anywhere
> and thus in exactly in the best shape.
> I never encountered any problems writing fixed-size read-only images into
> a dynamic UBI volume and just not using random-access write and dynamic
> resize features. The cost of using dynamic volumes vs. static volumes also
> seems neglectible (anyone?)

You're missing the point. The point is UBI for a dynamic volume
requires a bit less that 20 LEBs (I remember it being around 17, but
I'm not sure anymore, and don't have the board here to test).

20 LEBs on a NAND with a PEB-size of 512k represents around 10MB.

So far, OpenWRT generates UBI volumes for the rootfs that are of the
size of the rootfs image you put in it, aligned on a PEB. Which makes
sense. But for it to even just be mounted, this rootfs volume needs to
be more 10MB. Which never happens.

So there's two solutions here:
  - Don't make the rootfs volume dynamic
  - Align the rootfs volume on 20 PEBs, instead of a single one.

The second solution is just dumb, especially when you try to make such
aggressive changes to reduce the size of other components, while you
waste ~7MB on the other side.

I do believe it is the right solution. It might not be enforced at the
right place (but where then? target? board level? we then fall back to
another question I had that was unanswered on this same patch set...)

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] ubinize-image: Change the rootfs to a static volume

2014-11-14 Thread Maxime Ripard
On Thu, Nov 06, 2014 at 05:47:46PM +0100, Maxime Ripard wrote:
> On Mon, Oct 27, 2014 at 11:16:13AM +0100, Maxime Ripard wrote:
> > Hi Daniel,
> > 
> > On Sun, Oct 26, 2014 at 11:37:18PM +0100, Daniel Golle wrote:
> > > Hi Maxime,
> > > 
> > > On Thu, Oct 09, 2014 at 05:59:27PM +0200, Maxime Ripard wrote:
> > > > On boards with large page size, the rootfs we generate might end up 
> > > > using less
> > > > PEB than the minimum number required by UBI for a dynamic volume.
> > > > 
> > > > Change the rootfs to a static volume, which removes such a requirement, 
> > > > and
> > > > isn't changing anything, since our rootfs is in read only anyway.
> > > > 
> > > > Signed-off-by: Maxime Ripard 
> > > > ---
> > > >  scripts/ubinize-image.sh | 6 +-
> > > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
> > > > index 6762c22bc4a6..11c25ecc8ee1 100755
> > > > --- a/scripts/ubinize-image.sh
> > > > +++ b/scripts/ubinize-image.sh
> > > > @@ -25,13 +25,17 @@ ubivol() {
> > > > echo "[$name]"
> > > > echo "mode=ubi"
> > > > echo "vol_id=$volid"
> > > > -   echo "vol_type=dynamic"
> > > > echo "vol_name=$name"
> > > > if [ "$image" ]; then
> > > > echo "image=$image"
> > > > else
> > > > echo "vol_size=1MiB"
> > > > fi
> > > > +   if [ "$name" = "rootfs" ]; then
> > > > +   echo "vol_type=static"
> > > > +   else
> > > > +   echo "vol_type=dynamic"
> > > > +   fi
> > > 
> > > This will break things if rootfs is a read-write UBIFS volume which should
> > > by dynamic.
> > 
> > Indeed, but is this something that is usually done in OpenWRT?
> > 
> > > I also saw weird things happening when trying to access static
> > > volumes in U-Boot and thus avoided them for now.
> > > Please also consider that ubootenv* and kernel could be static volumes as
> > > well, however, that needs to be tested with a more recent U-Boot (I hope
> > > it'll work).
> > 
> > Indeed, the kernel and bootloader might be static too.
> > 
> > The only other solution I could think of was to force the size of the
> > ubifs rootfs image to something like 10MB in our case. Which looks a
> > bit counter-productive.
> 
> Ping?

Daniel?

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] ubinize-image: Change the rootfs to a static volume

2014-11-06 Thread Maxime Ripard
On Mon, Oct 27, 2014 at 11:16:13AM +0100, Maxime Ripard wrote:
> Hi Daniel,
> 
> On Sun, Oct 26, 2014 at 11:37:18PM +0100, Daniel Golle wrote:
> > Hi Maxime,
> > 
> > On Thu, Oct 09, 2014 at 05:59:27PM +0200, Maxime Ripard wrote:
> > > On boards with large page size, the rootfs we generate might end up using 
> > > less
> > > PEB than the minimum number required by UBI for a dynamic volume.
> > > 
> > > Change the rootfs to a static volume, which removes such a requirement, 
> > > and
> > > isn't changing anything, since our rootfs is in read only anyway.
> > > 
> > > Signed-off-by: Maxime Ripard 
> > > ---
> > >  scripts/ubinize-image.sh | 6 +-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
> > > index 6762c22bc4a6..11c25ecc8ee1 100755
> > > --- a/scripts/ubinize-image.sh
> > > +++ b/scripts/ubinize-image.sh
> > > @@ -25,13 +25,17 @@ ubivol() {
> > >   echo "[$name]"
> > >   echo "mode=ubi"
> > >   echo "vol_id=$volid"
> > > - echo "vol_type=dynamic"
> > >   echo "vol_name=$name"
> > >   if [ "$image" ]; then
> > >   echo "image=$image"
> > >   else
> > >   echo "vol_size=1MiB"
> > >   fi
> > > + if [ "$name" = "rootfs" ]; then
> > > + echo "vol_type=static"
> > > + else
> > > + echo "vol_type=dynamic"
> > > + fi
> > 
> > This will break things if rootfs is a read-write UBIFS volume which should
> > by dynamic.
> 
> Indeed, but is this something that is usually done in OpenWRT?
> 
> > I also saw weird things happening when trying to access static
> > volumes in U-Boot and thus avoided them for now.
> > Please also consider that ubootenv* and kernel could be static volumes as
> > well, however, that needs to be tested with a more recent U-Boot (I hope
> > it'll work).
> 
> Indeed, the kernel and bootloader might be static too.
> 
> The only other solution I could think of was to force the size of the
> ubifs rootfs image to something like 10MB in our case. Which looks a
> bit counter-productive.

Ping?

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] ubinize-image: Change the rootfs to a static volume

2014-10-27 Thread Maxime Ripard
Hi Daniel,

On Sun, Oct 26, 2014 at 11:37:18PM +0100, Daniel Golle wrote:
> Hi Maxime,
> 
> On Thu, Oct 09, 2014 at 05:59:27PM +0200, Maxime Ripard wrote:
> > On boards with large page size, the rootfs we generate might end up using 
> > less
> > PEB than the minimum number required by UBI for a dynamic volume.
> > 
> > Change the rootfs to a static volume, which removes such a requirement, and
> > isn't changing anything, since our rootfs is in read only anyway.
> > 
> > Signed-off-by: Maxime Ripard 
> > ---
> >  scripts/ubinize-image.sh | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
> > index 6762c22bc4a6..11c25ecc8ee1 100755
> > --- a/scripts/ubinize-image.sh
> > +++ b/scripts/ubinize-image.sh
> > @@ -25,13 +25,17 @@ ubivol() {
> > echo "[$name]"
> > echo "mode=ubi"
> > echo "vol_id=$volid"
> > -   echo "vol_type=dynamic"
> > echo "vol_name=$name"
> > if [ "$image" ]; then
> > echo "image=$image"
> > else
> > echo "vol_size=1MiB"
> > fi
> > +   if [ "$name" = "rootfs" ]; then
> > +   echo "vol_type=static"
> > +   else
> > +   echo "vol_type=dynamic"
> > +   fi
> 
> This will break things if rootfs is a read-write UBIFS volume which should
> by dynamic.

Indeed, but is this something that is usually done in OpenWRT?

> I also saw weird things happening when trying to access static
> volumes in U-Boot and thus avoided them for now.
> Please also consider that ubootenv* and kernel could be static volumes as
> well, however, that needs to be tested with a more recent U-Boot (I hope
> it'll work).

Indeed, the kernel and bootloader might be static too.

The only other solution I could think of was to force the size of the
ubifs rootfs image to something like 10MB in our case. Which looks a
bit counter-productive.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


signature.asc
Description: Digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/4] ubinize-image: Change the rootfs to a static volume

2014-10-26 Thread Daniel Golle
Hi Maxime,

On Thu, Oct 09, 2014 at 05:59:27PM +0200, Maxime Ripard wrote:
> On boards with large page size, the rootfs we generate might end up using less
> PEB than the minimum number required by UBI for a dynamic volume.
> 
> Change the rootfs to a static volume, which removes such a requirement, and
> isn't changing anything, since our rootfs is in read only anyway.
> 
> Signed-off-by: Maxime Ripard 
> ---
>  scripts/ubinize-image.sh | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
> index 6762c22bc4a6..11c25ecc8ee1 100755
> --- a/scripts/ubinize-image.sh
> +++ b/scripts/ubinize-image.sh
> @@ -25,13 +25,17 @@ ubivol() {
>   echo "[$name]"
>   echo "mode=ubi"
>   echo "vol_id=$volid"
> - echo "vol_type=dynamic"
>   echo "vol_name=$name"
>   if [ "$image" ]; then
>   echo "image=$image"
>   else
>   echo "vol_size=1MiB"
>   fi
> + if [ "$name" = "rootfs" ]; then
> + echo "vol_type=static"
> + else
> + echo "vol_type=dynamic"
> + fi

This will break things if rootfs is a read-write UBIFS volume which should
by dynamic. I also saw weird things happening when trying to access static
volumes in U-Boot and thus avoided them for now.
Please also consider that ubootenv* and kernel could be static volumes as
well, however, that needs to be tested with a more recent U-Boot (I hope
it'll work).


>   if [ "$autoresize" ]; then
>   echo "vol_flags=autoresize"
>   fi
> -- 
> 2.1.1
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/4] ubinize-image: Change the rootfs to a static volume

2014-10-09 Thread Maxime Ripard
On boards with large page size, the rootfs we generate might end up using less
PEB than the minimum number required by UBI for a dynamic volume.

Change the rootfs to a static volume, which removes such a requirement, and
isn't changing anything, since our rootfs is in read only anyway.

Signed-off-by: Maxime Ripard 
---
 scripts/ubinize-image.sh | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/ubinize-image.sh b/scripts/ubinize-image.sh
index 6762c22bc4a6..11c25ecc8ee1 100755
--- a/scripts/ubinize-image.sh
+++ b/scripts/ubinize-image.sh
@@ -25,13 +25,17 @@ ubivol() {
echo "[$name]"
echo "mode=ubi"
echo "vol_id=$volid"
-   echo "vol_type=dynamic"
echo "vol_name=$name"
if [ "$image" ]; then
echo "image=$image"
else
echo "vol_size=1MiB"
fi
+   if [ "$name" = "rootfs" ]; then
+   echo "vol_type=static"
+   else
+   echo "vol_type=dynamic"
+   fi
if [ "$autoresize" ]; then
echo "vol_flags=autoresize"
fi
-- 
2.1.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel