[U-Boot] [PATCH 5/6] cmd: mtdparts: support runtime generated mtdparts

Michal Suchanek hramrach at gmail.com
Tue Jun 7 09:43:20 CEST 2016


On 6 June 2016 at 23:21, Ladislav Michl <ladis at linux-mips.org> wrote:
> On Mon, Jun 06, 2016 at 08:50:55PM +0200, Michal Suchanek wrote:
>> On 6 June 2016 at 09:48, Ladislav Michl <ladis at linux-mips.org> wrote:
> [snip]
>> > Okay, specifing size in therms of eraseblock would solve my problem
>> > and I have to admit I'm not aware such a thing exists. Any pointer to
>> > the patch introducing that change?
>> >
>>
>> I am not aware of any. it's on the list of nice to have things I will
>> probably not get to,
>>
>> Anyway, It's imho the place to put this code so that Linux does not
>> depend on u-boot for pre-chewing it's partition table to get the
>> partitions right.
>
> Linux already depends on U-Boot as U-Boot feeds Linux with MTD partitions.

No. It depends on getting the partition layout on commandline or in
DT. This can be something U-Boot generates, or something it passes on
from its environment or something it does not touch at all.

> So this patch does not introduce any change in this regard. And whenever
> are paritions altered by user, saved to U-Boot environment or default
> layout provided according actual eraseblock size is just not important
> here. In the end both U-Boot and Linux are working with the same partition
> layout. This is the only thing that matters and this patch does not change

But for the layout to be correct you must build current u-boot with
this patch and not use compiled-in command line, devicetree, older
u-boot or different bootloader.

> that. It changes only this: instead of hardcoding default layout into string
> provided at compile time, there is now posibility to create that string
> runtime. That's all.

The only problem with that is that the code for generating the string
is in u-boot and the string is needed in Linux so the logical thing is
to move the code to Linux where it is needed.

>
> And now... Your recomended solution is to change both U-Boot and Linux
> to understand partition layout based on indexes and sizes expressed
> in eraseblocks. While size of SPL could be nicely evaluated in terms
> of eraseblocks, it is a bit more complicated with kernel partition,
> because 10 eraseblocks says nothing about partition size, therefore
> you cannot say whenever kernel will fit that space without knowledge
> of eraseblock size.

That's why you need the possibility to start a partition at the end of
preceding partition. That way you can have sizes of different
partitions in different units.

It's interesting that your firmware uses erase block size for the boot
partition. The sunxi firmware loads the bootloader from fixed number
of pages.

> So you just reverted the problem and both U-Boot
> and Linux would end with more code to be maintained for compatibility.

Yes, if you want U-Boot and Linux to talk the same units you need both
implementing the code to handle them. Still U-Boot will only need to
pass around a string with partition layout and parse it in the cases
it is accessing the partitions.

Thanks

Michal


More information about the U-Boot mailing list