All of lore.kernel.org
 help / color / mirror / Atom feed
* error!: "/dev/ubi0" is not a character device ?!?
@ 2010-07-26 12:00 Arno Steffen
  2010-07-26 13:14 ` Artem Bityutskiy
  0 siblings, 1 reply; 18+ messages in thread
From: Arno Steffen @ 2010-07-26 12:00 UTC (permalink / raw)
  To: linux-mtd

I just tried the howto (mount an empty UBI volume). But when I want to do
ubimkvol /dev/ubi0 -N test_vol -s 10MiB I get an error message:
libubi: error!: "/dev/ubi0" is not a character device
ubimkvol: error!: error while probing "/dev/ubi0"
          error 22 (Invalid argument)

If I check /dev/ubi0 it is indeed a block device. But this has been
created by ubiattach which I used as howto
What is the problem????

( I tried to set the device as a char-device by

[root@or:/]# ll /dev/ub*
brw-rw----    1 root     root     253,   0 Jan  1 00:46 /dev/ubi0
crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
[root@or:/]# rm /dev/ubi0
[root@or:/]# mknod /dev/ubi0 c 253 0

But than I get other error messages:

[root@or:/]# ubimkvol /dev/ubi0 -N test -s 10MiB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
331:512, written 0 bytes
Backtrace:
[<8002d558>] (dump_backtrace+0x0/0x10c) from [<80267dac>] (dump_stack+0x18/0x1c)
 r6:0000014b r5:fffffffb r4:87a19800 r3:00000002
[<80267d94>] (dump_stack+0x0/0x1c) from [<801bb084>] (ubi_io_write+0x308/0x384)
[<801bad7c>] (ubi_io_write+0x0/0x384) from [<801bb228>]
(ubi_io_write_vid_hdr+0x128/0x144)
[<801bb100>] (ubi_io_write_vid_hdr+0x0/0x144) from [<801b9114>]
(ubi_eba_write_leb+0x550/0x758)
 r6:87928400 r5:879dde00 r4:87a19800
[<801b8bc4>] (ubi_eba_write_leb+0x0/0x758) from [<801b1560>]
(ubi_change_vtbl_record+0xf4/0x158)
[<801b146c>] (ubi_change_vtbl_record+0x0/0x158) from [<801b2d74>]
(ubi_create_volume+0x51c/0x6c0)
 r7:87a19800 r6:87a73d2c r5:87928200 r4:879282a0
[<801b2858>] (ubi_create_volume+0x0/0x6c0) from [<801b56f4>]
(ubi_cdev_ioctl+0x1f4/0x96c)
[<801b5500>] (ubi_cdev_ioctl+0x0/0x96c) from [<800b6194>] (vfs_ioctl+0x34/0xb4)
[<800b6160>] (vfs_ioctl+0x0/0xb4) from [<800b6880>] (do_vfs_ioctl+0x56c/0x5b4)
 r6:40986f00 r5:879f73c0 r4:7e85c9d8 r3:87a2e230
[<800b6314>] (do_vfs_ioctl+0x0/0x5b4) from [<800b6908>] (sys_ioctl+0x40/0x64)
[<800b68c8>] (sys_ioctl+0x0/0x64) from [<80029fc0>] (ret_fast_syscall+0x0/0x2c)
 r7:00000036 r6:00000003 r5:7e85cba8 r4:7e85c9d8
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
2147479551:0, PEB 331
UBI: run torture test for PEB 331

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-26 12:00 error!: "/dev/ubi0" is not a character device ?!? Arno Steffen
@ 2010-07-26 13:14 ` Artem Bityutskiy
  2010-07-26 13:49   ` Arno Steffen
  0 siblings, 1 reply; 18+ messages in thread
From: Artem Bityutskiy @ 2010-07-26 13:14 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

On Mon, 2010-07-26 at 14:00 +0200, Arno Steffen wrote:
> I just tried the howto (mount an empty UBI volume). But when I want to do
> ubimkvol /dev/ubi0 -N test_vol -s 10MiB I get an error message:
> libubi: error!: "/dev/ubi0" is not a character device
> ubimkvol: error!: error while probing "/dev/ubi0"
>           error 22 (Invalid argument)
> 
> If I check /dev/ubi0 it is indeed a block device. But this has been
> created by ubiattach which I used as howto
> What is the problem????

Your udev rules, perhaps? Creating device nodes is responsibility of
your system, not UBI/ubi-utils.

> ( I tried to set the device as a char-device by
> 
> [root@or:/]# ll /dev/ub*
> brw-rw----    1 root     root     253,   0 Jan  1 00:46 /dev/ubi0
> crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
> [root@or:/]# rm /dev/ubi0
> [root@or:/]# mknod /dev/ubi0 c 253 0
> 
> But than I get other error messages:
> 
> [root@or:/]# ubimkvol /dev/ubi0 -N test -s 10MiB
> UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
> 331:512, written 0 bytes
> Backtrace:
> [<8002d558>] (dump_backtrace+0x0/0x10c) from [<80267dac>] (dump_stack+0x18/0x1c)
>  r6:0000014b r5:fffffffb r4:87a19800 r3:00000002
> [<80267d94>] (dump_stack+0x0/0x1c) from [<801bb084>] (ubi_io_write+0x308/0x384)
> [<801bad7c>] (ubi_io_write+0x0/0x384) from [<801bb228>]
> (ubi_io_write_vid_hdr+0x128/0x144)
> [<801bb100>] (ubi_io_write_vid_hdr+0x0/0x144) from [<801b9114>]
> (ubi_eba_write_leb+0x550/0x758)
>  r6:87928400 r5:879dde00 r4:87a19800
> [<801b8bc4>] (ubi_eba_write_leb+0x0/0x758) from [<801b1560>]
> (ubi_change_vtbl_record+0xf4/0x158)
> [<801b146c>] (ubi_change_vtbl_record+0x0/0x158) from [<801b2d74>]
> (ubi_create_volume+0x51c/0x6c0)
>  r7:87a19800 r6:87a73d2c r5:87928200 r4:879282a0
> [<801b2858>] (ubi_create_volume+0x0/0x6c0) from [<801b56f4>]
> (ubi_cdev_ioctl+0x1f4/0x96c)
> [<801b5500>] (ubi_cdev_ioctl+0x0/0x96c) from [<800b6194>] (vfs_ioctl+0x34/0xb4)
> [<800b6160>] (vfs_ioctl+0x0/0xb4) from [<800b6880>] (do_vfs_ioctl+0x56c/0x5b4)
>  r6:40986f00 r5:879f73c0 r4:7e85c9d8 r3:87a2e230
> [<800b6314>] (do_vfs_ioctl+0x0/0x5b4) from [<800b6908>] (sys_ioctl+0x40/0x64)
> [<800b68c8>] (sys_ioctl+0x0/0x64) from [<80029fc0>] (ret_fast_syscall+0x0/0x2c)
>  r7:00000036 r6:00000003 r5:7e85cba8 r4:7e85c9d8
> UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
> 2147479551:0, PEB 331
> UBI: run torture test for PEB 331

Strange. Your MTD device returned -EIO, probably you should check
whether you can write to your mtd device or not.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-26 13:14 ` Artem Bityutskiy
@ 2010-07-26 13:49   ` Arno Steffen
  2010-07-27 15:25     ` Artem Bityutskiy
  2010-07-30  6:23     ` Artem Bityutskiy
  0 siblings, 2 replies; 18+ messages in thread
From: Arno Steffen @ 2010-07-26 13:49 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

2010/7/26 Artem Bityutskiy <dedekind1@gmail.com>:
> On Mon, 2010-07-26 at 14:00 +0200, Arno Steffen wrote:
>> I just tried the howto (mount an empty UBI volume). But when I want to do
>> ubimkvol /dev/ubi0 -N test_vol -s 10MiB I get an error message:
>> libubi: error!: "/dev/ubi0" is not a character device
>> ubimkvol: error!: error while probing "/dev/ubi0"
>>           error 22 (Invalid argument)
>>
>> If I check /dev/ubi0 it is indeed a block device. But this has been
>> created by ubiattach which I used as howto
>> What is the problem????
>
> Your udev rules, perhaps? Creating device nodes is responsibility of
> your system, not UBI/ubi-utils.

My mtd8 is a character device as it should be.
crw-rw----    1 root     root      90,  16 Jan  1 00:00 /dev/mtd8

I don't know who is creating the device node, but it is avauilable
after ubiattach.
If it is done by udev - how to control it and change it's behaviour?
I can delete the device node and create one manually as described by
free_electrons.

cat /sys/class/ubi/ubi0/dev (e.g. 253:0)
mknod /dev/ubi0 c 253 0

Calling ubimkvol then creates a lot of other errors. (see below)

>
>> ( I tried to set the device as a char-device by
>>
>> [root@or:/]# ll /dev/ub*
>> brw-rw----    1 root     root     253,   0 Jan  1 00:46 /dev/ubi0
>> crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
>> [root@or:/]# rm /dev/ubi0
>> [root@or:/]# mknod /dev/ubi0 c 253 0
>>
>> But than I get other error messages:
>>
>> [root@or:/]# ubimkvol /dev/ubi0 -N test -s 10MiB
>> UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
>> 331:512, written 0 bytes
>> Backtrace:
>> [<8002d558>] (dump_backtrace+0x0/0x10c) from [<80267dac>] (dump_stack+0x18/0x1c)
>>  r6:0000014b r5:fffffffb r4:87a19800 r3:00000002
>> [<80267d94>] (dump_stack+0x0/0x1c) from [<801bb084>] (ubi_io_write+0x308/0x384)
>> [<801bad7c>] (ubi_io_write+0x0/0x384) from [<801bb228>]
>> (ubi_io_write_vid_hdr+0x128/0x144)
>> [<801bb100>] (ubi_io_write_vid_hdr+0x0/0x144) from [<801b9114>]
>> (ubi_eba_write_leb+0x550/0x758)
>>  r6:87928400 r5:879dde00 r4:87a19800
>> [<801b8bc4>] (ubi_eba_write_leb+0x0/0x758) from [<801b1560>]
>> (ubi_change_vtbl_record+0xf4/0x158)
>> [<801b146c>] (ubi_change_vtbl_record+0x0/0x158) from [<801b2d74>]
>> (ubi_create_volume+0x51c/0x6c0)
>>  r7:87a19800 r6:87a73d2c r5:87928200 r4:879282a0
>> [<801b2858>] (ubi_create_volume+0x0/0x6c0) from [<801b56f4>]
>> (ubi_cdev_ioctl+0x1f4/0x96c)
>> [<801b5500>] (ubi_cdev_ioctl+0x0/0x96c) from [<800b6194>] (vfs_ioctl+0x34/0xb4)
>> [<800b6160>] (vfs_ioctl+0x0/0xb4) from [<800b6880>] (do_vfs_ioctl+0x56c/0x5b4)
>>  r6:40986f00 r5:879f73c0 r4:7e85c9d8 r3:87a2e230
>> [<800b6314>] (do_vfs_ioctl+0x0/0x5b4) from [<800b6908>] (sys_ioctl+0x40/0x64)
>> [<800b68c8>] (sys_ioctl+0x0/0x64) from [<80029fc0>] (ret_fast_syscall+0x0/0x2c)
>>  r7:00000036 r6:00000003 r5:7e85cba8 r4:7e85c9d8
>> UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
>> 2147479551:0, PEB 331
>> UBI: run torture test for PEB 331
>
> Strange. Your MTD device returned -EIO, probably you should check
> whether you can write to your mtd device or not.
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>

Yes, the mtd is in general writable. Not sure if it is still after ubiattach.
Another try was to flash a ubi.img, but it will not mount again.

ubiattach /dev/ubi_ctrl -m 8
UBI: attaching mtd8 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 warning: ubi_eba_init_scan: cannot reserve enough PEBs for bad PEB
handling, reserved 1, need 3
UBI: attached mtd8 to ubi0
UBI: MTD device name:            "extra"
UBI: MTD device size:            41 MiB
UBI: number of good PEBs:        331
UBI: number of bad PEBs:         1
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 331
UBI: number of PEBs reserved for bad PEB handling: 1
UBI: max/mean erase counter: 1/0
UBI: image sequence number: 228182237
UBI: background thread "ubi_bgt0d" started, PID 367
UBI device number 0, total 331 LEBs (42706944 bytes, 40.7 MiB),
available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
[root@or:/]#
[root@or:/]# ls -l /dev/ubi*
brw-rw----    1 root     root     253,   0 Jan  1 00:13 /dev/ubi0
brw-rw----    1 root     root     253,   1 Jan  1 00:13 /dev/ubi0_0
crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
[root@or:/]# mount -t ubifs /dev/ubi0_0 /tmp
mount: mounting /dev/ubi0_0 on /tmp failed: No such device

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-26 13:49   ` Arno Steffen
@ 2010-07-27 15:25     ` Artem Bityutskiy
  2010-07-28 11:04       ` Arno Steffen
  2010-07-30  6:23     ` Artem Bityutskiy
  1 sibling, 1 reply; 18+ messages in thread
From: Artem Bityutskiy @ 2010-07-27 15:25 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

On Mon, 2010-07-26 at 15:49 +0200, Arno Steffen wrote:
> [root@or:/]# mount -t ubifs /dev/ubi0_0 /tmp
> mount: mounting /dev/ubi0_0 on /tmp failed: No such device

Try mount -t ubifs ubi0_0 /tmp

Mounting by character device was added only recently, probably your
kernel is older?

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-27 15:25     ` Artem Bityutskiy
@ 2010-07-28 11:04       ` Arno Steffen
  2010-07-30  6:35         ` Artem Bityutskiy
  0 siblings, 1 reply; 18+ messages in thread
From: Arno Steffen @ 2010-07-28 11:04 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

Thanks Artem,
I am using a 2.6.33 kernel, this should be new enough. It is right,
that it is as a block device (in  /dev/ ) ?

[root@or:/]# ubiattach /dev/ubi_ctrl -m 8 -d 8
UBI: attaching mtd8 to ubi8
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 warning: ubi_eba_init_scan: cannot reserve enough PEBs for bad PEB
handling, reserved 1, need 3
UBI: attached mtd8 to ubi8
UBI: MTD device name:            "extra"
UBI: MTD device size:            41 MiB
UBI: number of good PEBs:        331
UBI: number of bad PEBs:         1
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 331
UBI: number of PEBs reserved for bad PEB handling: 1
UBI: max/mean erase counter: 1/0
UBI: image sequence number: 228182237
UBI: background thread "ubi_bgt8d" started, PID 386
UBI device number 8, total 331 LEBs (42706944 bytes, 40.7 MiB),
available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
[root@or:/]# ll /dev/ubi*
brw-rw----    1 root     root     253,   0 Jan  1 00:00 /dev/ubi8
brw-rw----    1 root     root     253,   1 Jan  1 00:00 /dev/ubi8_0
crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
[root@or:/]#
[root@or:/]# mount -t ubifs /dev/ubi8 /tmp
mount: mounting /dev/ubi8 on /tmp failed: No such device
[root@or:/]# mount -t ubifs /dev/ubi8_0 /tmp
mount: mounting /dev/ubi8_0 on /tmp failed: No such device
[root@or:/]# mount -t ubifs ubi8_0 /tmp
mount: mounting ubi8_0 on /tmp failed: No such device
[root@or:/]# mount -t ubifs ubi8 /tmp
mount: mounting ubi8 on /tmp failed: No such device

(of cource /tmp is available rwx for all)


2010/7/27 Artem Bityutskiy <dedekind1@gmail.com>:
> On Mon, 2010-07-26 at 15:49 +0200, Arno Steffen wrote:
>> [root@or:/]# mount -t ubifs /dev/ubi0_0 /tmp
>> mount: mounting /dev/ubi0_0 on /tmp failed: No such device
>
> Try mount -t ubifs ubi0_0 /tmp
>
> Mounting by character device was added only recently, probably your
> kernel is older?
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-26 13:49   ` Arno Steffen
  2010-07-27 15:25     ` Artem Bityutskiy
@ 2010-07-30  6:23     ` Artem Bityutskiy
  1 sibling, 0 replies; 18+ messages in thread
From: Artem Bityutskiy @ 2010-07-30  6:23 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

On Mon, 2010-07-26 at 15:49 +0200, Arno Steffen wrote:
> > Your udev rules, perhaps? Creating device nodes is responsibility of
> > your system, not UBI/ubi-utils.
> 
> My mtd8 is a character device as it should be.
> crw-rw----    1 root     root      90,  16 Jan  1 00:00 /dev/mtd8
> 
> I don't know who is creating the device node, but it is avauilable
> after ubiattach.
> If it is done by udev - how to control it and change it's behaviour?
> I can delete the device node and create one manually as described by
> free_electrons.

When UBI registers character devices, the generic linux chdev code sends
an uevent to user-space. This uevent event contains the information
about what was created, major/minor of that, etc.

In user-space there is udevd, which is listening on a netlink socket,
and handles the uevents. There are udev rules which describe how to
handle events, the rules are usually at /etc/udev/rules.d/

So, I suspect that one of your rules is screwed.

You should use udevmonitor and take a look at the events and how they
are handled. And google a bit, perhaps. udev has nothing to do with UBI.
And I do not know much about udev.

> cat /sys/class/ubi/ubi0/dev (e.g. 253:0)
> mknod /dev/ubi0 c 253 0

This looks correct

> Calling ubimkvol then creates a lot of other errors. (see below)

This is strange.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-28 11:04       ` Arno Steffen
@ 2010-07-30  6:35         ` Artem Bityutskiy
  2010-08-05 11:55           ` Arno Steffen
  0 siblings, 1 reply; 18+ messages in thread
From: Artem Bityutskiy @ 2010-07-30  6:35 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

On Wed, 2010-07-28 at 13:04 +0200, Arno Steffen wrote:
> Thanks Artem,
> I am using a 2.6.33 kernel, this should be new enough. It is right,
> that it is as a block device (in  /dev/ ) ?

No, _all_ UBI devices are character devices. New UBIFS can mount these
character devices, old UBIFS cannot, and requires deviceless mounting.

As documented here:

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mount_ubifs

2.6.33 indeed should be able to mount /dev/ubi0_0.

But because your system is strange in a way that your UBI devices are
block devices, this does not work.

> [root@or:/]# ubiattach /dev/ubi_ctrl -m 8 -d 8
> UBI: attaching mtd8 to ubi8
> 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 warning: ubi_eba_init_scan: cannot reserve enough PEBs for bad PEB
> handling, reserved 1, need 3
> UBI: attached mtd8 to ubi8
> UBI: MTD device name:            "extra"
> UBI: MTD device size:            41 MiB
> UBI: number of good PEBs:        331
> UBI: number of bad PEBs:         1
> UBI: max. allowed volumes:       128
> UBI: wear-leveling threshold:    4096
> UBI: number of internal volumes: 1
> UBI: number of user volumes:     1
> UBI: available PEBs:             0
> UBI: total number of reserved PEBs: 331
> UBI: number of PEBs reserved for bad PEB handling: 1
> UBI: max/mean erase counter: 1/0
> UBI: image sequence number: 228182237
> UBI: background thread "ubi_bgt8d" started, PID 386
> UBI device number 8, total 331 LEBs (42706944 bytes, 40.7 MiB),
> available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
> [root@or:/]# ll /dev/ubi*
> brw-rw----    1 root     root     253,   0 Jan  1 00:00 /dev/ubi8
> brw-rw----    1 root     root     253,   1 Jan  1 00:00 /dev/ubi8_0
> crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl

Wrong. Everything has to be character devices.

> [root@or:/]#
> [root@or:/]# mount -t ubifs /dev/ubi8 /tmp
> mount: mounting /dev/ubi8 on /tmp failed: No such device
> [root@or:/]# mount -t ubifs /dev/ubi8_0 /tmp
> mount: mounting /dev/ubi8_0 on /tmp failed: No such device

These do not work because /dev/ubi* have to be chdev.

> [root@or:/]# mount -t ubifs ubi8_0 /tmp
> mount: mounting ubi8_0 on /tmp failed: No such device
> [root@or:/]# mount -t ubifs ubi8 /tmp
> mount: mounting ubi8 on /tmp failed: No such device

Do you have volume 0 on ubi8?

Please, send me ls /sys/class/ubi/ and ls /sys/class/ubi/ubi8/

Also, please, check /proc/devices and make sure ubi is in "Character
devices" list.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-07-30  6:35         ` Artem Bityutskiy
@ 2010-08-05 11:55           ` Arno Steffen
  2010-08-05 13:23             ` twebb
                               ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Arno Steffen @ 2010-08-05 11:55 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

2010/7/30 Artem Bityutskiy <dedekind1@gmail.com>:
> On Wed, 2010-07-28 at 13:04 +0200, Arno Steffen wrote:
>> Thanks Artem,
>> I am using a 2.6.33 kernel, this should be new enough. It is right,
>> that it is as a block device (in  /dev/ ) ?
>
> No, _all_ UBI devices are character devices. New UBIFS can mount these
> character devices, old UBIFS cannot, and requires deviceless mounting.
>
> As documented here:
>
> http://www.linux-mtd.infradead.org/faq/ubifs.html#L_mount_ubifs
>
> 2.6.33 indeed should be able to mount /dev/ubi0_0.
>
> But because your system is strange in a way that your UBI devices are
> block devices, this does not work.
>
>> [root@or:/]# ubiattach /dev/ubi_ctrl -m 8 -d 8
>> UBI: attaching mtd8 to ubi8
>> 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 warning: ubi_eba_init_scan: cannot reserve enough PEBs for bad PEB
>> handling, reserved 1, need 3
>> UBI: attached mtd8 to ubi8
>> UBI: MTD device name:            "extra"
>> UBI: MTD device size:            41 MiB
>> UBI: number of good PEBs:        331
>> UBI: number of bad PEBs:         1
>> UBI: max. allowed volumes:       128
>> UBI: wear-leveling threshold:    4096
>> UBI: number of internal volumes: 1
>> UBI: number of user volumes:     1
>> UBI: available PEBs:             0
>> UBI: total number of reserved PEBs: 331
>> UBI: number of PEBs reserved for bad PEB handling: 1
>> UBI: max/mean erase counter: 1/0
>> UBI: image sequence number: 228182237
>> UBI: background thread "ubi_bgt8d" started, PID 386
>> UBI device number 8, total 331 LEBs (42706944 bytes, 40.7 MiB),
>> available 0 LEBs (0 bytes), LEB size 129024 bytes (126.0 KiB)
>> [root@or:/]# ll /dev/ubi*
>> brw-rw----    1 root     root     253,   0 Jan  1 00:00 /dev/ubi8
>> brw-rw----    1 root     root     253,   1 Jan  1 00:00 /dev/ubi8_0
>> crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
>
> Wrong. Everything has to be character devices.
>
>> [root@or:/]#
>> [root@or:/]# mount -t ubifs /dev/ubi8 /tmp
>> mount: mounting /dev/ubi8 on /tmp failed: No such device
>> [root@or:/]# mount -t ubifs /dev/ubi8_0 /tmp
>> mount: mounting /dev/ubi8_0 on /tmp failed: No such device
>
> These do not work because /dev/ubi* have to be chdev.
>
>> [root@or:/]# mount -t ubifs ubi8_0 /tmp
>> mount: mounting ubi8_0 on /tmp failed: No such device
>> [root@or:/]# mount -t ubifs ubi8 /tmp
>> mount: mounting ubi8 on /tmp failed: No such device
>
> Do you have volume 0 on ubi8?
>
> Please, send me ls /sys/class/ubi/ and ls /sys/class/ubi/ubi8/
>
> Also, please, check /proc/devices and make sure ubi is in "Character
> devices" list.
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>

Thanks Artem for your mail. To answer you requests:

[root@or:/]# ls -l /sys/class/ubi/
lrwxrwxrwx    1 root     root            0 Jan  1 00:00 ubi8 ->
../../devices/virtual/ubi/ubi8
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 ubi8_0 ->
../../devices/virtual/ubi/ubi8/ubi8_0
-r--r--r--    1 root     root         4096 Jan  1 00:00 version
[root@or:/]# ls -l /sys/class/ubi/ubi8/
-r--r--r--    1 root     root         4096 Jan  1 00:00 avail_eraseblocks
-r--r--r--    1 root     root         4096 Jan  1 00:00 bad_peb_count
-r--r--r--    1 root     root         4096 Jan  1 00:01 bgt_enabled
-r--r--r--    1 root     root         4096 Jan  1 00:00 dev
-r--r--r--    1 root     root         4096 Jan  1 00:00 eraseblock_size
-r--r--r--    1 root     root         4096 Jan  1 00:00 max_ec
-r--r--r--    1 root     root         4096 Jan  1 00:00 max_vol_count
-r--r--r--    1 root     root         4096 Jan  1 00:00 min_io_size
-r--r--r--    1 root     root         4096 Jan  1 00:01 mtd_num
drwxr-xr-x    2 root     root            0 Jan  1 00:01 power
-r--r--r--    1 root     root         4096 Jan  1 00:00 reserved_for_bad
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 subsystem ->
../../../../class/ubi
-r--r--r--    1 root     root         4096 Jan  1 00:00 total_eraseblocks
drwxr-xr-x    3 root     root            0 Jan  1 00:00 ubi8_0
-rw-r--r--    1 root     root         4096 Jan  1 00:01 uevent
-r--r--r--    1 root     root         4096 Jan  1 00:01 volumes_count
[root@or:/]# ls -l /dev/u*
brw-rw----    1 root     root     252,   0 Jan  1 00:00 /dev/ubi8
brw-rw----    1 root     root     252,   1 Jan  1 00:00 /dev/ubi8_0
crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl
cr--r--r--    1 root     root       1,   9 Jan  1 00:00 /dev/urandom

cat /proc/devices give me back, that  (252 ubi8) is a character device.
But looking above, in /dev it is listed as block device !?!

For me creating entries are not transparent, this happend with
ubiattach. No idea how to force ubiattach to write ubi8 in the
devicelist as character device.
Best regards
Arno

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-05 11:55           ` Arno Steffen
@ 2010-08-05 13:23             ` twebb
  2010-08-05 13:36             ` Artem Bityutskiy
       [not found]             ` <AANLkTikkRNqnEX0PkHigv=zT+Z36J52DEtoVeMGbBExf@mail.gmail.com>
  2 siblings, 0 replies; 18+ messages in thread
From: twebb @ 2010-08-05 13:23 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd, dedekind1

>
> cat /proc/devices give me back, that  (252 ubi8) is a character device.
> But looking above, in /dev it is listed as block device !?!
>
> For me creating entries are not transparent, this happend with
> ubiattach. No idea how to force ubiattach to write ubi8 in the
> devicelist as character device.
> Best regards
> Arno
>

I see similar oddities on my 2.6.29 kernel with UBI.  ls shows ubi
devices as blocks, but /proc/devices shows then as char devices.

[/]#
[/]# ls -l /dev/ubi*
brw-rw----    1 root     root     250,   0 Aug  5 12:53 /dev/ubi0
brw-rw----    1 root     root     250,   1 Aug  5 12:53 /dev/ubi0_0
brw-rw----    1 root     root     250,   2 Aug  5 12:53 /dev/ubi0_1
brw-rw----    1 root     root     250,   3 Aug  5 12:53 /dev/ubi0_2
brw-rw----    1 root     root     250,   4 Aug  5 12:53 /dev/ubi0_3
crw-rw----    1 root     root      10,  62 Aug  5 12:53 /dev/ubi_ctrl
[/]#
[/]# cat /proc/devices
Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
 14 sound
 29 fb
 81 video4linux
 90 mtd
108 ppp
116 alsa
128 ptm
136 pts
180 usb
188 ttyUSB
189 usb_device
216 rfcomm
250 ubi0
251 usb_endpoint
252 usbmon
253 ttyHS
254 rtc

Block devices:
  1 ramdisk
259 blkext
  7 loop
  8 sd
 31 mtdblock
 65 sd
 66 sd
 67 sd
 68 sd
 69 sd
 70 sd
 71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
179 mmc
[/]#

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-05 11:55           ` Arno Steffen
  2010-08-05 13:23             ` twebb
@ 2010-08-05 13:36             ` Artem Bityutskiy
       [not found]             ` <AANLkTikkRNqnEX0PkHigv=zT+Z36J52DEtoVeMGbBExf@mail.gmail.com>
  2 siblings, 0 replies; 18+ messages in thread
From: Artem Bityutskiy @ 2010-08-05 13:36 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

On Thu, 2010-08-05 at 13:55 +0200, Arno Steffen wrote:
> cat /proc/devices give me back, that  (252 ubi8) is a character device.

Ok.

> But looking above, in /dev it is listed as block device !?!

udev!?!

> For me creating entries are not transparent, this happend with
> ubiattach. No idea how to force ubiattach to write ubi8 in the
> devicelist as character device.

I thought I explained how udev works briefly. I also suggested you
udevmonitor, you can also google. Neither UBI nor ubiattach nor any
other ubi utility should create any /dev device.

Sorry, I cannot provide more help. Try to dig this yourself - there are:
many ways. You can add printks to the kernel. You can even do echo 1
> /proc/sys/vm/block_dump and find out which process creates /dev
entries. Hey, be creative, do not wait that others will solve your
issues! :-)

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
       [not found]             ` <AANLkTikkRNqnEX0PkHigv=zT+Z36J52DEtoVeMGbBExf@mail.gmail.com>
@ 2010-08-16 11:27               ` Arno Steffen
  2010-08-23 12:34                 ` Artem Bityutskiy
  0 siblings, 1 reply; 18+ messages in thread
From: Arno Steffen @ 2010-08-16 11:27 UTC (permalink / raw)
  To: twebb, dedekind1, linux-mtd

2010/8/6 twebb <taliaferro62@gmail.com>:
>>
>> cat /proc/devices give me back, that  (252 ubi8) is a character device.
>> But looking above, in /dev it is listed as block device !?!
>>
>> For me creating entries are not transparent, this happend with
>> ubiattach. No idea how to force ubiattach to write ubi8 in the
>> devicelist as character device.
>> Best regards
>> Arno
>>
>
> Have you gotten anywhere on this problem?  I have looked and have not
> found the udev rules anywhere.
>
> Thanks,
> twebb
>

Sorry for delay, have been out of office.
Haven't found neither /etc/udev nor /lib/udev on my embedded system.
udev is not mention in dmesg | grep udev
But after creating /etc/udev/rules/10-udev.rules I could see this in
 cat /dev/udev/rules.d/10-udev.rules
As I don't have any idea what rule I have to write in I left it blank.
So no success with this method

Other way like in : free-electrons.com/doc/training/embedded-linux/slides.pdf

cat /sys/class/ubi/ubi0/dev
252:0
rm /dev/ubi0
mknod /dev/ubi0 c 252 0
ll /dev/ubi*
crw-r--r--    1 root     root     252,   0 Jan  1 00:04 /dev/ubi0
crw-rw----    1 root     root      10,  63 Jan  1 00:00 /dev/ubi_ctrl

-> looks good so far. But finally I am screwed:

ubimkvol /dev/ubi0 -N test -m
Set volume size to 9805824UBI error: ubi_io_write: error -5 while
writing 512 bytes to PEB 81:512, written 0 bytes

UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
2147479551:0, PEB 81
UBI: run torture test for PEB 81
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
0:512, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
2147479551:0, PEB 0
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
80:512, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
2147479551:0, PEB 80
UBI: try another PEB
UBI error: ubi_io_write: error -5 while writing 512 bytes to PEB
79:512, written 0 bytes
UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
2147479551:0, PEB 79
UBI warning: ubi_ro_mode: switch to read-only mode
UBI error: ubi_io_write: read-only mode
UBI error: ubi_create_volume: cannot create volume 0, error -30
ubimkvol: error!: cannot UBI creUBI error: erase_worker: failed to
erase PEB 81, error -30
ate volume
          error 30 (UBI error: do_work: work failed with error code -30
Read-only file system)
[root@ViUBI error: ubi_thread: ubi_bgt0d: work failed with error code -30
sor:/]#

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-16 11:27               ` Arno Steffen
@ 2010-08-23 12:34                 ` Artem Bityutskiy
  2010-08-23 14:13                   ` Arno Steffen
  0 siblings, 1 reply; 18+ messages in thread
From: Artem Bityutskiy @ 2010-08-23 12:34 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd, twebb

On Mon, 2010-08-16 at 13:27 +0200, Arno Steffen wrote:
> Sorry for delay, have been out of office.
> Haven't found neither /etc/udev nor /lib/udev on my embedded system.
> udev is not mention in dmesg | grep udev
> But after creating /etc/udev/rules/10-udev.rules I could see this in
>  cat /dev/udev/rules.d/10-udev.rules
> As I don't have any idea what rule I have to write in I left it blank.
> So no success with this method

OK, anyway, I believe this is not related to UBI. I gave you several
other ideas, cannot help more than that.

> ubimkvol /dev/ubi0 -N test -m
> Set volume size to 9805824UBI error: ubi_io_write: error -5 while
> writing 512 bytes to PEB 81:512, written 0 bytes
> 
> UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
> 2147479551:0, PEB 81

This is independent problem, I think. Your driver returns EIO when UBI
writes to the flash. Looks like you have issues in the driver or HW
level.

Did you run mtd tests? Please run and validate your flash. Take a look
here, for reference:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_how_send_bugreport

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-23 12:34                 ` Artem Bityutskiy
@ 2010-08-23 14:13                   ` Arno Steffen
  2010-08-23 14:41                     ` Artem Bityutskiy
  0 siblings, 1 reply; 18+ messages in thread
From: Arno Steffen @ 2010-08-23 14:13 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd, twebb

2010/8/23 Artem Bityutskiy <dedekind1@gmail.com>:
> On Mon, 2010-08-16 at 13:27 +0200, Arno Steffen wrote:
>> Sorry for delay, have been out of office.
>> Haven't found neither /etc/udev nor /lib/udev on my embedded system.
>> udev is not mention in dmesg | grep udev
>> But after creating /etc/udev/rules/10-udev.rules I could see this in
>>  cat /dev/udev/rules.d/10-udev.rules
>> As I don't have any idea what rule I have to write in I left it blank.
>> So no success with this method
>
> OK, anyway, I believe this is not related to UBI. I gave you several
> other ideas, cannot help more than that.
>
>> ubimkvol /dev/ubi0 -N test -m
>> Set volume size to 9805824UBI error: ubi_io_write: error -5 while
>> writing 512 bytes to PEB 81:512, written 0 bytes
>>
>> UBI warning: ubi_eba_write_leb: failed to write VID header to LEB
>> 2147479551:0, PEB 81
>
> This is independent problem, I think. Your driver returns EIO when UBI
> writes to the flash. Looks like you have issues in the driver or HW
> level.
>
> Did you run mtd tests? Please run and validate your flash. Take a look
> here, for reference:
>
> http://www.linux-mtd.infradead.org/doc/ubifs.html#L_how_send_bugreport
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>

My results are: (other will follow next day)

[root@or:/opt/configs]# insmod mtd_nandecctest.ko
mtd_nandecctest: ok - nand-ecc-256
mtd_nandecctest: ok - nand-ecc-512
[root@Visor:/opt/configs]# insmod mtd_oobtest.ko

=================================================
mtd_oobtest: MTD device: 0
mtd_oobtest: MTD device size 262144, eraseblock size 131072, page size
2048, count of eraseblocks 2, pages per eraseblock 64, OOB size 64
mtd_oobtest: scanning for bad eraseblocks
mtd_oobtest: scanned 2 eraseblocks, 0 are bad
mtd_oobtest: test 1 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: error -30 while erasing EB 0
mtd_oobtest: error -30 occurred
=================================================
insmod: cannot insert 'mtd_oobtest.ko': Read-only file system
[root@or:/opt/configs]# insmod mtd_pagetest.ko

=================================================
mtd_pagetest: MTD device: 0
mtd_pagetest: MTD device size 262144, eraseblock size 131072, page
size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
64
mtd_pagetest: scanning for bad eraseblocks
mtd_pagetest: scanned 2 eraseblocks, 0 are bad
mtd_pagetest: erasing whole device
mtd_pagetest: error -30 while erasing EB 0
mtd_pagetest: error -30 occurred
=================================================
insmod: cannot insert 'mtd_pagetest.ko': Read-only file system
[root@or:/opt/configs]# insmod mtd_readtest.ko

=================================================
mtd_readtest: MTD device: 0
mtd_readtest: MTD device size 262144, eraseblock size 131072, page
size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
64
mtd_readtest: scanning for bad eraseblocks
mtd_readtest: scanned 2 eraseblocks, 0 are bad
mtd_readtest: testing page read
uncorrectable error :
uncorrectable error :
uncorrectable error :
mtd_readtest: error: read failed at 0x0
uncorrectable error :
uncorrectable error :
uncorrectable error :
uncorrectable error :
mtd_readtest: error: read failed at 0x800
uncorrectable error :

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-23 14:13                   ` Arno Steffen
@ 2010-08-23 14:41                     ` Artem Bityutskiy
  2010-08-24  8:32                       ` Arno Steffen
  0 siblings, 1 reply; 18+ messages in thread
From: Artem Bityutskiy @ 2010-08-23 14:41 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd, twebb

On Mon, 2010-08-23 at 16:13 +0200, Arno Steffen wrote:
> My results are: (other will follow next day)

... snip ...

> mtd_readtest: MTD device: 0
> mtd_readtest: MTD device size 262144, eraseblock size 131072, page
> size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
> 64
> mtd_readtest: scanning for bad eraseblocks
> mtd_readtest: scanned 2 eraseblocks, 0 are bad
> mtd_readtest: testing page read
> uncorrectable error :
> uncorrectable error :
> uncorrectable error :
> mtd_readtest: error: read failed at 0x0
> uncorrectable error :
> uncorrectable error :
> uncorrectable error :
> uncorrectable error :
> mtd_readtest: error: read failed at 0x800
> uncorrectable error :

They do not look very too well :-)

No wonder UBI hates your flash and refuses it.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-23 14:41                     ` Artem Bityutskiy
@ 2010-08-24  8:32                       ` Arno Steffen
  2010-08-24  8:53                         ` Artem Bityutskiy
  0 siblings, 1 reply; 18+ messages in thread
From: Arno Steffen @ 2010-08-24  8:32 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

2010/8/23 Artem Bityutskiy <dedekind1@gmail.com>:
> On Mon, 2010-08-23 at 16:13 +0200, Arno Steffen wrote:
>> My results are: (other will follow next day)
>
> ... snip ...
>
>> mtd_readtest: MTD device: 0
>> mtd_readtest: MTD device size 262144, eraseblock size 131072, page
>> size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
>> 64
>> mtd_readtest: scanning for bad eraseblocks
>> mtd_readtest: scanned 2 eraseblocks, 0 are bad
>> mtd_readtest: testing page read
>> uncorrectable error :
>> uncorrectable error :
>> uncorrectable error :
>> mtd_readtest: error: read failed at 0x0
>> uncorrectable error :
>> uncorrectable error :
>> uncorrectable error :
>> uncorrectable error :
>> mtd_readtest: error: read failed at 0x800
>> uncorrectable error :
>
> They do not look very too well :-)
>
> No wonder UBI hates your flash and refuses it.
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>

Please let me know, whether I used it right. I enabled in config
build test modules, "make modules" and copied this modules to my
embedded device. There I just typed insmod mtd_readtest.ko
As far as I could see it just accesses /dev/mtd0. This is read only
(Xloader and HW-ECC). Can this cause this problems? How to check other
parts of Flash. Couldn't found some docu to the test modules.

What does this mean:

mtd_readtest: finished with errors
mtd_readtest: error -74 occurred
=================================================
insmod: cannot insert 'mtd_readtest.ko': Bad message

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-24  8:32                       ` Arno Steffen
@ 2010-08-24  8:53                         ` Artem Bityutskiy
  2010-08-24  9:19                           ` Arno Steffen
  0 siblings, 1 reply; 18+ messages in thread
From: Artem Bityutskiy @ 2010-08-24  8:53 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

On Tue, 2010-08-24 at 10:32 +0200, Arno Steffen wrote:
> Please let me know, whether I used it right. I enabled in config
> build test modules, "make modules" and copied this modules to my
> embedded device. There I just typed insmod mtd_readtest.ko
> As far as I could see it just accesses /dev/mtd0. This is read only
> (Xloader and HW-ECC). Can this cause this problems? How to check other
> parts of Flash. Couldn't found some docu to the test modules.
> 
> What does this mean:
> 
> mtd_readtest: finished with errors
> mtd_readtest: error -74 occurred
> =================================================
> insmod: cannot insert 'mtd_readtest.ko': Bad message

Please, check modinfo mtd_readtest and notice there is a 'dev' parameter
which you can use to specify the mtd device to test. Use it.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-24  8:53                         ` Artem Bityutskiy
@ 2010-08-24  9:19                           ` Arno Steffen
  2010-08-24  9:33                             ` Artem Bityutskiy
  0 siblings, 1 reply; 18+ messages in thread
From: Arno Steffen @ 2010-08-24  9:19 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

2010/8/24 Artem Bityutskiy <dedekind1@gmail.com>:
> On Tue, 2010-08-24 at 10:32 +0200, Arno Steffen wrote:
>> Please let me know, whether I used it right. I enabled in config
>> build test modules, "make modules" and copied this modules to my
>> embedded device. There I just typed insmod mtd_readtest.ko
>> As far as I could see it just accesses /dev/mtd0. This is read only
>> (Xloader and HW-ECC). Can this cause this problems? How to check other
>> parts of Flash. Couldn't found some docu to the test modules.
>>
>> What does this mean:
>>
>> mtd_readtest: finished with errors
>> mtd_readtest: error -74 occurred
>> =================================================
>> insmod: cannot insert 'mtd_readtest.ko': Bad message
>
> Please, check modinfo mtd_readtest and notice there is a 'dev' parameter
> which you can use to specify the mtd device to test. Use it.
>
> --
> Best Regards,
> Artem Bityutskiy (Артём Битюцкий)
>
>

To late ... I immolate my Xloader and get some better looking results.
Also modinfo is not available on my system.
May I ask you to have a look at it. I can't really interpet some messgages.

[root@or:/opt/configs]# insmod mtd_nandecctest.ko
mtd_nandecctest: ok - nand-ecc-256
mtd_nandecctest: ok - nand-ecc-512
[root@or:/opt/configs]# insmod mtd_oobtest.ko

=================================================
mtd_oobtest: MTD device: 0
mtd_oobtest: MTD device size 262144, eraseblock size 131072, page size
2048, count of eraseblocks 2, pages per eraseblock 64, OOB size 64
mtd_oobtest: scanning for bad eraseblocks
mtd_oobtest: scanned 2 eraseblocks, 0 are bad
mtd_oobtest: test 1 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 2 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 2 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 2 eraseblocks
mtd_oobtest: test 2 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 2 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 2 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 2 eraseblocks
mtd_oobtest: test 3 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 2 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 2 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 2 eraseblocks
mtd_oobtest: test 4 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 2 eraseblocks
mtd_oobtest: attempting to start write past end of OOB
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to start read past end of OOB
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to write past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to read past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error: read past end of device
mtd_oobtest: attempting to write past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error occurred as expected
mtd_oobtest: attempting to read past end of device
mtd_oobtest: an error is expected...
mtd_oobtest: error: read past end of device
mtd_oobtest: test 5 of 5
mtd_oobtest: erasing whole device
mtd_oobtest: erased 2 eraseblocks
mtd_oobtest: writing OOBs of whole device
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written up to eraseblock 0
mtd_oobtest: written 1 eraseblocks
mtd_oobtest: verifying all eraseblocks
mtd_oobtest: verified up to eraseblock 0
mtd_oobtest: verified 1 eraseblocks
mtd_oobtest: finished with 2 errors
=================================================
[root@or:/opt/configs]# insmod mtd_readtest.ko

=================================================
mtd_readtest: MTD device: 0
mtd_readtest: MTD device size 262144, eraseblock size 131072, page
size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
64
mtd_readtest: scanning for bad eraseblocks
mtd_readtest: scanned 2 eraseblocks, 0 are bad
mtd_readtest: testing page read
mtd_readtest: finished
=================================================
[root@or:/opt/configs]# insmod mtd_pagetest.ko

=================================================
mtd_pagetest: MTD device: 0
mtd_pagetest: MTD device size 262144, eraseblock size 131072, page
size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
64
mtd_pagetest: scanning for bad eraseblocks
mtd_pagetest: scanned 2 eraseblocks, 0 are bad
mtd_pagetest: erasing whole device
mtd_pagetest: erased 2 eraseblocks
mtd_pagetest: writing whole device
mtd_pagetest: written up to eraseblock 0
mtd_pagetest: written 2 eraseblocks
mtd_pagetest: verifying all eraseblocks
mtd_pagetest: verified up to eraseblock 0
mtd_pagetest: verified 2 eraseblocks
mtd_pagetest: crosstest
mtd_pagetest: reading page at 0x0
mtd_pagetest: reading page at 0x3f800
mtd_pagetest: reading page at 0x0
mtd_pagetest: verifying pages read at 0x0 match
mtd_pagetest: crosstest ok
mtd_pagetest: erasecrosstest
mtd_pagetest: erasing block 0
mtd_pagetest: writing 1st page of block 0
mtd_pagetest: reading 1st page of block 0
mtd_pagetest: verifying 1st page of block 0
mtd_pagetest: erasing block 0
mtd_pagetest: writing 1st page of block 0
mtd_pagetest: erasing block 1
mtd_pagetest: reading 1st page of block 0
mtd_pagetest: verifying 1st page of block 0
mtd_pagetest: erasecrosstest ok
mtd_pagetest: erasetest
mtd_pagetest: erasing block 0
mtd_pagetest: writing 1st page of block 0
mtd_pagetest: erasing block 0
mtd_pagetest: reading 1st page of block 0
mtd_pagetest: verifying 1st page of block 0 is all 0xff
mtd_pagetest: erasetest ok
mtd_pagetest: finished with 0 errors
=================================================
[root@or:/opt/configs]# insmod mtd_speedtest.ko

=================================================
mtd_speedtest: MTD device: 0
mtd_speedtest: MTD device size 262144, eraseblock size 131072, page
size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
64
mtd_speedtest: scanning for bad eraseblocks
mtd_speedtest: scanned 2 eraseblocks, 0 are bad
mtd_speedtest: testing eraseblock write speed
mtd_speedtest: eraseblock write speed is 2509 KiB/s
mtd_speedtest: testing eraseblock read speed
mtd_speedtest: eraseblock read speed is 6095 KiB/s
mtd_speedtest: testing page write speed
mtd_speedtest: page write speed is 2534 KiB/s
mtd_speedtest: testing page read speed
mtd_speedtest: page read speed is 6095 KiB/s
mtd_speedtest: testing 2 page write speed
mtd_speedtest: 2 page write speed is 2534 KiB/s
mtd_speedtest: testing 2 page read speed
mtd_speedtest: 2 page read speed is 6095 KiB/s
mtd_speedtest: Testing erase speed
mtd_speedtest: erase speed is 256000 KiB/s
mtd_speedtest: finished
=================================================
[root@or:/opt/configs]# insmod mtd_subpagetest.ko

=================================================
mtd_subpagetest: MTD device: 0
mtd_subpagetest: MTD device size 262144, eraseblock size 131072, page
size 2048, subpage size 512, count of eraseblocks 0, pages per
eraseblock 0, OOB size 64
mtd_subpagetest: scanning for bad eraseblocks
mtd_subpagetest: scanned 2 eraseblocks, 0 are bad
mtd_subpagetest: erasing whole device
mtd_subpagetest: erased 2 eraseblocks
mtd_subpagetest: writing whole device
mtd_subpagetest: error: write failed at 0x200
mtd_subpagetest:   write size: 0x200
mtd_subpagetest:   written: 0x0
mtd_subpagetest: error -5 occurred
=================================================
insmod: cannot insert 'mtd_subpagetest.ko': Input/output error
[root@or:/opt/configs]# insmod mtd_stresstest.ko

=================================================
mtd_stresstest: MTD device: 0
mtd_stresstest: MTD device size 262144, eraseblock size 131072, page
size 2048, count of eraseblocks 2, pages per eraseblock 64, OOB size
64
mtd_stresstest: scanning for bad eraseblocks
mtd_stresstest: scanned 2 eraseblocks, 0 are bad
mtd_stresstest: doing operations
mtd_stresstest: 0 operations done
mtd_stresstest: 1024 operations done
mtd_stresstest: 2048 operations done
mtd_stresstest: 3072 operations done
mtd_stresstest: 4096 operations done
mtd_stresstest: 5120 operations done
mtd_stresstest: 6144 operations done
mtd_stresstest: 7168 operations done
mtd_stresstest: 8192 operations done
mtd_stresstest: 9216 operations done
mtd_stresstest: finished, 10000 operations done
=================================================

[root@or:/opt/configs]# insmod mtd_subpagetest.ko

=================================================
mtd_subpagetest: MTD device: 0
mtd_subpagetest: MTD device size 262144, eraseblock size 131072, page
size 2048, subpage size 512, count of eraseblocks 0, pages per
eraseblock 0, OOB size 64
mtd_subpagetest: scanning for bad eraseblocks
mtd_subpagetest: scanned 2 eraseblocks, 0 are bad
mtd_subpagetest: erasing whole device
mtd_subpagetest: erased 2 eraseblocks
mtd_subpagetest: writing whole device
mtd_subpagetest: error: write failed at 0x200
mtd_subpagetest:   write size: 0x200
mtd_subpagetest:   written: 0x0
mtd_subpagetest: error -5 occurred
=================================================
insmod: cannot insert 'mtd_subpagetest.ko': Input/output error
[root@or:/opt/configs]# insmod mtd_torturetest.ko

=================================================
mtd_torturetest: Warning: this program is trying to wear out your
flash, stop it if this is not wanted.
mtd_torturetest: MTD device: 0
mtd_torturetest: torture 32 eraseblocks (8-39) of mtd0
mtd_torturetest: write verify enabled
mtd_torturetest: block_isbad() returned -22 for EB 8
mtd_torturetest: finished after 0 erase cycles
mtd_torturetest: error -22 occurred during torturing
=================================================
insmod: cannot insert 'mtd_torturetest.ko': invalid parameters

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: error!: "/dev/ubi0" is not a character device ?!?
  2010-08-24  9:19                           ` Arno Steffen
@ 2010-08-24  9:33                             ` Artem Bityutskiy
  0 siblings, 0 replies; 18+ messages in thread
From: Artem Bityutskiy @ 2010-08-24  9:33 UTC (permalink / raw)
  To: Arno Steffen; +Cc: linux-mtd

> May I ask you to have a look at it. I can't really interpet some
> messgages.

I can't give you that level of support, sorry. You need to look into the
source code and debug stuff, or ask for support from your kernel or HW
verndor. Just quick notes: when module insmods without error, it is
success. Otherwise - failure.

On Tue, 2010-08-24 at 11:19 +0200, Arno Steffen wrote:
> =================================================
> mtd_subpagetest: MTD device: 0
> mtd_subpagetest: MTD device size 262144, eraseblock size 131072, page
> size 2048, subpage size 512, count of eraseblocks 0, pages per
> eraseblock 0, OOB size 64
> mtd_subpagetest: scanning for bad eraseblocks
> mtd_subpagetest: scanned 2 eraseblocks, 0 are bad
> mtd_subpagetest: erasing whole device
> mtd_subpagetest: erased 2 eraseblocks
> mtd_subpagetest: writing whole device
> mtd_subpagetest: error: write failed at 0x200
> mtd_subpagetest:   write size: 0x200
> mtd_subpagetest:   written: 0x0
> mtd_subpagetest: error -5 occurred
> =================================================
> insmod: cannot insert 'mtd_subpagetest.ko': Input/output error
> [root@or:/opt/configs]# insmod mtd_stresstest.ko

Your flash driver reports it supports sub-pages, but this is a lie and
it does not. Writing a sub-page results in an error. Dig the driver.

> =================================================
> mtd_torturetest: Warning: this program is trying to wear out your
> flash, stop it if this is not wanted.
> mtd_torturetest: MTD device: 0
> mtd_torturetest: torture 32 eraseblocks (8-39) of mtd0
> mtd_torturetest: write verify enabled
> mtd_torturetest: block_isbad() returned -22 for EB 8
> mtd_torturetest: finished after 0 erase cycles
> mtd_torturetest: error -22 occurred during torturing
> =================================================
> insmod: cannot insert 'mtd_torturetest.ko': invalid parameters 

Dunno, you need to debug your driver.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-08-24  9:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 12:00 error!: "/dev/ubi0" is not a character device ?!? Arno Steffen
2010-07-26 13:14 ` Artem Bityutskiy
2010-07-26 13:49   ` Arno Steffen
2010-07-27 15:25     ` Artem Bityutskiy
2010-07-28 11:04       ` Arno Steffen
2010-07-30  6:35         ` Artem Bityutskiy
2010-08-05 11:55           ` Arno Steffen
2010-08-05 13:23             ` twebb
2010-08-05 13:36             ` Artem Bityutskiy
     [not found]             ` <AANLkTikkRNqnEX0PkHigv=zT+Z36J52DEtoVeMGbBExf@mail.gmail.com>
2010-08-16 11:27               ` Arno Steffen
2010-08-23 12:34                 ` Artem Bityutskiy
2010-08-23 14:13                   ` Arno Steffen
2010-08-23 14:41                     ` Artem Bityutskiy
2010-08-24  8:32                       ` Arno Steffen
2010-08-24  8:53                         ` Artem Bityutskiy
2010-08-24  9:19                           ` Arno Steffen
2010-08-24  9:33                             ` Artem Bityutskiy
2010-07-30  6:23     ` Artem Bityutskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.