mail archive of the rauc mailing list
 help / color / mirror / Atom feed
From: Enrico Joerns <ejo@pengutronix.de>
To: Philip Downer <pdowner@prospero-tech.com>
Cc: rauc@pengutronix.de
Subject: Re: [RAUC] Understanding u-boot integration
Date: Wed, 3 May 2017 08:11:31 +0200	[thread overview]
Message-ID: <d93bb3df-ca22-5354-d813-3b31ade5e48e@pengutronix.de> (raw)
In-Reply-To: <CAE6wzSLwyMbGkcoEiBdgqbcL9igO3WWbawEpLdmiOpPGJ1mycA@mail.gmail.com>

Hi Philip,

On 04/25/2017 03:43 PM, Philip Downer wrote:
> After seeing a presentation on RAUC at FOSDEM I've been looking to
> integrate it with a Yocto based i.mx6 embedded system that I'm working on.

great to hear that it inspired you to start working with RAUC.

> Everything is pretty much working but I'm just trying to understand the
> integration with u-boot, I've based my u-boot scripts on the one in
> contrib from the RAUC repository. I've had to make some changes due to
> an old version of u-boot and quirks of our setup, however my questions
> are about the general process.
>
> As I understand it, when the system boots, the first slot from
> BOOT_ORDER will be selected, say slot A. Then BOOT_A_LEFT will be
> decremented from 3 to 2 and we will save the environment to nand flash.
> Is it then intended that when the OS boots successfully it should change
> the BOOT_A_LEFT variable in nand flash back to 3?

Yes, this is exactly what it should behave like. This is required to 
prevent you from booting in a loop when userspace fails and the watchdog 
resets the board before you mark your boot as 'good'.

Resetting the boot counter can be done by calling

   rauc status mark-good

If you use meta-rauc with systemd, this is exactly what the 
`rauc-mark-good.service` does:

   [Unit]
   Description=Rauc Good-marking Service

   [Service]
   ExecStart=@BINDIR@/rauc status mark-good

   [Install]
   WantedBy=multi-user.target


In your setup, you should assure this service runs *after* all your 
critical services came up and you can be halfway sure that the system 
you booted is in a working state.

And to be honest, it seems this handling currently is everyting else 
than overdocumented...

> Following on from that, if I'm correct, this seems like a lot of writes
> to nand flash. Writing to nand is also not that quick for us at 3.41
> seconds from within Linux, is there not a reasonable chance of
> corruption if the system was reset during that write?

Well, this definetely depends on where you store your environment and 
how frequently you intend to reboot your system. It has to be noted that 
the environment (regardless whether in U-Boot or in Barebox) is not the 
best place to store such informations, as these 'environments' were 
designed with other use cases in mind.

If you care about these topics, you could have a look at the state and 
bootchooser framework of the Barebox bootloader:

http://www.barebox.org/doc/latest/user/state.html
http://barebox.org/doc/latest/user/bootchooser.html

Barebox state was explicitly designed for storing and manipulating data 
that has to be exchanged between the Bootloader and Linux. It has 
different storage strategies to deal with the different properties of 
the underlying storage technologies (EEPROM, eMMC, raw NAND, etc.) and 
manages redundancy and write atomicity.


Best regards

Enrico

-- 
Pengutronix e.K.                           | Enrico Jörns                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
RAUC mailing list

      reply	other threads:[~2017-05-03  6:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 13:43 Philip Downer
2017-05-03  6:11 ` Enrico Joerns [this message]

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=d93bb3df-ca22-5354-d813-3b31ade5e48e@pengutronix.de \
    --to=ejo@pengutronix.de \
    --cc=pdowner@prospero-tech.com \
    --cc=rauc@pengutronix.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