[U-Boot] [PATCH 1/6] arm: socfpga: cyclone5-socdk: Enabling mtd partitioning layout

Marek Vasut
2015-12-14T00:58:04Z

On Monday, December 14, 2015 at 01:43:58 AM, Chin Liang See wrote:
> On Mon, 2015-12-14 at 01:22 +0100, Marek Vasut wrote:
> > On Monday, December 14, 2015 at 01:11:27 AM, Chin Liang See wrote:
> > > On Sun, 2015-12-13 at 16:42 +0100, Marek Vasut wrote:
> > > > On Sunday, December 13, 2015 at 02:03:02 PM, Chin Liang See
> > > >
> > > > wrote:
> > > > > On Sun, 2015-12-13 at 04:14 +0100, Marek Vasut wrote:
> > > > > > On Sunday, December 13, 2015 at 01:49:06 AM, Chin Liang See
> > > > > >
> > > > > > wrote:
> > > > > > > On Sun, 2015-12-13 at 01:01 +0100, Marek Vasut wrote:
> > > > > > > > On Sunday, December 13, 2015 at 12:59:48 AM, Chin Liang
> > > > > > > > See
> > > > > > > >
> > > > > > > > wrote:
> > > > > > > > > On Sat, 2015-12-12 at 16:36 +0100, Marek Vasut wrote:
> > > > > > > > > > On Saturday, December 12, 2015 at 07:30:46 AM, Chin
> > > > > > > > > > Liang
> > > > > > > > > > See
> > > > > > > > >
> > > > > > > > > > wrote:
> > > > > > > > > [...]
> > > > > > > > >
> > > > > > > > > > > > Can you share the final layout before you roll
> > > > > > > > > > > > out
> > > > > > > > > > > > patches ?
> > > > > > > > > > >
> > > > > > > > > > > Sure, plan to do so but need to away from desk just
> > > > > > > > > > > now.
> > > > > > > > > > >
> > > > > > > > > > > Here is the old layout
> > > > > > > > > > > 256k(spl)
> > > > > > > > > > > 64k(env)
> > > > > > > > > > > 64k(dtb)
> > > > > > > > > > > 256k(boot)
> > > > > > > > > > > 16m(kernel)
> > > > > > > > > > > 16m(rootfs)
> > > > > > > > > > >
> > > > > > > > > > > The new one would like this
> > > > > > > > > > > 256k(spl)
> > > > > > > > > >
> > > > > > > > > > I'd say you should just call this u-boot, see above
> > > > > > > > > > for
> > > > > > > > > > the
> > > > > > > > > > rationale.
> > > > > > > > > >
> > > > > > > > > > > 256k(env)
> > > > > > > > > > > 15872k(boot)
> > > > > > > > > > > 16m(rootfs)
> > > > > > > > > > >
> > > > > > > > > > > The boot partition can be used as ubi part or raw
> > > > > > > > > > > partition.
> > > > > > > > > > > It contains the linux dtb, u-boot and linux images.
> > > > > > > > > >
> > > > > > > > > > Is that an UBIFS partition ? If so, why don't you
> > > > > > > > > > just
> > > > > > > > > > use
> > > > > > > > > > two
> > > > > > > > > > UBI
> > > > > > > > > > volumes ?
> > > > > > > > >
> > > > > > > > > For backward compatibility, it can be raw if user want
> > > > > > > > > to
> > > > > > > > > stick
> > > > > > > > > with
> > > > > > > > > old way.
> > > > > > > >
> > > > > > > > If you're breaking the partitioning layout anyway, you
> > > > > > > > don't
> > > > > > > > have
> > > > > > > > to
> > > > > > > > care about the "old way", right ?
> > > > > > >
> > > > > > > Actually this partition can be used as raw partition if
> > > > > > > user
> > > > > > > don't
> > > > > > > want
> > > > > > > to store zimage and dtb as raw binary.
> > > > > >
> > > > > > You should never store raw zImage/dtb in a flash on a
> > > > > > production
> > > > > > system.
> > > > > > This is real bad and can result in a corruption in the future
> > > > > > when
> > > > > > the
> > > > > > system is in the field for a long time. I'd suggest to just
> > > > > > use
> > > > > > two
> > > > > > UBI
> > > > > > volumes, one for fitImage and the other for rootfs.
> > > > >
> > > > > Yup, we are trying to move the raw away by having UBI enabled.
> > > > > I
> > > > > presume when you refer 2 UBI volumes, I presume its still
> > > > > single
> > > > > UBI
> > > > > partition?
> > > >
> > > > Yeah, one UBI partition with two UBI volumes -- boot and root.
> > >
> > > Ok I grasp you correctly. In this case, I would suggest to opt for
> > > 2
> > > partitions instead of 2 volumes. User can just use sf erase rootfs
> > > instead of checking for volume offset. I suspect the ubi part will
> > > take
> > > longer time if we are having one partition only. I shall send out
> > > the
> > > new revision if this works for you :)
> >
> > Oh, I see what you're concerned about. On the other hand, you are not
> > supposed
> > to erase UBI partition, since that'd nuke the UBI erase counters and
> > UBI would
> > loose track of how many times each block was erased, which helps with
> > wear
> > leveling.
> >
> > If you're adamant about two UBI partitions , you can try the trick
> > where you can
> > create overlapping mtd partitions, that way you'd have both options
> > available.
> > (it is actually a legal construction, you can check the kernel MTD
> > docs).
>
> After grabbing a coffee

That's a good idea, though I think I will make do with a green tea (??).

> and rethinking, we can have 2 MTD_PARTITION
> where one for backward compatiblity (supporting raw) while another for
> UBI.
>
> MTDPARTS_RAW
> 256k(spl),
> 256k(env),
> 15872k(boot),
> -(rootfs)
>
> MTDPARTS_UBI
> 256k(spl),
> 256k(env),
> -(UBI)
>
> We should make UBI as default then. If user care about backward
> compatiblity, they shall use the MTDPARTS_RAW then.

Try this:

mtdparts=1m(u-boot),256k(env1),256k(env2),14848k(boot),112m(root),- at 1536k(UBI)

This will create overlapping partitions "boot,root" and "UBI" .