[U-Boot] [PATCH] env: Add CONFIG_ENV_SUPPORT

Patrick DELAUNAY
2019-09-11T13:54:16Z

Hi Wolfgang an Tom,

>
> Dear Patrick,
>
> In message <9c7801afb8c94c638933cf33746ae300@SFHDAG6NODE3.st.com>
> you wrote:
> >
> > And I agree the name seens not perfect.
> >
> > > > - CONFIG_SPL_ENV_SUPPORT for SPL
> > > > - CONFIG_TPL_ENV_SUPPORT for TPL
> >
> > These pre-existing name are defined in common/spl/Kconfig
> >
> > With the same issue (env/common.o env/env.o are always compiled for
> > SPL/TPL so it is alo bad names)
>
> Correct.
>
> > > So please reconsider this whole implementation, and make sure that
> > > only a single macro ise used everywhere to enable these features.
> >
> > But, if I use the same CONFIG for the 3 binary SPL,TPL and U-Boot, l
> > increase the size of TPL/SPL for all the platforms when these
> > additional features are not needed.
>
> Either the U-Boot environment makes use of these features, then they have to be
> enabled, and exactly the same way in SPL, TPL and U-Boot proper. Or you don't
> need them, then they can be disabled, but again in a consistent way in SPL, TPL,
> and U-Boot proper.
>
> It is not acceptable to have for example .flags support in U-Boot, but not is SPL.
> If you cannot affort the size in SPL (and need environment there at all), then you
> cannot have it in U-Boot either.
> Yes, this is sad, but anything else would break the implementation of these
> features, and given that they are often used to implement some level of protection
> or security, introduce massive security issues.
>
>
> So if SPL size is critical, you can try do not access the environment at all and omit
> _all_ of the environment code there; or you can try to arrange for a read-only
> implementation (omitting at least the code needed for "env save" including write
> routines to storage). But you CANNOT omit the extensions if these are present in
> U-Boot proper.

I am working on a update of the first proposal and I will delivered it in 2 step:

1- a simple patch to solve the regression
(to have short term solution / integration in master as requested by Tom)

2- introduction of CONFGI_ENV_FULL_SUPPORT
=> compilation of attr / flags / callback for TPL/SPL/U-boot
=> feature can't be remove in SPL/TPL independently
As proposed by Wolfgang

> Best regards,
>
> Wolfgang Denk
>

Regards

Patrick