Howto implement bootchooser <-> rauc interaction
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Jan 5 09:50:17 PST 2022
Hello Konstantin,
On 22.12.21 15:05, Konstantin Kletschke wrote:
> I switched from doing the state in the onboard EEPROM (as said, it
> is write protected in production use) to save the state in a dead space
> in the onboard eMMC chip between MBR and first partition:
>
> / {
> aliases {
> state = &state_eeprom;
> };
>
> state_eeprom: state_eeprom {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "barebox,state";
> magic = <0xcafebabe>;
> backend-type = "raw";
> backend = <&backend_state_mmc2>;
> backend-storage-type = "direct";
> backend-stridesize = <54>;
> last_chosen {
Here last_chosen is toplevel.
> Compiled in (relevant) variables:
>
> * boot.default: bootchooser insidem2m_1 insidem2m_2
> boot.watchdog_timeout: 0
> bootchooser.default_attempts: 3
> bootchooser.default_priority: 1
> bootchooser.disable_on_zero_attempts: 0
> bootchooser.reset_attempts: (list: "power-on", "all-zero")
> bootchooser.reset_priorities:
> bootchooser.retry: 0
> * bootchooser.state_prefix: state
Here you say they are inside state.*
> The userspace is no amused, however:
>
> rauc status output:
>
> (rauc:583): rauc-WARNING **: 18:51:57.389: Failed getting primary slot: Failed getting primary slot: No content to read
Yes RAUC has:
#define BOOTSTATE_PREFIX "bootstate"
So that's what you need to use.
> barebox-state:
>
> last_chosen=2
> system0.remaining_attempts=0
> system0.priority=21
> system0.ok=0
> system1.remaining_attempts=2
> system1.priority=20
> system1.ok=0
But state works correctly regardless, you can place
all sort of stuff there.
> ################ PLAN B ##################
>
> I had a previous state device tree setup, which made userspace happy,
> but not barebox. I had a parent bootstate section containing system0 and
> system1:
>
> / {
> aliases {
> state = &state_eeprom;
> };
>
> state_eeprom: state_eeprom {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "barebox,state";
> magic = <0xcafebabe>;
> backend-type = "raw";
> backend = <&backend_state_mmc2>;
> backend-storage-type = "direct";
> backend-stridesize = <54>;
> bootstate {
Here you have a correctly named container.
> With this device tree barebox bootschooser is unhappy:
Did you set bootchooser.boot_prefix?
> But userspace is fine:
As expected.
> I assume this has to do with bootchooser.state_prefix. If I change from
> state to bootstate (yes, brute force) I get:
>
> global excerpt:
>
> * bootchooser.state_prefix: bootstate
>
> devinfo state looks the same as previous.
>
> boot:
>
> barebox at TI AM335x BeagleBone black:/ boot
> ERROR: bootchooser: Cannot get state 'bootstate'
> Nothing bootable found on 'bootchooser'
> Booting entry 'insidem2m_1'
> ext4 ext40: EXT2 rev 1, inode_size 256, descriptor size 64
> mounted /dev/mmc1.1 on /mnt/mmc1.1
> [...]
>
>
>
> When I set:
>
> * bootchooser.state_prefix: state.bootstate
>
> I get best of both worlds!
Exactly. :-)
> Wall of text, two questions:
>
> Is this resulting setup (DT with bootstate parent, state_prefix:
> state.bootstate) sane?
Ye, the final setup looks good now.
> Can the variant without the boostate variant work too? If it was the
> other way around, userspace working w/o the bootstate variant but bnot
> _with_ I would say additional configuration required or something, but
> this way... I would like to understand this fully.
RAUC hardcodes bootstate, so that's what you need to use, unless you patch
RAUC.
Cheers,
Ahmad
>
>
> Kind Regards
> Konstantin
>
>
--
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 |
More information about the barebox
mailing list