Failed write on /dev/mtd0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Failed write on /dev/mtd0

Jump to solution
10,250 Views
BrilliantovKiri
Senior Contributor I

Hello!

Our board have one Micron (2Gb, x16, 1.8) NAND chip, I add NAND chip description in Linux and configure partitions table in board-specific file, also I add initrd support. After this I rebuild Linux and burn it via MFG tool in memory. After booting Linux I logged in system via SSH and check partitions tabel via /proc/partitions - it correct.

Now I need write U-Boot and Linux on NAND, for this I use kobs-ng version : [ 1.2 ] nad nandwrite 1.5.0.

I try write U-Boot:

~ # echo 1 > /sys/devices/platform/mxc_nandv2_flash.0/ignorebad

~ # cat /sys/devices/platform/mxc_nandv2_flash.0/ignorebad

1

~ # ./kobs-ng init --chip_0_device_path=/dev/mtd0 u-boot.bin

mtd: device "/dev/mtd0" can't be opened

Unable to open mtd device(s)

kobs-ng version : [ 1.2 ]

ROM Version 2

This is a very strange because I root.

I try use nandwrite, but this is not solve problem:

~ # ./nandwrite -mp /dev/mtd0 u-boot.bin

nandwrite: error!: /dev/mtd0

       error 13 (Permission denied)

~ # ./kobs-ng dump -v

MTD CONFIG:

  chip_0_device_path = "/dev/mtd0"

  chip_1_device_path = "(null)"

  search_exponent = 2

  data_setup_time = 80

  data_hold_time = 60

  address_setup_time = 25

data_sample_time = 6

  row_address_size = 3

  column_address_size = 2

  read_command_code1 = 0

  read_command_code2 = 48

  boot_stream_major_version = 1

  boot_stream_minor_version = 0

  boot_stream_sub_version = 0

  ncb_version = 3

  boot_stream_1_address = 0

  boot_stream_2_address = 0

mtd: opening: "/dev/mtd0"

mtd: device "/dev/mtd0" can't be opened

Unable to open mtd device(s)

kobs-ng version : [ 1.2 ]

ROM Version 2

~ # ./kobs-ng imgverify -v u-boot.bin

u-boot.bin: verifying using key '00000000000000000000000000000000'

u-boot.bin: is a valid bootstream for key '00000000000000000000000000000000'

Why I can't write on /dev/mtd0 and how can I solve this problem?

Thank you and excuse me my bad english.

Labels (2)
Tags (1)
0 Kudos
1 Solution
4,347 Views
israelpz
Senior Contributor I

Hi,

Try to erase the partition with flash_eraseall command.

After you erase the partition try again with kobs-ng.

By the way which i.MX are you using?

Regards,

-Israel.

View solution in original post

0 Kudos
2 Replies
4,345 Views
BrilliantovKiri
Senior Contributor I

Another strange fact - I can write on /dev/mtd2 and above, I try kobs-ng and nandwrite.

~ # ls -l /sys/devices/platform/mxc_nandv2_flash.0/

-rw-r--r--1 root root      4096 Jan  1 00:01 disable_bi_swap
lrwxrwxrwx1 root root         0 Jan  1 00:07 driver -> ../../../bus/platform/drivers/mxc_nandv2_flash
-rw-r--r--1 root root      4096 Jan  1 00:01 ignorebad
-r--r--r--1 root root      4096 Jan  1 00:07 modalias
drwxr-xr-x2 root root         0 Jan  1 00:07 power
lrwxrwxrwx1 root root         0 Jan  1 00:07 subsystem -> ../../../bus/platform
-rw-r--r--1 root root      4096 Jan  1 00:07 uevent

~ # cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00080000 00020000 "bootloader"

mtd1: 00040000 00020000 "params"

mtd2: 00400000 00020000 "kernel"

mtd3: 00400000 00020000 "kernel2"

mtd4: 7f740000 00020000 "filesystem"

~ # cat /proc/partitions

major minor  #blocks  name

  31        0        512 mtdblock0

  31        1        256 mtdblock1

  31        2       4096 mtdblock2

  31        3       4096 mtdblock3

  31        4    2088192 mtdblock4

~ # ls -l /dev/mtd*

crw-rw----    1 root     root       90,   0 Jan  1 00:00 /dev/mtd0

crw-rw----    1 root     root       90,   1 Jan  1 00:00 /dev/mtd0ro

crw-rw----    1 root     root       90,   2 Jan  1 00:00 /dev/mtd1

crw-rw----    1 root     root       90,   3 Jan  1 00:00 /dev/mtd1ro

crw-rw----    1 root     root       90,   4 Jan  1 00:00 /dev/mtd2

crw-rw----    1 root     root       90,   5 Jan  1 00:00 /dev/mtd2ro

crw-rw----    1 root     root       90,   6 Jan  1 00:00 /dev/mtd3

crw-rw----    1 root     root       90,   7 Jan  1 00:00 /dev/mtd3ro

crw-rw----    1 root     root       90,   8 Jan  1 00:00 /dev/mtd4

crw-rw----    1 root     root       90,   9 Jan  1 00:00 /dev/mtd4ro

brw-rw----    1 root     root       31,   0 Jan  1 00:00 /dev/mtdblock0

brw-rw----    1 root     root       31,   1 Jan  1 00:00 /dev/mtdblock1

brw-rw----    1 root     root       31,   2 Jan  1 00:00 /dev/mtdblock2

brw-rw----    1 root     root       31,   3 Jan  1 00:00 /dev/mtdblock3

brw-rw----    1 root     root       31,   4 Jan  1 00:00 /dev/mtdblock4

~#dmesg

...............................

MXC MTD nand Driver 3.0

NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba (Micron NAND 256MiB 1,8V 16-bit)

Bad block table found at page 1048512, version 0x01

Bad block table found at page 1048448, version 0x01

RedBoot partition parsing not available

Creating 5 MTD partitions on "NAND 256MiB 1,8V 16-bit":

0x000000000000-0x000000080000 : "bootloader"

0x000000080000-0x0000000c0000 : "params"

0x0000000c0000-0x0000004c0000 : "kernel"

0x0000004c0000-0x0000008c0000 : "kernel2"

0x0000008c0000-0x000080000000 : "filesystem"

..............................




0 Kudos
4,348 Views
israelpz
Senior Contributor I

Hi,

Try to erase the partition with flash_eraseall command.

After you erase the partition try again with kobs-ng.

By the way which i.MX are you using?

Regards,

-Israel.

0 Kudos