mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Accessing non-volatile variables from Linux
@ 2017-01-25 19:21 Frank Hunleth
  2017-01-25 20:51 ` Trent Piepho
  2017-01-26  7:30 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Frank Hunleth @ 2017-01-25 19:21 UTC (permalink / raw)
  To: barebox

Hi,

I'm wondering if it's possible to read and modify Barebox environment
variables from Linux in a way similar to U-Boot's fw_printenv and
fw_setenv. If that's not possible, is there another way for communicating
between Linux and Barebox? Apologies if I totally missed a section in the
docs that describes this.

Thanks,
Frank

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

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

* Re: Accessing non-volatile variables from Linux
  2017-01-25 19:21 Accessing non-volatile variables from Linux Frank Hunleth
@ 2017-01-25 20:51 ` Trent Piepho
  2017-01-26  7:30 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Trent Piepho @ 2017-01-25 20:51 UTC (permalink / raw)
  To: fhunleth; +Cc: barebox

On Wed, 2017-01-25 at 14:21 -0500, Frank Hunleth wrote:
> I'm wondering if it's possible to read and modify Barebox environment
> variables from Linux in a way similar to U-Boot's fw_printenv and
> fw_setenv. If that's not possible, is there another way for communicating
> between Linux and Barebox? Apologies if I totally missed a section in the
> docs that describes this.

This might not be useful for what you want, but it could be.  Many SoCs
have "handoff" registers that don't have any predefined use and are
preserved across a soft reset.

You can write to the register(s) from Linux, then reboot to Barebox and
see the value, which could then trigger some action in Barebox.

Of course the registers are not preserved across a hard reset, which
might be a plus or minus depending on what you want to do.

This allows you to pass info to barebox without having to worry about
what happens if the env is corrupted while being modified.  The barebox
env format is NOT a log based FS designed to prevent this!
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: Accessing non-volatile variables from Linux
  2017-01-25 19:21 Accessing non-volatile variables from Linux Frank Hunleth
  2017-01-25 20:51 ` Trent Piepho
@ 2017-01-26  7:30 ` Sascha Hauer
  2017-01-26 13:30   ` Frank Hunleth
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2017-01-26  7:30 UTC (permalink / raw)
  To: Frank Hunleth; +Cc: barebox

Hi Frank,

On Wed, Jan 25, 2017 at 02:21:55PM -0500, Frank Hunleth wrote:
> Hi,
> 
> I'm wondering if it's possible to read and modify Barebox environment
> variables from Linux in a way similar to U-Boot's fw_printenv and
> fw_setenv. If that's not possible, is there another way for communicating
> between Linux and Barebox? Apologies if I totally missed a section in the
> docs that describes this.

There is scripts/bareboxenv.c which gets compiled for the target when
CONFIG_BAREBOXENV_TARGET is enabled. This allows you to unpack the
barebox environment device (mtd/partition) to a directory and back to
the device after modifying. There is no direct getenv/setenv
functionality, you would have to do a manual echo/cat to the variable
files.

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] 4+ messages in thread

* Re: Accessing non-volatile variables from Linux
  2017-01-26  7:30 ` Sascha Hauer
@ 2017-01-26 13:30   ` Frank Hunleth
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Hunleth @ 2017-01-26 13:30 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sasch,

On Thu, Jan 26, 2017 at 2:30 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Hi Frank,
>
> On Wed, Jan 25, 2017 at 02:21:55PM -0500, Frank Hunleth wrote:
>> Hi,
>>
>> I'm wondering if it's possible to read and modify Barebox environment
>> variables from Linux in a way similar to U-Boot's fw_printenv and
>> fw_setenv. If that's not possible, is there another way for communicating
>> between Linux and Barebox? Apologies if I totally missed a section in the
>> docs that describes this.
>
> There is scripts/bareboxenv.c which gets compiled for the target when
> CONFIG_BAREBOXENV_TARGET is enabled. This allows you to unpack the
> barebox environment device (mtd/partition) to a directory and back to
> the device after modifying. There is no direct getenv/setenv
> functionality, you would have to do a manual echo/cat to the variable
> files.

Thanks - That sounds like what I'm looking for. I'll check it out.

Also, Trent, thanks for the alternative idea.

Frank

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

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

end of thread, other threads:[~2017-01-26 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 19:21 Accessing non-volatile variables from Linux Frank Hunleth
2017-01-25 20:51 ` Trent Piepho
2017-01-26  7:30 ` Sascha Hauer
2017-01-26 13:30   ` Frank Hunleth

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