mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* configuring state framework for x86/EFI
@ 2021-05-19  9:47 Laszlo Sitzer
  2021-05-19 10:39 ` Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Laszlo Sitzer @ 2021-05-19  9:47 UTC (permalink / raw)
  To: barebox

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?

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.

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?

Best, Lazlo

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


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

* Re: configuring state framework for x86/EFI
  2021-05-19  9:47 configuring state framework for x86/EFI Laszlo Sitzer
@ 2021-05-19 10:39 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2021-05-19 10:39 UTC (permalink / raw)
  To: Laszlo Sitzer, barebox

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 :-)

Cheers,
Ahmad

> 
> Best, Lazlo
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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] 2+ messages in thread

end of thread, other threads:[~2021-05-19 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19  9:47 configuring state framework for x86/EFI Laszlo Sitzer
2021-05-19 10:39 ` Ahmad Fatoum

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