This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Ubiattach trouble

Other Parts Discussed in Thread: AM3505, AM3354

Hello. I use am3505 processor and Linux from arago am3517evm board.

Jffs2 work from the box but I need UBI. ubiattach failed if I attach it to non empty partition.

# ubiformat /dev/mtd6 -y
ubiformat: mtd6 (nand), size 232390656 bytes (221.6 MiB), 1773 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1772 -- 100 % complete
ubiformat: 1755 eraseblocks have valid erase counter, mean value is 7
ubiformat: 9 corrupted erase counters
ubiformat: 9 bad eraseblocks found, numbers: 536, 572, 790, 850, 1110, 1322, 1464, 1480, 1698
ubiformat: formatting eraseblock 1772 -- 100 % complete


# ubiattach /dev/ubi_ctrl -m 6
[ 801.400939] UBI: attaching mtd6 to ubi0
[ 801.405029] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 801.411560] UBI: logical eraseblock size: 129024 bytes
[ 801.417175] UBI: smallest flash I/O unit: 2048
[ 801.422058] UBI: sub-page size: 512
[ 801.426879] UBI: VID header offset: 512 (aligned 512)
[ 801.432952] UBI: data offset: 2048
[ 802.025299] UBI: max. sequence number: 0
[ 802.044372] UBI: attached mtd6 to ubi0
[ 802.048309] UBI: MTD device name: "jffs2-nand"
[ 802.053955] UBI: MTD device size: 221 MiB
[ 802.059143] UBI: number of good PEBs: 1764
[ 802.064056] UBI: number of bad PEBs: 9
[ 802.068664] UBI: number of corrupted PEBs: 0
[ 802.073303] UBI: max. allowed volumes: 128
[ 802.078094] UBI: wear-leveling threshold: 4096
[ 802.083007] UBI: number of internal volumes: 1
[ 802.087615] UBI: number of user volumes: 0
[ 802.092254] UBI: available PEBs: 1743
[ 802.097137] UBI: total number of reserved PEBs: 21
[ 802.102142] UBI: number of PEBs reserved for bad PEB handling: 17
[ 802.108489] UBI: max/mean erase counter: 11/8
[ 802.113037] UBI: image sequence number: 999037617
[ 802.120819] UBI: background thread "ubi_bgt0d" started, PID 9865
UBI device number 0, total 1764 LEBs (227598336 bytes, 217.1 MiB), available 1743 LEBs (224888832 bytes, 214.5 MiB), LEB size 129024 bytes (126.0 KiB)

# ubimkvol /dev/ubi0 -N data_volume -m
Set volume size to 224888832
Volume ID 0, size 1743 LEBs (224888832 bytes, 214.5 MiB), LEB size 129024 bytes (126.0 KiB), dynamic, name "data_volume", alignment 1

# mount -t ubifs ubi0:data_volume /mnt/storage/
[ 976.823730] UBIFS: default file-system created
[ 976.887512] UBIFS: mounted UBI device 0, volume 0, name "data_volume"
[ 976.894226] UBIFS: file system size: 223469568 bytes (218232 KiB, 213 MiB, 1732 LEBs)
[ 976.902587] UBIFS: journal size: 11225088 bytes (10962 KiB, 10 MiB, 87 LEBs)
[ 976.910491] UBIFS: media format: w4/r0 (latest is w4/r0)
[ 976.916534] UBIFS: default compressor: lzo
[ 976.920806] UBIFS: reserved for root: 4952683 bytes (4836 KiB)

# echo "Hello" > /mnt/storage/hello

# umount /mnt/storage/
[ 1055.053588] UBIFS: un-mount UBI device 0, volume 0

# ubidetach /dev/ubi_ctrl -m 6
[ 1129.516815] UBI: mtd6 is detached from ubi0
#

# ubiattach /dev/ubi_ctrl -m 6
[ 1161.666687] UBI: attaching mtd6 to ubi0
[ 1161.670745] UBI: physical eraseblock size: 131072 bytes (128 KiB)
[ 1161.677307] UBI: logical eraseblock size: 129024 bytes
[ 1161.682922] UBI: smallest flash I/O unit: 2048
[ 1161.687805] UBI: sub-page size: 512
[ 1161.692626] UBI: VID header offset: 512 (aligned 512)
[ 1161.698699] UBI: data offset: 2048
[ 1161.705474] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 0:0, read 64 bytes
[ 1161.716033] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 0:512, read 512 bytes
[ 1161.733398] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 20:0, read 64 bytes
[ 1161.744018] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 20:512, read 512 bytes
[ 1161.770751] UBI error: check_corruption: PEB 20 contains corrupted VID header, and the data does not contain all 0xFF, this may be a non-UBI PEB or a severe VID header corruptin
[ 1161.974456] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 567:0, read 64 bytes
[ 1161.985168] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 567:512, read 512 bytes
[ 1161.995941] UBI warning: process_eb: valid VID header but corrupted EC header at PEB 567
[ 1162.070678] UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 775:0, read 64 bytes
[ 1162.081359] UBI error: ubi_io_read: error -74 (ECC error) while reading 512 bytes from PEB 775:512, read 512 bytes
[ 1162.108215] UBI error: check_corruption: PEB 775 contains corrupted VID header, and the data does not contain all 0xFF, this may be a non-UBI PEB or a severe VID header corruptn
[ 1162.451141] UBI error: check_what_we_have: 2 PEBs are corrupted and preserved
[ 1162.458618] Corrupted PEBs are: 775 20
[ 1162.463104] UBI: max. sequence number: 8
[ 1162.467773] UBI error: ubi_read_volume_table: the layout volume was not found
ubiattach: error!: cannot attach mtd6
error 22 (Invalid argument)
#

Can I fix this problem? How?

  • If we look at http://www.linux-mtd.infradead.org/faq/ubifs.html it talked a little about the error you see, but not exactly, since you're using ubiformat.  This implies to me there's a mismatch in ECC schemes.  What is your scheme?  Thanks!

  • Hi.

    We have this problem too on our board based on a am3354 SoC and a Samsung K9 NAND.

    When we use any ECC with hardware support like OMAP_ECC_BCH8_CODE_HW or OMAP_ECC_HAMMING_CODE_HW. The code for handling the NAND is from the EZLinux SDK from TI. I would appreciate any help on this matter!

    Best regards

    Daniel Eriksson

  • Daniel,

    Can you send me the following files to the email renjith.thomas@pathpartnertech.com? Also do send me the complete kernel logs when you are facing this issue.

    1. arch/arm/mach-omap2/board-335xevm.c 
    2. arch/arm/mach-omap2/board-flash.c
    3. arch/arm/mach-omap2/gpmc.c
    4. drivers/mtd/nand/nand_base.c
    5. drivers/mtd/nand/omap2.c