how does barebox deal with more than one environment?

Antony Pavlov antonynpavlov at
Sat Dec 1 08:46:45 EST 2012

On 1 December 2012 17:19, Robert P. J. Day <rpjday at> wrote:
> On Sat, 1 Dec 2012, Robert P. J. Day wrote:
>>   writing up a simple barebox exercise for students and on this page:
>> it seems clear(?) that you can define multiple environments that will
>> appear at /dev/env0, /dev/env1, etc, but that page also claims that
>> *only* the configuration on /dev/env0 will be executed automatically
>> if barebox finds that it's a valid configuration sector.
>>   so what happens with the additional environments?  that page doesn't
>> make it clear.  i'm just about to read the source to see if i can
>> figure this out.
>   oh, wait, i think i see ... the "loadenv" command will load a given
> environment into a directory so i'm *assuming* that additional
> environments are simply available to be loaded, but /dev/env0 is the
> only one treated special.  or feel free to correct me if i'm
> hopelessly wrong.

See common/startup.c:110

        if (envfs_load(default_environment_path, "/env")) {
                printf("no valid environment found on %s. "
                        "Using default environment\n",
                envfs_load("/dev/defaultenv", "/env");

By default  default_environment_path="/dev/env0", but it can be
overwritten in a board code (e.g. see arch/arm/boards/panda/board.c).

Best regards,
  Antony Pavlov

More information about the barebox mailing list