mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Konstantin Kletschke <konstantin.kletschke@inside-m2m.de>
Cc: barebox@lists.infradead.org
Subject: Re: Howto implement bootchooser <-> rauc interaction
Date: Wed, 5 Jan 2022 18:50:17 +0100	[thread overview]
Message-ID: <c55ef6c5-c7ea-0663-47b9-141773985ba2@pengutronix.de> (raw)
In-Reply-To: <YcMwk6mncQ8fSwTJ@Hephaistos>

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@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 |

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


  reply	other threads:[~2022-01-05 17:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03 12:40 Konstantin Kletschke
2021-12-03 17:52 ` Trent Piepho
2021-12-05 22:55   ` Roland Hieber
2021-12-06  8:52     ` Konstantin Kletschke
2021-12-14 21:40     ` Konstantin Kletschke
2021-12-15 10:56       ` Ahmad Fatoum
2021-12-16 19:35         ` Konstantin Kletschke
2021-12-17 10:00           ` Ahmad Fatoum
2021-12-17 12:50             ` Konstantin Kletschke
2022-01-03 15:24         ` Roland Hieber
2021-12-06  8:30   ` Konstantin Kletschke
2021-12-14 21:28   ` Konstantin Kletschke
2021-12-15 10:50     ` Ahmad Fatoum
     [not found]       ` <297b3425baa118783dccb6446900fbfa@inside-m2m.de>
2021-12-16 19:42         ` Fwd: " Konstantin Kletschke
2021-12-17  9:46           ` Ahmad Fatoum
2021-12-17 12:43             ` Konstantin Kletschke
2021-12-17 13:08               ` Ahmad Fatoum
2021-12-17 14:21                 ` Konstantin Kletschke
2021-12-22 14:05                   ` Konstantin Kletschke
2022-01-05 17:50                     ` Ahmad Fatoum [this message]
2022-01-06  9:59                       ` Konstantin Kletschke

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=c55ef6c5-c7ea-0663-47b9-141773985ba2@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=konstantin.kletschke@inside-m2m.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox