Re: [PATCH] ubiformat: improve generation of UBI image sequence

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

 



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