env: Allow U-Boot scripts to be placed in a .env file

Wojciech Niziński niziak at spox.org
Tue Oct 17 10:14:13 CEST 2023


Hello.

Very nice feature was introduced in commit:

     86b9c3e4e48ba47ef28781d06b97846aca74bc8e|
     env: Allow U-Boot scripts to be placed in a .env file

This feature works as extension for old CFG_EXTRA_ENV_SETTINGS and make 
me confused why it doesn't work for configured default env file.

Now in U-Boot config we have two features related to external 
environment file:

1st feature (introduced by mentioned commit):

     CONFIG_ENV_SOURCE_FILE "Environment file to use"

2nd feature

     CONFIG_USE_DEFAULT_ENV_FILE "Create default environment from file"

     CONFIG_DEFAULT_ENV_FILE "Path to default environment file"

In 1st feature only basename of .env file can be specified. So env file 
can be located only in board dir which is a limitation for this nice 
feature:

     "The file must be in the board directory and have a .env extension, so
     the resulting filename is typically
board/<vendor>/<board>/<CONFIG_ENV_SOURCE_FILE>.env"

In 2nd feature I can specify default env file as full path so it can be 
located everywhere - even outside U-Boot source - which is very nice 
when U-Boot is built by Buildroot. I can easily set path as system 
environment variable and it works:

     CONFIG_USE_DEFAULT_ENV_FILE=y
CONFIG_DEFAULT_ENV_FILE="$(BR2_EXTERNAL_FOO_PATH)/board/foo/u-boot.env"

Unfortunately I cannot do the same for 1st feature without patching 
U-Boot sources to put my custom env file into board dir.

I can see two way of improving features:
  1st: to extend 1st feature with ability to specify full patch to env 
file, or
  2nd one: run the same parsing mechanism also for 2nd feature (default 
env file).

BR,

Wojcech



More information about the U-Boot mailing list