Patchwork flash_erase ERROR!

login
register
mail settings
Submitter Brian Norris
Date Oct. 19, 2011, 5:22 p.m.
Message ID <1319044961-26745-1-git-send-email-computersforpeace@gmail.com>
Download mbox | patch
Permalink /patch/120676/
State New
Headers show

Comments

Brian Norris - Oct. 19, 2011, 5:22 p.m.
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(-)
Brian Norris - Nov. 16, 2011, 6:55 p.m.
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
dhlm83@sapo.pt - Nov. 24, 2011, 9:39 p.m.
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.

Patch

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;
 		}