mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Trent Piepho <trent.piepho@igorinstitute.com>
To: Konstantin Kletschke <konstantin.kletschke@inside-m2m.de>
Cc: barebox@lists.infradead.org
Subject: Re: Howto implement bootchooser <-> rauc interaction
Date: Fri, 3 Dec 2021 09:52:00 -0800	[thread overview]
Message-ID: <CAMHeXxOoXjqtSGXdE73oROUk9ybFmFv7gi8PtzLsKn=iH+FXLA@mail.gmail.com> (raw)
In-Reply-To: <9215c9815f25cc3328a05d6c9553ac36@inside-m2m.de>

On Fri, Dec 3, 2021 at 4:42 AM Konstantin Kletschke
<konstantin.kletschke@inside-m2m.de> wrote:
> The documentation looks very good and comprehensive overall but may be
> its me not getting
> the part how and where the shared data is properly stored.

You should add a node of "barebox,state" to the *Barebox* device tree.
Barebox needs to read state when it boots to determine the partition
to use and set boot attempts.  You also need in aliases { state =
&your_state_node: }: so it knows which state node it should use.

If you want to use state from Linux too, and of course you do so that
you can run rauc commands and update boot success in Linux, then you
must have state node ALSO in the Linux device tree.  But you do not
need to add it manually!  Barebox will automatically inject the state
node into the Linux device tree when it boots the kernel.

For this to work, you need to have Barebox give the kernel the Linux
device tree when booting.  This is the normal way to boot now.  All
current docs tell you to do this.  There was a much older style where
the dtb was appended to the kernel image and the kernel found it
itself without involving the bootloader.  I assume this will not work,
but I think Barebox state did not exist when I last booted a system
this way, so I haven't tried.

>
> When linux is booted rauc complains:
>
> (rauc:396): rauc-WARNING **: 08:32:31.311: Failed getting primary slot:
> Failed getting primary slot: No content to read

Sounds like barebox-state command did not work.

>
> # barebox-state -d
> Neither /aliases/state nor /state found

Yes, not working.  Barebox should put the state node into Linux device
tree.  It should appear under /sys/firmware/devicetree/base.  In
aliases node and also state node.

> I could easily utilize the I2C EEPROM on my Beaglebone Black for this
> but how should this
> look like for barebox and kernel?

Yes you can use your EEPROM to store state and use rauc.  One could
write code that uses one byte to indicate partition to boot and one
byte for attempts left.  Then you write some board code in Barebox to
read these bytes and set variables bootchooser will use.  There is a
script you write that rauc will run in Linux, it should read EEPROM
and return what it means to rauc.  I have done this to use a few bytes
of NVRAM in RTC chip for boot state information.

I think also one could use Barebox state to store data into an EEPROM.
Normally state is stored into a file, partition in eMMC/SD, or NAND
flash.  But I think EEPROM or a partition in an EEPROM would work too.
Haven't tried it myself though.

If you write custom code to store your information, you can easily
pack everything bootchooser and rauc *need* into just one byte.

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


  reply	other threads:[~2021-12-03 17:54 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 [this message]
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
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='CAMHeXxOoXjqtSGXdE73oROUk9ybFmFv7gi8PtzLsKn=iH+FXLA@mail.gmail.com' \
    --to=trent.piepho@igorinstitute.com \
    --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