Re: Howto implement bootchooser <-> rauc interaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 3, 2021 at 4:42 AM Konstantin Kletschke
<konstantin.kletschke@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux