Skip to contentSkip to conversation

Problem to attach NAND MTD-device to UBI

DISCUSSION Kaius Häggblom 2 participants 3 messages May 22, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi.

I'm developing on an embedded arm (AT91) platform, on which I have had successfully Linux 2.6.22 and 2.6.25 kernels running for a long time in production. As I have had some JFFS2 failures on NAND in the field and I'm now updating to a 2.6.29 kernel I want to try ubifs on the NAND to see if it would bring an improvement.

I have the kernel running and ubi-tools compiled and installed. I have tested that NAND still works OK with JFFS2 with the new kernel. It's a 256MiB NAND in two partititions:
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit)
0x000000000000-0x000008000000 : "NAND_Flash 1"
0x000008000000-0x000010000000 : "NAND_Flash 2"

Now the problem is that I cannot get the mtd-devices attached to ubi. The error is different depending on if I try to use ubiformat, or if I try to attach an empty device directly.

WITH UBIFORMAT
=============

# flash_eraseall /dev/mtd5
Erasing 128 Kibyte @ 5aa0000 -- 70 % complete.
Skipping bad block at 0x05ac0000
Erasing 128 Kibyte @ 7fe0000 -- 99 % complete.
# ./ubiformat /dev/mtd5
ubiformat: mtd5 (NAND), size 134217728 bytes (1280 MiB), 131072 eraseblocks of 131072 bytes (1280 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1023 -- 100 % complete ubiformat: 1023 eraseblocks are supposedly empty
ubiformat: bad eraseblocks: 726
ubiformat: formatting eraseblock 1023 -- 100 % complete 
# ubiattach /dev/ubi_ctrl -m 5
UBI: attaching mtd5 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512
UBI error: validate_ec_hdr: bad EC header
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
ubiattach error: cannot attach mtd5
error 22 (Invalid argument)

DIRECTLY ATTACHING EMPTY DEVICE
===========================

# flash_eraseall /dev/mtd4
Erasing 128 Kibyte @ 380000 --  2 % complete.
Skipping bad block at 0x003a0000
Erasing 128 Kibyte @ 71e0000 -- 88 % complete.
Skipping bad block at 0x07200000
Erasing 128 Kibyte @ 7bc0000 -- 96 % complete.
Skipping bad block at 0x07be0000
Erasing 128 Kibyte @ 7fe0000 -- 99 % complete.
# ubiattach /dev/ubi_ctrl -m 4
UBI: attaching mtd4 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 0:512, written 0 bytes
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1:512, written 0 bytes
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 2:512, written 0 bytes
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 3:512, written 0 bytes
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 4:512, written 0 bytes
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 5:512, written 0 bytes
ubiattach error: cannot attach mtd4
error 5 (Input/output error)

Any suggestions or ideas anyone?

kind regards,
kaius

#1 lore raw

If I use ubiformat with parameter -s512 I get the device attached, but still ubimkvol fails:

/ # ./ubiformat /dev/mtd4 -s512
ubiformat: mtd4 (NAND), size 134217728 bytes (1280 MiB), 131072 eraseblocks of 131072 bytes (1280 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1023 -- 100 % complete ubiformat: 1021 eraseblocks are supposedly empty
ubiformat: bad eraseblocks: 29, 912, 991
ubiformat: formatting eraseblock 1023 -- 100 % complete / # ubiattach /dev/ubi_ctrl -m4 UBI: attaching mtd4 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd4 to ubi0
UBI: MTD device name: "NAND_Flash 1"
UBI: MTD device size: 128 MiB
UBI: number of good PEBs: 1021
UBI: number of bad PEBs: 3
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 1007
UBI: total number of reserved PEBs: 14
UBI: number of PEBs reserved for bad PEB handling: 10
UBI: max/mean erase counter: 0/0
UBI: background thread "ubi_bgt0d" started, PID 497
UBI device number 0, total 1021 LEBs (131733504 bytes, 1256 MiB), available 1007 LEBs (129927168 bytes, 1239 MiB), LEB size 129024 bytes (1260 KiB)

/ # ubimkvol /dev/ubi0 -m -N "TEST"
Set volume size to 129927168
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1023:512, written 0 bytes UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1023
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1022:512, written 0 bytes UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1022
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1021:512, written 0 bytes UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1021
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1020:512, written 0 bytes UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1020 UBI warning: ubi_ro_mode: switch to read-only mode
UBI error: ubi_io_write: read-only mode
UBI error: erase_worker: failed to erase PEB 0, error -30
UBI error: do_work: work failed with error code -30
UBI error: ubi_thread: ubi_bgt0d: work failed with error code -30
UBI error: ubi_create_volume: cannot create volume 0, error -30
ubimkvol error: cannot UBI create volume
error 30 (Read-only file system)

r,
kaius

#2 lore raw
Quoted 10 lines · Kaius Häggblom

Set volume size to 129927168
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1023:512, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1023
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1022:512, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1022

Quoted 8 lines

UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1021:512, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB 2147479551:0, PEB 1021
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB 1020:512, written 0 bytes

http://www.linux-mtd.infradead.org/faq/ubi.html#L_subpage_verify_fail

?

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)