[U-Boot] UBI Fastmap seems to be broken

Benzig, Tony tony.benzig at siemens.com
Tue Mar 22 13:39:47 CET 2016


Hello together,

I've been working on an AM335x based board with a NAND Flash attached on the GPMI Interface.
I've been using U-boot v2015.01 with the latest ubi patches. Please don't ask why I'm not using the latest U-Boot Version, it's due to some company conventions.

So my ubi and ubifs drivers are the same as the drivers on the current U-Boot master.
I also added this patch from Heiko Schocher [U-Boot] [PATCH] mtd,  ubi: set free_count to zero before walking through erase list: (http://lists.denx.de/pipermail/u-boot/2016-February/244472.html)
Without using this patch, ubi is trying to write on pages which are not empty and this will directly lead to unrecoverable ecc errors.

Nevertheless, ubi is working so far but once I attach my ubi the second time (this will normally happen via fastmap), I can't mount my UBIFS anymore.
Please see the log below.

It looks like there is something wrong with the fastmap anchors, because if I disable "CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT" and let Linux do the conversion, everything is fine until
U-Boot is updating the anchors.

So, could you help me to analyse this strange behaviour or is it already known?

U-Boot# nand erase.part System
device 0 offset 0xa00000, size 0x1f600000
Erasing at 0x1ffe0000 -- 100% complete.
OK

U-Boot# usb start
(Re)start USB...
USB0:   scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

U-Boot# fatload usb 0:1 0x82000000 update/rootfs.ubi
2097152 bytes read in 1300 ms (1.5 MiB/s)

U-Boot# nand write 0x82000000 0xA00000 0x200000
NAND write: device 0 offset 0xa00000, size 0x200000
2097152 bytes written: OK

U-Boot# ubi part System
ubi0: default fastmap pool size: 200
ubi0: default fastmap WL pool size: 100
ubi0: attaching mtd1
ubi0: scanning is finished
ubi0: attached mtd1 (name "mtd=2", size 502 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 4016, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 1/0, WL threshold: 4096, image sequence number: 2042447318
ubi0: available PEBs: 3896, total reserved PEBs: 120, PEBs reserved for bad PEB handling: 80

U-Boot# ubifsmount ubi:hwi
UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "hwi", R/O mode
UBIFS (ubi0:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
UBIFS (ubi0:0): FS size: 3047424 bytes (2 MiB, 24 LEBs), journal size 1142785 bytes (1 MiB, 8 LEBs)
UBIFS (ubi0:0): reserved for root: 0 bytes (0 KiB)
UBIFS (ubi0:0): media format: w4/r0 (latest is w4/r0), UUID 8db76d20, small LPT model

U-Boot# ubi part System
Unmounting UBIFS volume hwi!
ubi0 error: ubi_detach_mtd_dev: ubi0 reference count 1, destroy anyway
ubi0: detaching mtd1
ubi0: mtd1 is detached
ubi0: default fastmap pool size: 200
ubi0: default fastmap WL pool size: 100
ubi0: attaching mtd1
ubi0: attached by fastmap
ubi0: fastmap pool size: 200
ubi0: fastmap WL pool size: 100
ubi0: attached mtd1 (name "mtd=2", size 502 MiB)
ubi0: PEB size: 131072 bytes (128 KiB), LEB size: 126976 bytes
ubi0: min./max. I/O unit sizes: 2048/2048, sub-page size 2048
ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096
ubi0: good PEBs: 4016, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 1, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 2/0, WL threshold: 4096, image sequence number: 2042447318
ubi0: available PEBs: 3896, total reserved PEBs: 120, PEBs reserved for bad PEB handling: 80

U-Boot# ubifsmount ubi:hwi
UBIFS error (ubi0:0 pid 0): mount_ubifs: can't format empty UBI volume: read-only mount
Error reading superblock on volume 'ubi:hwi' errno=-30!
ubifsmount - mount UBIFS volume

Usage:
ubifsmount <volume-name>
    - mount 'volume-name' volume

Regards,
Tony


More information about the U-Boot mailing list