mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* need some clarification on how environments work
@ 2012-02-08  0:11 Robert P. J. Day
  2012-02-08  8:19 ` Premi, Sanjeev
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2012-02-08  0:11 UTC (permalink / raw)
  To: U-Boot Version 2 (barebox)


  ok, i'm trying to figure out how environments work so bear with me
as i'm going to ask a number of questions.  i'm reading this page:

http://wiki.barebox.org/doku.php?id=user:environment

and based on that, i took a look at what i have running on my beagle
xM having configured and built *entirely* using defaults.
confusingly, i have no /dev/env0 as that web page seems to suggest.
here's what's in my dev directory:

barebox@Texas Instrument's Beagle:/ ls -l dev
cr-------- 4294967295 zero
crw-------  134217728 ram0
crw-------       7496 defaultenv
crw------- 4294967295 mem
crw-------       1024 twl4030
crw------- 3963617280 disk0
crw-------  123346944 disk0.0

  so i have a "defaultenv" file there.  i puzzled over this for a
while until i noticed that there is no arch/arm/boards/beagle/env/
directory, as there is for most of the other boards.

  so let's step back and look at the relevant source in
common/Makefile:

=====

ifdef CONFIG_DEFAULT_ENVIRONMENT
$(obj)/startup.o: include/generated/barebox_default_env.h
$(obj)/env.o: include/generated/barebox_default_env.h

ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
DEFAULT_ENVIRONMENT_PATH = "defaultenv"
endif

ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
endif

ENV_FILES := $(shell cd $(srctree); for i in
$(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f
'{}' \;; done)

endif # ifdef CONFIG_DEFAULT_ENVIRONMENT

barebox_default_env: $(ENV_FILES)
        $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree)
$(DEFAULT_ENVIRONMENT_PATH)

=====

   as well as the menu selections from "make menuconfig":

      [*] Compile in default environment
      [*]   Default environment generic
      ()    Default environment path

so now, the questions.

  first, what is the "default" environment?  is that the one found
for the board in arch/arm/boards/<board>/env/config?  so that there is
*no* current default environment for the beagleboard right now?

  also, from the Kconfig help text:

CONFIG_DEFAULT_ENVIRONMENT:

Enabling this option will give you a default environment when
the environment found in the environment sector is invalid

  is that true?  as in, the "default" environment will only be used if
what's in the environment sector is found to be invalid?

  next, what is meant by the "generic" default environment?  from the
Kconfig file,

"With this option barebox will use the generic default
environment found under defaultenv/ in the src tree.
The Directory given with DEFAULT_ENVIRONMENT_PATH
will be added to the default environment. This should
at least contain a /env/config file.
This will be able to overwrite the files from defaultenv."

  ok, i can appreciate that -- it's a "generic" environment, defined
by the file defaultenv/config, and it's apparently what i got, is that
it?  but why the reference to DEFAULT_ENVIRONMENT_PATH, which is an
entirely separate Kconfig option?

  and regarding the final setting, CONFIG_DEFAULT_ENVIRONMENT_PATH,
how does that affect the first two settings?  i'm just trying to
puzzle all this out.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* RE: need some clarification on how environments work
  2012-02-08  0:11 need some clarification on how environments work Robert P. J. Day
@ 2012-02-08  8:19 ` Premi, Sanjeev
  2012-02-08  8:54   ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Premi, Sanjeev @ 2012-02-08  8:19 UTC (permalink / raw)
  To: Robert P. J. Day, U-Boot Version 2 (barebox)

----Original Message-----
> From: barebox-bounces@lists.infradead.org 
> [mailto:barebox-bounces@lists.infradead.org] On Behalf Of 
> Robert P. J. Day
> Sent: Wednesday, February 08, 2012 5:42 AM
> To: U-Boot Version 2 (barebox)
> Subject: need some clarification on how environments work
> 
> 
>   ok, i'm trying to figure out how environments work so bear with me
> as i'm going to ask a number of questions.  i'm reading this page:
> 
> http://wiki.barebox.org/doku.php?id=user:environment
> 
> and based on that, i took a look at what i have running on my beagle
> xM having configured and built *entirely* using defaults.
> confusingly, i have no /dev/env0 as that web page seems to suggest.
> here's what's in my dev directory:
> 
> barebox@Texas Instrument's Beagle:/ ls -l dev
> cr-------- 4294967295 zero
> crw-------  134217728 ram0
> crw-------       7496 defaultenv
> crw------- 4294967295 mem
> crw-------       1024 twl4030
> crw------- 3963617280 disk0
> crw-------  123346944 disk0.0
> 
>   so i have a "defaultenv" file there.  i puzzled over this for a
> while until i noticed that there is no arch/arm/boards/beagle/env/
> directory, as there is for most of the other boards.
> 
>   so let's step back and look at the relevant source in
> common/Makefile:
> 
> =====
> 
> ifdef CONFIG_DEFAULT_ENVIRONMENT
> $(obj)/startup.o: include/generated/barebox_default_env.h
> $(obj)/env.o: include/generated/barebox_default_env.h
> 
> ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> DEFAULT_ENVIRONMENT_PATH = "defaultenv"
> endif
> 
> ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
> DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> endif
> 
> ENV_FILES := $(shell cd $(srctree); for i in
> $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f
> '{}' \;; done)
> 
> endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
> 
> barebox_default_env: $(ENV_FILES)
>         $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree)
> $(DEFAULT_ENVIRONMENT_PATH)
> 
> =====
> 
>    as well as the menu selections from "make menuconfig":
> 
>       [*] Compile in default environment
>       [*]   Default environment generic
>       ()    Default environment path
> 
> so now, the questions.
> 
>   first, what is the "default" environment?  is that the one found
> for the board in arch/arm/boards/<board>/env/config?  so that there is
> *no* current default environment for the beagleboard right now?
> 
>   also, from the Kconfig help text:
> 
> CONFIG_DEFAULT_ENVIRONMENT:
> 
> Enabling this option will give you a default environment when
> the environment found in the environment sector is invalid
> 
>   is that true?  as in, the "default" environment will only be used if
> what's in the environment sector is found to be invalid?
> 
>   next, what is meant by the "generic" default environment?  from the
> Kconfig file,
> 
> "With this option barebox will use the generic default
> environment found under defaultenv/ in the src tree.
> The Directory given with DEFAULT_ENVIRONMENT_PATH
> will be added to the default environment. This should
> at least contain a /env/config file.
> This will be able to overwrite the files from defaultenv."
> 
>   ok, i can appreciate that -- it's a "generic" environment, defined
> by the file defaultenv/config, and it's apparently what i got, is that
> it?  but why the reference to DEFAULT_ENVIRONMENT_PATH, which is an
> entirely separate Kconfig option?
> 
>   and regarding the final setting, CONFIG_DEFAULT_ENVIRONMENT_PATH,
> how does that affect the first two settings?  i'm just trying to
> puzzle all this out.

I have recently finished creating the default env for omap3evm; so
will be able to share my uderstanding. Hope to send the patches by
end of the day (atleast an RFC, if I am unable to boot linux) OR
may be earlier.

CONFIG_DEFAULT_ENVIRONMENT appears to control whether "any" default
env should be included in the barebox. Haven't tried env from NAND
device (hopefully mounting as /dev/env0) so far, but I assume from
boot sequence that I observe that env from NAND will be used and
there is no fallback.

CONFIG_DEFAULT_ENVIRONMENT_GENERIC leads to inclusion of a generic
"template" env into barebox - not really useful, but atleast you
have a template to work with and al the FIXMEs included there will
get you started.

If CONFIG_DEFAULT_ENVIRONMENT_PATH is used the "specific" path
you have specified, will now be used for the default env. And it
overrides the "generic" env path. So now you have a board specific
env.

In a boot log I sent yesterday, you will notice this:

Open /dev/env0 No such file or directory
no valid environment found on /dev/env0. Using default environment
running /env/bin/init...

(http://lists.infradead.org/pipermail/barebox/2012-February/005987.html)

I did plan to look at the origin of message "no valid environment found
on /dev/env0", but Linux not booting took the focus elsewhere.

~sanjeev
> 
> rday
> 
> -- 
> 
> ==============================================================
> ==========
> Robert P. J. Day                                 Ottawa, 
> Ontario, CANADA
>                         http://crashcourse.ca
> 
> Twitter:                                       
> http://twitter.com/rpjday
> LinkedIn:                               
> http://ca.linkedin.com/in/rpjday
> ==============================================================
> ==========
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: need some clarification on how environments work
  2012-02-08  8:19 ` Premi, Sanjeev
@ 2012-02-08  8:54   ` Sascha Hauer
  2012-02-08 11:01     ` Robert P. J. Day
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-02-08  8:54 UTC (permalink / raw)
  To: Premi, Sanjeev; +Cc: U-Boot Version 2 (barebox)

On Wed, Feb 08, 2012 at 08:19:18AM +0000, Premi, Sanjeev wrote:
> ----Original Message-----
> > From: barebox-bounces@lists.infradead.org 
> > [mailto:barebox-bounces@lists.infradead.org] On Behalf Of 
> > Robert P. J. Day
> > Sent: Wednesday, February 08, 2012 5:42 AM
> > To: U-Boot Version 2 (barebox)
> > Subject: need some clarification on how environments work
> > 
> > 
> >   ok, i'm trying to figure out how environments work so bear with me
> > as i'm going to ask a number of questions.  i'm reading this page:
> > 
> > http://wiki.barebox.org/doku.php?id=user:environment
> > 
> > and based on that, i took a look at what i have running on my beagle
> > xM having configured and built *entirely* using defaults.
> > confusingly, i have no /dev/env0 as that web page seems to suggest.
> > here's what's in my dev directory:
> > 
> > barebox@Texas Instrument's Beagle:/ ls -l dev
> > cr-------- 4294967295 zero
> > crw-------  134217728 ram0
> > crw-------       7496 defaultenv
> > crw------- 4294967295 mem
> > crw-------       1024 twl4030
> > crw------- 3963617280 disk0
> > crw-------  123346944 disk0.0
> > 
> >   so i have a "defaultenv" file there.  i puzzled over this for a
> > while until i noticed that there is no arch/arm/boards/beagle/env/
> > directory, as there is for most of the other boards.
> > 
> >   so let's step back and look at the relevant source in
> > common/Makefile:
> > 
> > =====
> > 
> > ifdef CONFIG_DEFAULT_ENVIRONMENT
> > $(obj)/startup.o: include/generated/barebox_default_env.h
> > $(obj)/env.o: include/generated/barebox_default_env.h
> > 
> > ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> > DEFAULT_ENVIRONMENT_PATH = "defaultenv"
> > endif
> > 
> > ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
> > DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
> > endif
> > 
> > ENV_FILES := $(shell cd $(srctree); for i in
> > $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f
> > '{}' \;; done)
> > 
> > endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
> > 
> > barebox_default_env: $(ENV_FILES)
> >         $(Q)$(srctree)/scripts/genenv $(srctree) $(objtree)
> > $(DEFAULT_ENVIRONMENT_PATH)
> > 
> > =====
> > 
> >    as well as the menu selections from "make menuconfig":
> > 
> >       [*] Compile in default environment
> >       [*]   Default environment generic
> >       ()    Default environment path
> > 
> > so now, the questions.
> > 
> >   first, what is the "default" environment?  is that the one found
> > for the board in arch/arm/boards/<board>/env/config?  so that there is
> > *no* current default environment for the beagleboard right now?
> > 
> >   also, from the Kconfig help text:
> > 
> > CONFIG_DEFAULT_ENVIRONMENT:
> > 
> > Enabling this option will give you a default environment when
> > the environment found in the environment sector is invalid
> > 
> >   is that true?  as in, the "default" environment will only be used if
> > what's in the environment sector is found to be invalid?
> > 
> >   next, what is meant by the "generic" default environment?  from the
> > Kconfig file,
> > 
> > "With this option barebox will use the generic default
> > environment found under defaultenv/ in the src tree.
> > The Directory given with DEFAULT_ENVIRONMENT_PATH
> > will be added to the default environment. This should
> > at least contain a /env/config file.
> > This will be able to overwrite the files from defaultenv."
> > 
> >   ok, i can appreciate that -- it's a "generic" environment, defined
> > by the file defaultenv/config, and it's apparently what i got, is that
> > it?  but why the reference to DEFAULT_ENVIRONMENT_PATH, which is an
> > entirely separate Kconfig option?
> > 
> >   and regarding the final setting, CONFIG_DEFAULT_ENVIRONMENT_PATH,
> > how does that affect the first two settings?  i'm just trying to
> > puzzle all this out.
> 
> I have recently finished creating the default env for omap3evm; so
> will be able to share my uderstanding. Hope to send the patches by
> end of the day (atleast an RFC, if I am unable to boot linux) OR
> may be earlier.
> 
> CONFIG_DEFAULT_ENVIRONMENT appears to control whether "any" default
> env should be included in the barebox. Haven't tried env from NAND
> device (hopefully mounting as /dev/env0) so far, but I assume from
> boot sequence that I observe that env from NAND will be used and
> there is no fallback.
> 
> CONFIG_DEFAULT_ENVIRONMENT_GENERIC leads to inclusion of a generic
> "template" env into barebox - not really useful, but atleast you
> have a template to work with and al the FIXMEs included there will
> get you started.
> 
> If CONFIG_DEFAULT_ENVIRONMENT_PATH is used the "specific" path
> you have specified, will now be used for the default env. And it
> overrides the "generic" env path. So now you have a board specific
> env.

This is not the whole truth. CONFIG_DEFAULT_ENVIRONMENT_PATH can
be a list of directories. All pathes in this list are copied into
a temporary directory. This means that you can compose your environment
out of different directories. This also means that you can overwrite
files with more specific versions. If CONFIG_DEFAULT_ENVIRONMENT is enabled
'defaultenv' will be added to the start of the list.
So defaultenv/ contains a 'config' files with FIXMEs. This is normally
overwritten with the contents of your board specific config file
in arch/<arch>/<board>/env/config.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: need some clarification on how environments work
  2012-02-08  8:54   ` Sascha Hauer
@ 2012-02-08 11:01     ` Robert P. J. Day
  2012-02-09  7:52       ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2012-02-08 11:01 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: U-Boot Version 2 (barebox)

On Wed, 8 Feb 2012, Sascha Hauer wrote:

... snip ...

> This is not the whole truth. CONFIG_DEFAULT_ENVIRONMENT_PATH can be
> a list of directories. All pathes in this list are copied into a
> temporary directory. This means that you can compose your
> environment out of different directories. This also means that you
> can overwrite files with more specific versions.

> If CONFIG_DEFAULT_ENVIRONMENT is enabled 'defaultenv' will be added
> to the start of the list. So defaultenv/ contains a 'config' files
> with FIXMEs. This is normally overwritten with the contents of your
> board specific config file in arch/<arch>/<board>/env/config.

  i think what is needed here is an agreement on *terminology*.  you
can't document anything properly unless you can *name* it.  so what
names should be used here?

  consider the file referred to above, whose name is *actually*
arch/<arch>/boards/<board>/env/config (correct?), an example being,
say, arch/arm/boards/panda/env/config.  what is the official name of
this "config" file?

  sascha called it the "board-specific config file"?  everyone good
with that?  it could just as easily be called the "board-specific
environment file".  whatever.  a couple questions about it.  first,
will there always be just one of them per board, and will it always be
named "config"?  i *think* so but i refuse to make any assumptions.

  and second, is it an error if a board has no such file?  currently,
the beagleboard has no such file.  is that an acceptable state of
affairs?  or is it something that should be resolved?  the
"freescale-mx23-evk" board directory also doesn't have one, and there
might be others.  so what should be done there?

  and i want to correct what sascha wrote above, when he wrote:

> If CONFIG_DEFAULT_ENVIRONMENT is enabled 'defaultenv' will be added
> to the start of the list. So defaultenv/ contains a 'config' files
> with FIXMEs.

  actually, here's that part of common/Makefile:

ifdef CONFIG_DEFAULT_ENVIRONMENT
$(obj)/startup.o: include/generated/barebox_default_env.h
$(obj)/env.o: include/generated/barebox_default_env.h

ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
DEFAULT_ENVIRONMENT_PATH = "defaultenv"
endif

  so it would appear to be CONFIG_DEFAULT_ENVIRONMENT_GENERIC that
dictates whether the file defaultenv/config is imported as part of the
environment.

  anyway, feel free to clarify all of this while i think up more
questions. :-)

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: need some clarification on how environments work
  2012-02-08 11:01     ` Robert P. J. Day
@ 2012-02-09  7:52       ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2012-02-09  7:52 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: U-Boot Version 2 (barebox)

On Wed, Feb 08, 2012 at 06:01:08AM -0500, Robert P. J. Day wrote:
> On Wed, 8 Feb 2012, Sascha Hauer wrote:
> 
> ... snip ...
> 
> > This is not the whole truth. CONFIG_DEFAULT_ENVIRONMENT_PATH can be
> > a list of directories. All pathes in this list are copied into a
> > temporary directory. This means that you can compose your
> > environment out of different directories. This also means that you
> > can overwrite files with more specific versions.
> 
> > If CONFIG_DEFAULT_ENVIRONMENT is enabled 'defaultenv' will be added
> > to the start of the list. So defaultenv/ contains a 'config' files
> > with FIXMEs. This is normally overwritten with the contents of your
> > board specific config file in arch/<arch>/<board>/env/config.
> 
>   i think what is needed here is an agreement on *terminology*.  you
> can't document anything properly unless you can *name* it.  so what
> names should be used here?
> 
>   consider the file referred to above, whose name is *actually*
> arch/<arch>/boards/<board>/env/config (correct?), an example being,
> say, arch/arm/boards/panda/env/config.  what is the official name of
> this "config" file?

Since this mechanism is not limited to the config file maybe we can
speak of the generic environment and the board environment. Files in
the generic environment can be overwritten with files from the board
environment.

> 
>   sascha called it the "board-specific config file"?  everyone good
> with that?  it could just as easily be called the "board-specific
> environment file".  whatever.  a couple questions about it.  first,
> will there always be just one of them per board, and will it always be
> named "config"?  i *think* so but i refuse to make any assumptions.
> 
>   and second, is it an error if a board has no such file?  currently,
> the beagleboard has no such file.  is that an acceptable state of
> affairs?  or is it something that should be resolved?  the
> "freescale-mx23-evk" board directory also doesn't have one, and there
> might be others.  so what should be done there?

I think this should be resolved, but only by someone who is actively
working on this board to make sure the result really matches the board.

> 
>   and i want to correct what sascha wrote above, when he wrote:
> 
> > If CONFIG_DEFAULT_ENVIRONMENT is enabled 'defaultenv' will be added
> > to the start of the list. So defaultenv/ contains a 'config' files
> > with FIXMEs.
> 
>   actually, here's that part of common/Makefile:
> 
> ifdef CONFIG_DEFAULT_ENVIRONMENT
> $(obj)/startup.o: include/generated/barebox_default_env.h
> $(obj)/env.o: include/generated/barebox_default_env.h
> 
> ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
> DEFAULT_ENVIRONMENT_PATH = "defaultenv"
> endif
> 
>   so it would appear to be CONFIG_DEFAULT_ENVIRONMENT_GENERIC that
> dictates whether the file defaultenv/config is imported as part of the
> environment.

Even more specific it dictates that defaultenv/ is imported as part
of the environment.

BTW in some configs we have:

CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/freescale-mx53-loco/env/"

This means that defaultenv/ will be compiled in regardless of
CONFIG_DEFAULT_ENVIRONMENT_GENERIC being set or not. This should
be fixed to

CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/freescale-mx53-loco/env/"

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-02-09  7:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-08  0:11 need some clarification on how environments work Robert P. J. Day
2012-02-08  8:19 ` Premi, Sanjeev
2012-02-08  8:54   ` Sascha Hauer
2012-02-08 11:01     ` Robert P. J. Day
2012-02-09  7:52       ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox