All of lore.kernel.org
 help / color / mirror / Atom feed
* default environment append from kconfig
@ 2022-08-09 10:47 Francesco Dolcini
  2022-08-09 11:02 ` Rasmus Villemoes
  2022-08-10 14:34 ` Tom Rini
  0 siblings, 2 replies; 8+ messages in thread
From: Francesco Dolcini @ 2022-08-09 10:47 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass

Hello all,
is there any kconfig mechanism in u-boot to append environment variable to the
default one?

I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely
replace it, looking into the code I was not able to find anything, but I
wonder if something from this
https://lore.kernel.org/all/20211022030852.1986718-1-sjg@chromium.org/
can be used.

Francesco


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-09 10:47 default environment append from kconfig Francesco Dolcini
@ 2022-08-09 11:02 ` Rasmus Villemoes
  2022-08-10  9:58   ` Francesco Dolcini
  2022-08-10 14:36   ` Tom Rini
  2022-08-10 14:34 ` Tom Rini
  1 sibling, 2 replies; 8+ messages in thread
From: Rasmus Villemoes @ 2022-08-09 11:02 UTC (permalink / raw)
  To: Francesco Dolcini, u-boot; +Cc: Simon Glass

On 09/08/2022 12.47, Francesco Dolcini wrote:
> Hello all,
> is there any kconfig mechanism in u-boot to append environment variable to the
> default one?
> 

Well, despite the name, CONFIG_EXTRA_ENV_SETTINGS is not settable via
kconfig, but only from board header file. And while it works, it's
rather cumbersome to maintain that macro expanding to a string with all
the embedded \0 and the required \ continuations etc.

> I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely
> replace it, looking into the code I was not able to find anything, 

You could select CONFIG_ENV_IMPORT_FDT, then populate the
/config/environment/ devicetree node with the key/value pairs you want.

This can for example be done via the <board>-u-boot.dtsi file, or if
you're using an in-tree board with in-tree .dts, and just want to
maintain your own .config and environment out of tree, you could
additionally set CONFIG_DEVICE_TREE_INCLUDES to point at a .dtsi which
just has that

/ {
  config {
    environment {
      foo = "bar";
    };
  };
};

(that was exactly a use case I had in mind for
CONFIG_DEVICE_TREE_INCLUDES, as can be seen in the commit log for
a77f468099).

Rasmus

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-09 11:02 ` Rasmus Villemoes
@ 2022-08-10  9:58   ` Francesco Dolcini
  2022-08-10 14:36   ` Tom Rini
  1 sibling, 0 replies; 8+ messages in thread
From: Francesco Dolcini @ 2022-08-10  9:58 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Francesco Dolcini, u-boot, Simon Glass

On Tue, Aug 09, 2022 at 01:02:24PM +0200, Rasmus Villemoes wrote:
> On 09/08/2022 12.47, Francesco Dolcini wrote:
> > I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely
> > replace it, looking into the code I was not able to find anything, 
> 
> You could select CONFIG_ENV_IMPORT_FDT, then populate the
> /config/environment/ devicetree node with the key/value pairs you want.
> 
> This can for example be done via the <board>-u-boot.dtsi file, or if
> you're using an in-tree board with in-tree .dts, and just want to
> maintain your own .config and environment out of tree, you could
> additionally set CONFIG_DEVICE_TREE_INCLUDES to point at a .dtsi which
> just has that
> 
> / {
>   config {
>     environment {
>       foo = "bar";
>     };
>   };
> };
> 
> (that was exactly a use case I had in mind for
> CONFIG_DEVICE_TREE_INCLUDES, as can be seen in the commit log for
> a77f468099).

Thanks Rasmus, it looks pretty helpful, I'll give it a try.

Francesco



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-09 10:47 default environment append from kconfig Francesco Dolcini
  2022-08-09 11:02 ` Rasmus Villemoes
@ 2022-08-10 14:34 ` Tom Rini
  2022-08-10 15:09   ` Francesco Dolcini
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Rini @ 2022-08-10 14:34 UTC (permalink / raw)
  To: Francesco Dolcini; +Cc: u-boot, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

On Tue, Aug 09, 2022 at 12:47:39PM +0200, Francesco Dolcini wrote:
> Hello all,
> is there any kconfig mechanism in u-boot to append environment variable to the
> default one?
> 
> I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely
> replace it, looking into the code I was not able to find anything, but I
> wonder if something from this
> https://lore.kernel.org/all/20211022030852.1986718-1-sjg@chromium.org/
> can be used.

Yes, you can use the series above, which has been merged for some time,
to append to the environment via board/../<board>/<board>.env and you
can look at the existing .env files for examples of how it works.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-09 11:02 ` Rasmus Villemoes
  2022-08-10  9:58   ` Francesco Dolcini
@ 2022-08-10 14:36   ` Tom Rini
  2022-08-10 18:05     ` Simon Glass
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Rini @ 2022-08-10 14:36 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Francesco Dolcini, u-boot, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

On Tue, Aug 09, 2022 at 01:02:24PM +0200, Rasmus Villemoes wrote:
> On 09/08/2022 12.47, Francesco Dolcini wrote:
> > Hello all,
> > is there any kconfig mechanism in u-boot to append environment variable to the
> > default one?
> > 
> 
> Well, despite the name, CONFIG_EXTRA_ENV_SETTINGS is not settable via
> kconfig, but only from board header file. And while it works, it's
> rather cumbersome to maintain that macro expanding to a string with all
> the embedded \0 and the required \ continuations etc.

I just want to chime in here to note that the biggest blocker to
removing CONFIG_EXTRA_ENV_SETTINGS and migrating it to board.env files
is how to handle, exactly, distroboot support.  Aside from that,
whatever is done in CONFIG_EXTRA_ENV_SETTINGS can be done in the .env
file (unless there's some other fancy macro work being done that I've
missed).

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-10 14:34 ` Tom Rini
@ 2022-08-10 15:09   ` Francesco Dolcini
  2022-08-10 17:04     ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Francesco Dolcini @ 2022-08-10 15:09 UTC (permalink / raw)
  To: Tom Rini; +Cc: Francesco Dolcini, u-boot, Simon Glass

On Wed, Aug 10, 2022 at 10:34:26AM -0400, Tom Rini wrote:
> On Tue, Aug 09, 2022 at 12:47:39PM +0200, Francesco Dolcini wrote:
> > Hello all,
> > is there any kconfig mechanism in u-boot to append environment variable to the
> > default one?
> > 
> > I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely
> > replace it, looking into the code I was not able to find anything, but I
> > wonder if something from this
> > https://lore.kernel.org/all/20211022030852.1986718-1-sjg@chromium.org/
> > can be used.
> 
> Yes, you can use the series above, which has been merged for some time,
> to append to the environment via board/../<board>/<board>.env and you
> can look at the existing .env files for examples of how it works.
Am I wrong or this just override the whole environment? My need here is
to just add|override some env variables to the default env to an in-tree
u-boot board from an out-of-tree configuration.

Think about a specific network or boot configuration, for example.

Francesco


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-10 15:09   ` Francesco Dolcini
@ 2022-08-10 17:04     ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2022-08-10 17:04 UTC (permalink / raw)
  To: Francesco Dolcini; +Cc: u-boot, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]

On Wed, Aug 10, 2022 at 05:09:45PM +0200, Francesco Dolcini wrote:
> On Wed, Aug 10, 2022 at 10:34:26AM -0400, Tom Rini wrote:
> > On Tue, Aug 09, 2022 at 12:47:39PM +0200, Francesco Dolcini wrote:
> > > Hello all,
> > > is there any kconfig mechanism in u-boot to append environment variable to the
> > > default one?
> > > 
> > > I am aware of CONFIG_USE_DEFAULT_ENV_FILE, but this will completely
> > > replace it, looking into the code I was not able to find anything, but I
> > > wonder if something from this
> > > https://lore.kernel.org/all/20211022030852.1986718-1-sjg@chromium.org/
> > > can be used.
> > 
> > Yes, you can use the series above, which has been merged for some time,
> > to append to the environment via board/../<board>/<board>.env and you
> > can look at the existing .env files for examples of how it works.
> Am I wrong or this just override the whole environment? My need here is
> to just add|override some env variables to the default env to an in-tree
> u-boot board from an out-of-tree configuration.
> 
> Think about a specific network or boot configuration, for example.

It doesn't override the whole environment. As of the link you posted, it
did override all of (or rather, conflicted with)
CONFIG_EXTRA_ENV_SETTINGS, but I changed that more recently as it was
hindering adoption of the feature overall.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: default environment append from kconfig
  2022-08-10 14:36   ` Tom Rini
@ 2022-08-10 18:05     ` Simon Glass
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Glass @ 2022-08-10 18:05 UTC (permalink / raw)
  To: Tom Rini; +Cc: Rasmus Villemoes, Francesco Dolcini, U-Boot Mailing List

Hi Tom,

On Wed, 10 Aug 2022 at 08:36, Tom Rini <trini@konsulko.com> wrote:
>
> On Tue, Aug 09, 2022 at 01:02:24PM +0200, Rasmus Villemoes wrote:
> > On 09/08/2022 12.47, Francesco Dolcini wrote:
> > > Hello all,
> > > is there any kconfig mechanism in u-boot to append environment variable to the
> > > default one?
> > >
> >
> > Well, despite the name, CONFIG_EXTRA_ENV_SETTINGS is not settable via
> > kconfig, but only from board header file. And while it works, it's
> > rather cumbersome to maintain that macro expanding to a string with all
> > the embedded \0 and the required \ continuations etc.
>
> I just want to chime in here to note that the biggest blocker to
> removing CONFIG_EXTRA_ENV_SETTINGS and migrating it to board.env files
> is how to handle, exactly, distroboot support.  Aside from that,

I will get back to that before long.

> whatever is done in CONFIG_EXTRA_ENV_SETTINGS can be done in the .env
> file (unless there's some other fancy macro work being done that I've
> missed).
>
> --
> Tom

Regards,
SImon

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-10 18:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-09 10:47 default environment append from kconfig Francesco Dolcini
2022-08-09 11:02 ` Rasmus Villemoes
2022-08-10  9:58   ` Francesco Dolcini
2022-08-10 14:36   ` Tom Rini
2022-08-10 18:05     ` Simon Glass
2022-08-10 14:34 ` Tom Rini
2022-08-10 15:09   ` Francesco Dolcini
2022-08-10 17:04     ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.