All of lore.kernel.org
 help / color / mirror / Atom feed
* flash_erase ERROR!
@ 2011-09-19 13:52 dhlm83
  2011-09-21 20:05 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: dhlm83 @ 2011-09-19 13:52 UTC (permalink / raw)
  To: linux-mtd

Hello.
This is my first post.

I am using uClinux (kernel 2.4.34.5-uc0 , dist: 20110603)
I build a image to board NetBurner MOD5272.

I have de following flash memory map:
      ......
      Creating 6 MTD partitions on "Physically mapped flash Netburner MOD5272":
      0x00000000-0x00004000 : "boot monitor (16K)"
      0x00004000-0x00006000 : "monitor params (8K)"
      0x00006000-0x00008000 : "user params (8K)"
      0x00008000-0x00010000 : "application code 1 (32K)"
      0x00010000-0x001a0000 : "application code 2 (1600K)"
      0x001a0000-0x00200000 : "flash fs (384K)"
      ......

As can be seen, I have one partition with 384k (6 sectors of 64kiB) in  
/dev/mtd5 with corresponding block device /dev/mtdblock4
That partition is mounted in /mnt directory in jffs2 type, and used to  
save some configuration files.
      ......
      #!/bin/sh
      echo "Mounting /mnt (jffs2)"
      mount -t jffs2 /dev/mtdblock5 /mnt
      ......

For some unknown reason the file system come corrupted, afther some  
system reboot.
And afther this, always it try mount  /mnt get many:
      jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at  
0xXXXXXXXX: 0xXXXX instead


I read in this link  
(http://forums.freescale.com/t5/Other-Microcontrollers/JFFS2-complaining-jffs2-scan-eraseblock-Magic-bitmask-0x1985-not/td-p/40002), to solve this i have to format the  
partition.
The problem is: The flash_eraseall and flash_erase dont work.
      ......
      # flash_eraseall -j /dev/mtd5 0 0
      /bin/flash_eraseall has been replaced by `flash_erase <mtddev> 0  
0`; please use it
      Access Error Exception 12: Error on data read
      SIGSEGV
      ......

      ......
      # flash_erase -j -u -N /dev/mtd5 0 0
      libmtd: error!: MEMGETBADBLOCK ioctl failed
              error 25 (Inappropriate ioctl for device)
      flash_erase: error!: mtd_get_dev_info failed
      .....

Has anyone had this problem?
Someone may give clues to solve the problem?

Thanks.
Domingos Goncalves.

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

* Re: flash_erase ERROR!
  2011-09-19 13:52 flash_erase ERROR! dhlm83
@ 2011-09-21 20:05 ` Brian Norris
  2011-09-22 10:15   ` dhlm83
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2011-09-21 20:05 UTC (permalink / raw)
  To: dhlm83; +Cc: linux-mtd

On Mon, Sep 19, 2011 at 6:52 AM,  <dhlm83@sapo.pt> wrote:
> Hello.
> This is my first post.
>
> I am using uClinux (kernel 2.4.34.5-uc0 , dist: 20110603)
> I build a image to board NetBurner MOD5272.

That's a very old (and dare I say unsupported?) kernel. There may be
some things we can do to help, but generally, MTD developers don't
support that old of code.

> The problem is: The flash_eraseall and flash_erase dont work.
>     ......
>     # flash_eraseall -j /dev/mtd5 0 0
>     /bin/flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`;
> please use it
>     Access Error Exception 12: Error on data read
>     SIGSEGV
>     ......
>
>     ......
>     # flash_erase -j -u -N /dev/mtd5 0 0
>     libmtd: error!: MEMGETBADBLOCK ioctl failed
>             error 25 (Inappropriate ioctl for device)
>     flash_erase: error!: mtd_get_dev_info failed
>     .....

What version of mtd-utils do you have? If it's old, then "flash_erase"
may not give a version # (try `flash_erase --version'). You could also
check other utilities, like:

nanddump --version
nandwrite --version
...

> Has anyone had this problem?
> Someone may give clues to solve the problem?

I'm guessing it's just that your kernel is really old. From the looks
of it, your flash_eraseall is pretty recent. Just a quick check of
some old kernel 2.4 code seems to tell me that MEMGETBADBLOCK didn't
even exist in your kernel, so obviously the current mtd-utils will be
incompatible.

Brian

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

* Re: flash_erase ERROR!
  2011-09-21 20:05 ` Brian Norris
@ 2011-09-22 10:15   ` dhlm83
  2011-10-19 17:22     ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: dhlm83 @ 2011-09-22 10:15 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

Hello.
Thanks for repply, and help is welcome.

Citando Brian Norris <xxxx@gmail.com>:

> On Mon, Sep 19, 2011 at 6:52 AM,  <xxxx@sapo.pt> wrote:
>> Hello.
>> This is my first post.
>>
>> I am using uClinux (kernel 2.4.34.5-uc0 , dist: 20110603)
>> I build a image to board NetBurner MOD5272.
>
> That's a very old (and dare I say unsupported?) kernel. There may be
> some things we can do to help, but generally, MTD developers don't
> support that old of code.

I am forced to use this kernel (2.4.x) by limitation of my target  
board, especially the only 2MB of flash.
I build successfully a 2.6.x image, but without my applications was  
already near the limit of memory.

>> The problem is: The flash_eraseall and flash_erase dont work.
>>     ......
>>     # flash_eraseall -j /dev/mtd5 0 0
>>     /bin/flash_eraseall has been replaced by `flash_erase <mtddev> 0 0`;
>> please use it
>>     Access Error Exception 12: Error on data read
>>     SIGSEGV
>>     ......
>>
>>     ......
>>     # flash_erase -j -u -N /dev/mtd5 0 0
>>     libmtd: error!: MEMGETBADBLOCK ioctl failed
>>             error 25 (Inappropriate ioctl for device)
>>     flash_erase: error!: mtd_get_dev_info failed
>>     .....
>
> What version of mtd-utils do you have? If it's old, then "flash_erase"
> may not give a version # (try `flash_erase --version'). You could also
> check other utilities, like:
>
> nanddump --version
> nandwrite --version

The mtd-utils version is: in file mtd-utils.spec
      .....
      Version: 1.0
      Release: 1
      .....

  The flash_erase version:
      .....
      # flash_erase --version
      flash_erase version 2
      .....

I dont have nanddump and nandwrite utilities. My flash is NOR type  
(am29lv160db).
But in source files:
      nanddump.c: "$Revision: 1.29 $"
      nandwrite.c: "$Revision: 1.32 $"

>> Has anyone had this problem?
>> Someone may give clues to solve the problem?
>
> I'm guessing it's just that your kernel is really old. From the looks
> of it, your flash_eraseall is pretty recent. Just a quick check of
> some old kernel 2.4 code seems to tell me that MEMGETBADBLOCK didn't
> even exist in your kernel, so obviously the current mtd-utils will be
> incompatible.
>
> Brian

I think the mtd-utils version is the same to kernel 2.4.x and 2.6.x in  
my distro source.
This can not generate some compatibility issues?

In the past, mtd-utils have the utilities erase and erase_all. I think  
that utilities work with my kernel, is that possible?
You know what version of mtd-utils are available (erase and erase_all)?
I can try this version.

Best Regards.
Domingos Goncalves

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

* Re: flash_erase ERROR!
  2011-09-22 10:15   ` dhlm83
@ 2011-10-19 17:22     ` Brian Norris
  2011-11-16 18:55       ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2011-10-19 17:22 UTC (permalink / raw)
  To: dhlm83; +Cc: Brian Norris, linux-mtd

Hey, sorry for the delay here. One reason is that I don't really know all
the answers for your problem.

On Thu, Sep 22, 2011 at 3:15 AM, <dhlm83@sapo.pt> wrote:
> I think the mtd-utils version is the same to kernel 2.4.x and 2.6.x in my
> distro source.
> This can not generate some compatibility issues?

I'm not sure what distro is providing 2.4.x and 2.6.x kernels, but it would
seem to me like recent versions of mtd-utils (I think you're using
"mtd-utils v1.4.2") are not designed to support both kernels. Generally, it
is difficult for today's developers to test code for 2.4.x, and there is no
official support for MTD on 2.4.x. See:

http://www.linux-mtd.infradead.org/source.html#kernelversions

> In the past, mtd-utils have the utilities erase and erase_all. I think that
> utilities work with my kernel, is that possible?
> You know what version of mtd-utils are available (erase and erase_all)?
> I can try this version.

It is possible that some old version of mtd-utils had simpler utilities
that worked with 2.4.x. I don't see them in the git repository, though, so
they're likely older than 2006.

Brian

P.S. It looks like your problem is pretty simple to fix. Try this patch
out, and perhaps it can be integrated into mtd-utils to provide a small
breath of support for 2.4.x in the "legacy" section of libmtd :)

---

From: Brian Norris <computersforpeace@gmail.com>
Subject: [PATCH] libmtd_legacy: support kernels before ioctl(MEMGETBADBLOCK)
 existed

For really old kernels, ioctl(MEMGETBADBLOCK) did not exist, so we
always quit out with ENOTTY. We should at least allow this check to pass
and just proceed without bad block info. This is safe enough, as users
of these old kernels will not be using NAND (or anything with bad
blocks).

Reported-by: Domingos Goncalves <dhlm83@sapo.pt>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 lib/libmtd_legacy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/libmtd_legacy.c b/lib/libmtd_legacy.c
index d6c3938..14a3f27 100644
--- a/lib/libmtd_legacy.c
+++ b/lib/libmtd_legacy.c
@@ -248,7 +248,7 @@ int legacy_get_dev_info(const char *node, struct mtd_dev_info *mtd)
 
 	ret = ioctl(fd, MEMGETBADBLOCK, &offs);
 	if (ret == -1) {
-		if (errno != EOPNOTSUPP) {
+		if (errno != EOPNOTSUPP && errno != ENOTTY) {
 			sys_errmsg("MEMGETBADBLOCK ioctl failed");
 			goto out_close;
 		}
-- 
1.7.5.4

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

* Re: flash_erase ERROR!
  2011-10-19 17:22     ` Brian Norris
@ 2011-11-16 18:55       ` Brian Norris
  2011-11-24 21:39         ` dhlm83
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2011-11-16 18:55 UTC (permalink / raw)
  To: dhlm83; +Cc: Brian Norris, linux-mtd

Hello Domingos,

On Wed, Oct 19, 2011 at 10:22 AM, Brian Norris
<computersforpeace@gmail.com> wrote:
> P.S. It looks like your problem is pretty simple to fix. Try this patch
> out, and perhaps it can be integrated into mtd-utils to provide a small
> breath of support for 2.4.x in the "legacy" section of libmtd :)

Did you get to try out my patch? If it was useful, then we might add
it to the legacy support in mtd-utils; otherwise, I'll be dropping it
from my own consideration soon.

Brian

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

* Re: flash_erase ERROR!
  2011-11-16 18:55       ` Brian Norris
@ 2011-11-24 21:39         ` dhlm83
  0 siblings, 0 replies; 6+ messages in thread
From: dhlm83 @ 2011-11-24 21:39 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd


Citando Brian Norris <computersforpeace@gmail.com>:

> Hello Domingos,
>
> On Wed, Oct 19, 2011 at 10:22 AM, Brian Norris
> <computersforpeace@gmail.com> wrote:
>> P.S. It looks like your problem is pretty simple to fix. Try this patch
>> out, and perhaps it can be integrated into mtd-utils to provide a small
>> breath of support for 2.4.x in the "legacy" section of libmtd :)
>
> Did you get to try out my patch? If it was useful, then we might add
> it to the legacy support in mtd-utils; otherwise, I'll be dropping it
> from my own consideration soon.
>
> Brian

Hello.

Sorry, but a dont try your PATCH.

Thanks.

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

end of thread, other threads:[~2011-11-24 21:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 13:52 flash_erase ERROR! dhlm83
2011-09-21 20:05 ` Brian Norris
2011-09-22 10:15   ` dhlm83
2011-10-19 17:22     ` Brian Norris
2011-11-16 18:55       ` Brian Norris
2011-11-24 21:39         ` dhlm83

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.