mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] ubiformat: improve generation of UBI image sequence
Date: Tue, 16 Jul 2019 10:09:11 +0200	[thread overview]
Message-ID: <20190716080911.p53fxgo3m5h3plmd@pengutronix.de> (raw)
In-Reply-To: <20190715090900.19123-1-s.hauer@pengutronix.de>

On Mon, Jul 15, 2019 at 11:09:00AM +0200, Sascha Hauer wrote:
> The UBI ec_hdr has an image_seq field. During attaching UBI expects
> that its value is the same for all eraseblocks. The value should be
> changed with every ubiformat and is used to detect half written images.
> 
> In barebox we use a pseudo random number generated with rand() for this
> value. The ubiformat command calls srand(get_time_ns()) to initialize
> the pseudo random numbber generator. This is done in the option parser,

s/bb/b/

> so when ubiformat() is called directly (from fastboot for example) the
> pseudo random number generator is not initialized and we get the same
> values after every barebox restart.

I don't understand the problem (i.e. where is srand() called up to now),
but that's not important. I wonder if you could just use some data from
the NAND to (additionally) initialize the rng?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

      reply	other threads:[~2019-07-16  8:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15  9:09 Sascha Hauer
2019-07-16  8:09 ` Uwe Kleine-König [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=20190716080911.p53fxgo3m5h3plmd@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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