2008-04-26 11:10:13     "File open error" on erase.

Document created by Aaronwu Employee on Aug 6, 2013
Version 1Show Document
  • View in full screen mode

2008-04-26 11:10:13     "File open error" on erase.

blue hash (UNITED STATES)

Message: 55025    "erase" or "eraseall" on an mtd partition(for jffs2) results in the following error:

root:/> erase /dev/mtd2

File open error

 

root:/> eraseall /dev/mtd2

eraseall: /dev/mtd2: Permission denied

 

Partitions:

0x00000000-0x00040000 : "Bootloader"

0x00040000-0x00380000 : "Kernel"

0x00380000-0x003e0000 : "Test1"

0x003e0000-0x00400000 : "Test2"

QuoteReplyEditDelete

 

 

2008-04-27 23:03:01     Re: "File open error" on erase.

Yi Li (CHINA)

Message: 55078    please make sure your mtd driver is correctly set up. Are you using 08r1 release?

QuoteReplyEditDelete

 

 

2008-04-28 08:44:09     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55127    Yi Li,

I'm using 08r1.

uClinux seems to create partitions successfully:

 

root:/> cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00040000 00400000 "Bootloader"

mtd1: 00340000 00400000 "Kernel"

mtd2: 00060000 00400000 "Test1"

mtd3: 00020000 00400000 "Test2"

QuoteReplyEditDelete

 

 

2008-04-28 11:21:42     Re: "File open error" on erase.

Robin Getz (UNITED STATES)

Message: 55152    Blue:

 

It is not until you start to use things, that alignment checking is done (Do the mtd partitions lie on flash blocks?)

 

-Robin

QuoteReplyEditDelete

 

 

2008-04-28 12:28:25     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55161    Robin,

What do you mean by flash blocks?

Are there any alignment considerations I have to take into account?

Thanks.

QuoteReplyEditDelete

 

 

2008-04-28 13:35:32     Re: "File open error" on erase.

Robin Getz (UNITED STATES)

Message: 55165    Blue:

 

In the datasheet of the flash, it will say on what addresses blocks are. You can also get this info from the U-Boot  flinfo command.

 

-Robin

QuoteReplyEditDelete

 

 

2008-04-28 13:52:33     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55168    flinfo gives:

 

Bank # 1: CFI conformant FLASH (16 x 16)  Size: 4 MB in 71 Sectors

Erase timeout 8192 ms, write timeout 1 ms, buffer write timeout 1 ms, buffer size 1

  Sector Start Addresses:

    20000000 (RO) 20002000 (RO) 20004000 (RO) 20006000 (RO) 20008000 (RO)

    2000A000 (RO) 2000C000 (RO) 2000E000 (RO) 20010000 (RO) 20020000   

    20030000      20040000      20050000      20060000      20070000   

    20080000      20090000      200A0000      200B0000      200C0000   

    200D0000      200E0000      200F0000      20100000      20110000   

    20120000      20130000      20140000      20150000      20160000   

    20170000      20180000      20190000      201A0000      201B0000   

    201C0000      201D0000      201E0000      201F0000      20200000   

    20210000      20220000      20230000      20240000      20250000   

    20260000      20270000      20280000      20290000      202A0000   

    202B0000      202C0000      202D0000      202E0000      202F0000   

    20300000      20310000      20320000      20330000      20340000   

    20350000      20360000      20370000      20380000      20390000   

    203A0000      203B0000      203C0000      203D0000      203E0000   

    203F0000

 

Thats 2kb sectors at the start followed by 64Kb Sectors. The MTD partitions are on flash blocks.

QuoteReplyEditDelete

 

 

2008-04-28 15:44:39     Re: "File open error" on erase.

Mike Frysinger (UNITED STATES)

Message: 55170    run it through strace to see what function exactly is failing

 

make sure the device nodes have the +w bit set

 

make sure your root filesystem is not mounted read-only

 

normally mtd# is for different devices, not partitions ... eraseall is for erasing entire devices, not individual partitions.  make sure you've enabled all the appropriate mtd device options in your kernel config ... see the jffs2 document for more information

QuoteReplyEditDelete

 

 

2008-04-28 17:09:08     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55172    Mike,

How do I make sure the +w bit is set? If it's in the device table, then yes it is.

 

strace gives:

root:/> strace -v erase /dev/mtd2

ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x08\x15\x04\x00\x01\x00\x10

ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0x1cb1, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x08\x15\x04\x00\x01\x00\x10

open("/dev/mtd2", O_RDWR)               = -1 EACCES (Permission denied)

write(2, "File open error\n", 16File open error

)       = 16

_exit(8)                                = ?

Process 69 detached

 

It looks like theres no read/write access to it(EACCES (Permission denied)).

 

QuoteReplyEditDelete

 

 

2008-04-28 18:13:33     Re: "File open error" on erase.

Mike Frysinger (UNITED STATES)

Message: 55176    just do `ls -l`.  you can easily do `chmod a+w` at runtime.

QuoteReplyEditDelete

 

 

2008-04-29 10:39:27     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55230    I tried what you suggested, I still get the same error.

 

My setting for the flash are the same as in the "enabling JFFS2" document.

Rootfs is rwx.

Is there anything else I can try.Thanks.

QuoteReplyEditDelete

 

 

2008-04-30 16:52:59     Re: "File open error" on erase.

Mike Frysinger (UNITED STATES)

Message: 55317    what all mtd devices do you have ?  as i mentioned earlier, you should not have mtd{0,1,2}.  you should have mtd0 and mtd0block{0,1,2}.  the mtd#block# devices are how you access partitions, not the mtd#.

QuoteReplyEditDelete

 

 

2008-05-01 10:07:41     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55348    Mike,

Enabling " Advanced flash configurations" along with "geometry settings" got the flash working. There was also an EBIU setting typed wrong.

 

I'm able to erase a partition using eraseall /dev/mtd2 and mount the block using

mount -t jffs2 /dev/mtdblock2 /mnt

I can write/view the partition in uClinux and view them in u-boot via ls.

 

ls /dev/mtd* gives:

/dev/mtd0       /dev/mtd1ro     /dev/mtd3       /dev/mtd4ro     /dev/mtdblock2

/dev/mtd0ro     /dev/mtd2       /dev/mtd3ro     /dev/mtdblock0  /dev/mtdblock3

/dev/mtd1       /dev/mtd2ro     /dev/mtd4       /dev/mtdblock1  /dev/mtdblock4

 

This is contraditing what you are said earlier.. If the flash was mtd0(which is a device), how come there are no mtd0block(1,2,3)?

Am I wrong in understanding it. Although erverything seems to work ok.

Also what are the ones with "ro"?

 

cat /proc/mtd gives:

mtd0: 00040000 00010000 "Bootloader"

mtd1: 00340000 00010000 "Kernel"

mtd2: 00060000 00010000 "Test1"

mtd3: 00020000 00010000 "Test2"

mtd4: 00300000 00001000 "ROMfs"

 

Thanks.

QuoteReplyEditDelete

 

 

2008-05-01 17:18:20     Re: "File open error" on erase.

Mike Frysinger (UNITED STATES)

Message: 55354   

 

sorry, you're right ... i was obviously recalling things incorrectly

 

can you list the options exactly that you enabled so i can make sure the documenation is in line ?

QuoteReplyEditDelete

 

 

2008-05-02 17:51:18     Re: "File open error" on erase.

blue hash (UNITED STATES)

Message: 55377    Mike,

This was the setting:

EBIU_AMBCTL Control->

   |  │                                      (0x7BB0) Bank 0                                                                                             │ │

  │ │                                      (0x7BB0) Bank 1                                                                                             │ │

  │ │                                      (0x7BB0) Bank 2                                                                                             │ │

  │ │                                      (0x7BB0) Bank 3                                                                                             │ │

 

My bank3 was 0x99B3, this was from my old configuration. I had made the change some time back and forgotten about it.

 

I compiled uClinux with the  "Flash chip driver advanced configuration options " disabled, and it still worked.

So you dont have to make any changes. Thanks.

Attachments

    Outcomes