mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
To: Laszlo Sitzer <>,
Subject: Re: configuring state framework for x86/EFI
Date: Wed, 19 May 2021 12:39:17 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Laszlo,

On 19.05.21 11:47, Laszlo Sitzer wrote:
> Hello,
> I have a x86/EFI system with barebox running (without state framework).
> I noticed using the nv command persists values but I can't seem to
> understand where these physically get stored. Is there a way I could
> determine that?

EFI variables; You should see something like:
environment load /efivars/barebox-env-5b91f69c-8b88-4a2b-9269-5f1d802b5175: No such file or directory

first time you boot when you have no environment stored yet.

> I  would like to use the state framework (in order to be able to use
> barebox-state to reset bootchooser counters). In order to do so I have
> to write my state.dts, but I don't know which backend to choose in
> order to use the same location as nv used before.

If you have atomic EFI variables, you could use those directly for
next boot slot selection without involving barebox-state.

If they aren't atomic, you will likely not want them as backing
store for barebox-state either. For such cases you can create a
partition and use that as backend.
> I am not asking to use nv and state at the same time but rather have
> state framework use the location that nv used. Does that make sense?

It does. Here's an example:

/ {
	aliases {
		state = &state;

	state: state {
		magic = <0xDEADBEEF>;
         	backend-type = "raw";
         	backend = <&state_part>;
         	backend-stridesize = <4096>; /* partition must be at least 3x this */
		/* your variables */

	partitions {
        	compatible = "fixed-partitions";

	        state_part: state {
                	partuuid = "your-part-uuid";

Adjust your partitioning accordingly, compile the DT, store it
in /boot/EFI/barebox/state.dtb and use the most recent
version of the barebox-state userspace utility and you should be good to go.

If you think the documentation here can be improved, patches are always
welcome :-)


> Best, Lazlo
> _______________________________________________
> barebox mailing list

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       |  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

barebox mailing list

      reply	other threads:[~2021-05-19 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19  9:47 Laszlo Sitzer
2021-05-19 10:39 ` Ahmad Fatoum [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: configuring state framework for x86/EFI' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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