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

Dr. Philipp Tomsich philipp.tomsich at theobroma-systems.com
Sun Feb 19 17:59:50 UTC 2017


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).

U-Boot usually locates the FDT to use at a preconfigured address (or one
configured in the early environment). 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).

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

Regards,
Philipp.


More information about the U-Boot mailing list