[U-Boot] Possible incoherence in UBI attaching, incorrect bad PEBs

Walter Mollica walter.mollica at gmail.com
Thu Jun 11 19:04:53 CEST 2015


Hi everyone,
I am writing to get some information about what seems to be an incongruency
in the U-Boot's UBI subsystem.

I am using U-Boot 2015.04/2015.01 (haven't tried with previous versions),
cloned today from the git tree on denx.de, on a SAMA5D3XEK hardware with a
NAND Flash.

There's a newly flashed UBI image on the NAND.

When attaching the mtd partition in U-boot I get the following result:
U-Boot> ubi part ubivolume
UBI: attaching mtd1 to ubi0
UBI: scanning is finished
UBI: attached mtd1 (name "mtd=8", size 232 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 1862, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 3, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 2/0, WL threshold: 4096, image sequence
number: 1307283568
UBI: available PEBs: 1247, total reserved PEBs: 615, PEBs reserved for bad
PEB handling: 40

While, when doing the same (at boot time) from my GNU/Linux system
(Buildroot'ed 3.10.0 on initramfs) I get:
UBI: scanning is finished
UBI: attached mtd8 (name "ubivolume", size 232 MiB) to ubi0
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
UBI: VID header offset: 2048 (aligned 2048), data offset: 4096
UBI: good PEBs: 1858, bad PEBs: 4, corrupted PEBs: 0
UBI: user volume: 3, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 0/0, WL threshold: 4096, image sequence
number: 1307283568
UBI: available PEBs: 1247, total reserved PEBs: 611, PEBs reserved for bad
PEB handling: 36

The max/mean erase counter are different as you can see, but there is
another thing that scares me more.

These two lines are *different*
In U-Boot
UBI: good PEBs: 1862, bad PEBs: 0, corrupted PEBs: 0
in Linux
UBI: good PEBs: 1858, bad PEBs: 4, corrupted PEBs: 0

4 PEBs which Linux's UBI marks as bad are seen as good from U-Boot.

Moreover, this 4 PEBs seem to have migrated into this other line (the last
one):
In U-Boot:
UBI: available PEBs: 1247, total reserved PEBs: 615, PEBs reserved for bad
PEB handling: 40
In Linux:
UBI: available PEBs: 1247, total reserved PEBs: 611, PEBs reserved for bad
PEB handling: 36

As you can see the reserved PEBs for bad PEB handling in U-Boot are 4+ in
respect to the number reported by Linux.

>From what you know, is this to be considered some kind of "expected
behaviour", misconfiguration or there's a problem to be fixed?

As some UBI volumes will be written by both U-Boot and Linux, I am
concerned about this issue. And it would be interesting to discover who's
right between U-Boot and Linux.

Thank you.

Saluti,
Walter Mollica


More information about the U-Boot mailing list