[U-Boot] [PATCH v1] env_mmc: configure environment offsets via device tree

Igor Grinberg grinberg at compulab.co.il
Mon Feb 20 07:22:45 UTC 2017


Hi Philipp,

On 02/19/17 19:59, Dr. Philipp Tomsich wrote:
> Igor,
> 
>> On 19 Feb 2017, at 12:52, Igor Grinberg <grinberg at compulab.co.il> wrote:
>>
>> On 02/17/17 19:28, Philipp Tomsich wrote:
>>> This introduces the ability to override the environment offets from the
>>> device tree by setting the following nodes in '/config':
>>> 	'u-boot,mmc-env-offset' - overrides CONFIG_ENV_OFFSET
>>> 	'u-boot,mmc-env-offset-redundant'
>>> 				- overrides CONFIG_ENV_OFFSET_REDUND
>>>
>>> To keep with the previous logic, the CONFIG_* defines still need to
>>> be available and the statically defined values become the defaults,
>>> when the corresponding properties are not set in the device-tree.
>>
>> That sounds too odd...
>> DT's purpose is to describe the h/w... and that does not look so...
>> We also, have a dt file name in the environment, so this creates will create
>> a chicken and an egg problem…
> 
> I don’t really follow… as far as I knew the DT name would have to come
> from some other source anyway, as the device containing the env might
> only be described through the device tree (e.g. mmc0).

Why? U-Boot can live pretty well w/o DT.

> 
> U-Boot usually locates the FDT to use at a preconfigured address (or one
> configured in the early environment).

Or just by providing the address to bootz command...

> This will not be the environment we’d
> load from a MMC device configured via DM_MMC.
> 
> So there shouldn’t be a chicken & egg here.
> 
>> I really don't think we should go that direction. DT is not meant to provide
>> a solution to all your problems...
> 
> I don’t see how this is different from other entries in chosen and config as
> of today:
> 	common/autoboot.c allows an override through /config/bootdelay
> 	common/board_r.c uses /config/load-environment
> 	common/cli.c can pull in /config/bootcmd
> 	drivers/serial/serial-uclass.c uses /chosen/stdout-path
> 
> In fact, it is the absence of this mechanism that is causing problems today:
> CONFIG_ENV_OFFSET is not configurable through Kconfig, so we would
> need board-specific defines (e.g. CONFIG_SUNXI_BOARD_LYNX) and
> matching #ifdef primitives in a shared header (sunxi-common.h in our case).

Right. Exactly, I think we should move the CONFIG_ENV_OFFSET to Kconfig.
And that will solve the problem.

> 
> So putting this in the DT is the best (and least intrusive) option available.

Ok. I see your point now. Yet I think we should keep the DT to its purpose - which
is to describe the h/w (and not the s/w placement layout).


-- 
Regards,
Igor.


More information about the U-Boot mailing list