All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] recommended place to add some custom settings to u-boot environment?
@ 2016-09-14  8:57 Robert P. J. Day
  2016-09-14  9:17 ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2016-09-14  8:57 UTC (permalink / raw)
  To: u-boot


  on my target board, there is some non-linux environment info in
"var=val" form that i want to drag into the current environment
whenever u-boot starts up. my plan is just to import that content into
a (new) hash table, then tweak it a bit before further adding it to
"env_htab". the logistics seem pretty straightforward, i'm just
curious as to where the *right*(?) place is to do this.

  currently, we're not taking advantage of CONFIG_MISC_INIT_R, so it
seems that would be a reasonable place to do that, in the board source
file.

  does that make sense? at that point, all of the normal environment
will have been initialized, and i'll have access to "env_htab".
thoughts? is there a better place to "adjust" the u-boot environment
once u-boot has done its normal work? thanks.

rday

-- 

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

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

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14  8:57 [U-Boot] recommended place to add some custom settings to u-boot environment? Robert P. J. Day
@ 2016-09-14  9:17 ` Wolfgang Denk
  2016-09-14  9:27   ` Robert P. J. Day
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2016-09-14  9:17 UTC (permalink / raw)
  To: u-boot

Dear Robert,

In message <alpine.LFD.2.20.1609140451540.23455@localhost.localdomain> you wrote:
> 
>   on my target board, there is some non-linux environment info in
> "var=val" form that i want to drag into the current environment
> whenever u-boot starts up. my plan is just to import that content into
> a (new) hash table, then tweak it a bit before further adding it to
> "env_htab". the logistics seem pretty straightforward, i'm just
> curious as to where the *right*(?) place is to do this.

Sounds complicated...

>   does that make sense? at that point, all of the normal environment
> will have been initialized, and i'll have access to "env_htab".
> thoughts? is there a better place to "adjust" the u-boot environment
> once u-boot has done its normal work? thanks.

Why not simply putting this as text (or wrapped with an uImage header)
into some storage (or even a file) and then use "env import" to load
it?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Any sufficiently advanced technology is indistinguishable from magic.
                                                   - Arthur C. Clarke

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14  9:17 ` Wolfgang Denk
@ 2016-09-14  9:27   ` Robert P. J. Day
  2016-09-14 12:58     ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2016-09-14  9:27 UTC (permalink / raw)
  To: u-boot

On Wed, 14 Sep 2016, Wolfgang Denk wrote:

> Dear Robert,
>
> In message <alpine.LFD.2.20.1609140451540.23455@localhost.localdomain> you wrote:
> >
> >   on my target board, there is some non-linux environment info in
> > "var=val" form that i want to drag into the current environment
> > whenever u-boot starts up. my plan is just to import that content
> > into a (new) hash table, then tweak it a bit before further adding
> > it to "env_htab". the logistics seem pretty straightforward, i'm
> > just curious as to where the *right*(?) place is to do this.
>
> Sounds complicated...
>
> >   does that make sense? at that point, all of the normal
> > environment will have been initialized, and i'll have access to
> > "env_htab". thoughts? is there a better place to "adjust" the
> > u-boot environment once u-boot has done its normal work? thanks.
>
> Why not simply putting this as text (or wrapped with an uImage
> header) into some storage (or even a file) and then use "env import"
> to load it?

  the problem is that that additional "environment" info is on the
target board because of a legacy non-linux OS -- it's at a well-known
address in flash, and we have no freedom to change it, we can only
read it, make some adjustments, then incorporate it into the current
environment.

rday

-- 

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

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

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14  9:27   ` Robert P. J. Day
@ 2016-09-14 12:58     ` Wolfgang Denk
  2016-09-14 13:04       ` Robert P. J. Day
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2016-09-14 12:58 UTC (permalink / raw)
  To: u-boot

Dear Robert,

In message <alpine.LFD.2.20.1609140524480.27791@localhost.localdomain> you wrote:
> 
> > Why not simply putting this as text (or wrapped with an uImage
> > header) into some storage (or even a file) and then use "env import"
> > to load it?
> 
>   the problem is that that additional "environment" info is on the
> target board because of a legacy non-linux OS -- it's at a well-known
> address in flash, and we have no freedom to change it, we can only
> read it, make some adjustments, then incorporate it into the current
> environment.

Which format is used?  Can it not be made to work with "env import"
using this well-known address?  I mean, if it's plain text, it should
just work.  If it's some other, more exotic format, you could probably
implement a custom import format?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a man sits with a pretty girl for  an  hour,  it  seems  like  a
minute.  But let him sit on a hot stove for a minute -- and it's lon-
ger than any hour. That's relativity.              -- Albert Einstein

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14 12:58     ` Wolfgang Denk
@ 2016-09-14 13:04       ` Robert P. J. Day
  2016-09-14 13:33         ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2016-09-14 13:04 UTC (permalink / raw)
  To: u-boot

On Wed, 14 Sep 2016, Wolfgang Denk wrote:

> Dear Robert,
>
> In message <alpine.LFD.2.20.1609140524480.27791@localhost.localdomain> you wrote:
> >
> > > Why not simply putting this as text (or wrapped with an uImage
> > > header) into some storage (or even a file) and then use "env import"
> > > to load it?
> >
> >   the problem is that that additional "environment" info is on the
> > target board because of a legacy non-linux OS -- it's at a
> > well-known address in flash, and we have no freedom to change it,
> > we can only read it, make some adjustments, then incorporate it
> > into the current environment.
>
> Which format is used?  Can it not be made to work with "env import"
> using this well-known address?  I mean, if it's plain text, it
> should just work.  If it's some other, more exotic format, you could
> probably implement a custom import format?

  it needs to be done programatically, and i *believe* himport_r() can
handle it, as the string is space-separated and null-terminated, so
i'm about to test that.

rday

-- 

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

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

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14 13:04       ` Robert P. J. Day
@ 2016-09-14 13:33         ` Wolfgang Denk
  2016-09-14 13:37           ` Robert P. J. Day
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2016-09-14 13:33 UTC (permalink / raw)
  To: u-boot

Dear Robert,

In message <alpine.LFD.2.20.1609140902380.2267@ca624034.mitel.com> you wrote:
> 
>   it needs to be done programatically, and i *believe* himport_r() can
> handle it, as the string is space-separated and null-terminated, so
> i'm about to test that.

It will not realy work.  "space-separated" is not good enough as a
space character is a legal part of the value of an environment
variable.  You would need to tweak the import code.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Status quo. Latin for "the mess we're in."

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14 13:33         ` Wolfgang Denk
@ 2016-09-14 13:37           ` Robert P. J. Day
  2016-09-14 14:31             ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2016-09-14 13:37 UTC (permalink / raw)
  To: u-boot

On Wed, 14 Sep 2016, Wolfgang Denk wrote:

> Dear Robert,
>
> In message <alpine.LFD.2.20.1609140902380.2267@ca624034.mitel.com> you wrote:
> >
> >   it needs to be done programatically, and i *believe* himport_r() can
> > handle it, as the string is space-separated and null-terminated, so
> > i'm about to test that.
>
> It will not realy work.  "space-separated" is not good enough as a
> space character is a legal part of the value of an environment
> variable.  You would need to tweak the import code.

  but himport_r() explicitly takes a separator character, and i can
guarantee the strings being "imported" have no embedded space
characters in their values. so as long as that's the case, shouldn't
himport_r() properly handle that given a separator of space?

rday

-- 

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

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

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14 13:37           ` Robert P. J. Day
@ 2016-09-14 14:31             ` Wolfgang Denk
  2016-09-14 15:07               ` Robert P. J. Day
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2016-09-14 14:31 UTC (permalink / raw)
  To: u-boot

Dear Robert,

In message <alpine.LFD.2.20.1609140935240.5661@ca624034.mitel.com> you wrote:
> 
> > It will not realy work.  "space-separated" is not good enough as a
> > space character is a legal part of the value of an environment
> > variable.  You would need to tweak the import code.
> 
>   but himport_r() explicitly takes a separator character, and i can
> guarantee the strings being "imported" have no embedded space
> characters in their values. so as long as that's the case, shouldn't
> himport_r() properly handle that given a separator of space?

Well, yes, but it sounds a bit fragile to me.  Experience tells me
that very soon someone _will_ use a space in a variable.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The scientists of today think deeply instead of clearly. One must  be
sane  to think clearly, but one can think deeply and be quite insane.
                                                       - Nikola Tesla

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

* [U-Boot] recommended place to add some custom settings to u-boot environment?
  2016-09-14 14:31             ` Wolfgang Denk
@ 2016-09-14 15:07               ` Robert P. J. Day
  0 siblings, 0 replies; 9+ messages in thread
From: Robert P. J. Day @ 2016-09-14 15:07 UTC (permalink / raw)
  To: u-boot

On Wed, 14 Sep 2016, Wolfgang Denk wrote:

> Dear Robert,
>
> In message <alpine.LFD.2.20.1609140935240.5661@ca624034.mitel.com> you wrote:
> >
> > > It will not realy work.  "space-separated" is not good enough as a
> > > space character is a legal part of the value of an environment
> > > variable.  You would need to tweak the import code.
> >
> >   but himport_r() explicitly takes a separator character, and i can
> > guarantee the strings being "imported" have no embedded space
> > characters in their values. so as long as that's the case, shouldn't
> > himport_r() properly handle that given a separator of space?
>
> Well, yes, but it sounds a bit fragile to me.  Experience tells me
> that very soon someone _will_ use a space in a variable.

  in this case, no ... it's legacy info that will never, ever change
at this point.

rday

-- 

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

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

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

end of thread, other threads:[~2016-09-14 15:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14  8:57 [U-Boot] recommended place to add some custom settings to u-boot environment? Robert P. J. Day
2016-09-14  9:17 ` Wolfgang Denk
2016-09-14  9:27   ` Robert P. J. Day
2016-09-14 12:58     ` Wolfgang Denk
2016-09-14 13:04       ` Robert P. J. Day
2016-09-14 13:33         ` Wolfgang Denk
2016-09-14 13:37           ` Robert P. J. Day
2016-09-14 14:31             ` Wolfgang Denk
2016-09-14 15:07               ` Robert P. J. Day

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.