Hi Mr. Li,
I'm using uclinxu-2.4.19 which doesn't has the flash_tools cmd(include
flash_eraseall mkfs.jffs2 .etc). So I made them out of
mtd-snapshot-20040730.tar.bz2.

Unfortunately, I got the error what I mentioned before.

In the light of your prompt, I dig into mtdchar.c and flash_eraseall.c,
I used printk to trace the bug and found it DO jump from mtd_ioctl().

I find the function mtd_open() and mtd_ioctl() implemented  like this:
=============
static int mtd_ioctl(struct inode *inode, struct file *file,
      u_int cmd, u_long arg)
{
......
}



static int mtd_open(struct inode *inode, struct file *file)
{
int minor = iminor(inode);
int devnum = minor >> 1;
struct mtd_info *mtd;

DEBUG(MTD_DEBUG_LEVEL0, "MTD_open\n");

if (devnum >= MAX_MTD_DEVICES)
 return -ENODEV;

/* You can't open the RO devices RW */
if ((file->f_mode & 2) && (minor & 1))
 return -EACCES;

mtd = get_mtd_device(NULL, devnum);

if (!mtd)
 return -ENODEV;

if (MTD_ABSENT == mtd->type) {
 put_mtd_device(mtd);
 return -ENODEV;
}

file->private_data = mtd;

/* You can't open it RW if it's not a writeable device */
if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) {
 put_mtd_device(mtd);
 return -EACCES;
}

return 0;
} /* mtd_open */
=============

but in flash_eraseall.c , these two function is called like this:
=============

if ((fd = open(mtd_device, O_RDWR)) < 0) {
 fprintf(stderr, "%s: %s: %s\n", exe_name, mtd_device, strerror(errno));
 exit(1);
}


if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
 fprintf(stderr, "%s: %s: unable to get MTD device info\n", exe_name,
mtd_device);
 exit(1);
}
=============

So, I pin the problem on  the function mtd_ioctl() 's parameter doesn't
match.
But when I check other uclinux-dist who has flash_tools, I saw the same
implement and call method.

Ohh..I have no clue to fix it again, please give me some hint.
Thank you!







2007/3/23, Aubrey Li <[EMAIL PROTECTED]>:

On 3/23/07, Yue Han <[EMAIL PROTECTED]> wrote:
> I checked my .config file again, I sure that I have configed it . But...
> flash_eraseall can't work all the same.

Hmm.., then you have to dig into the code.
mtd_ioctl() is in the linux-2.6.x/drivers/mtd/mtdchar.c

Add printk or using kgdb or using jtag tools may do some help.

-Aubrey
_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to