Query mtd-utils v1.4.9 : flash_erase.c

Brian Norris computersforpeace at gmail.com
Thu Apr 5 16:58:09 EDT 2012


On Thu, Apr 5, 2012 at 2:21 AM, Kushwaha Prabhakar-B32579
<B32579 at freescale.com> wrote:
>  I checked latest mtd-utils ver 1.4.9 for file flash_erase.c.
>
> It usage MEMGETOOBSEL ioctl to get OOB information from the driver. But this ioctl may returns error for big NAND chips.
> The reason of failure would be the following condition at linux/driver/mtd/mtdchar.c
>  if (mtd->ecclayout->eccbytes > ARRAY_SIZE(oi.eccpos))
>
> MEMGETOOBSEL has been obsolete. then Why mtd-utils still using it.

A few reasons:
(1) There is no replacement interface and there is no plan for a
replacement AFAIK (unless you count MTD_OOB_AUTO within the kernel, as
you mention).
(2) It's only used for the legacy option JFFS2 format option (-j or
--jffs2). JFFS2 isn't supported much anymore, and it probably is not
worth using on "big NAND chips." On some systems, ECC does not even
leave enough room in OOB for JFFS2.

> Also, I don't think flash_erase.c supports MTD_OOB_AUTO. Although its support is already part of Linux kernel.

What do you mean by "support MTD_OOB_AUTO" (this is actually renamed
MTD_OPS_AUTO_OOB, btw)? If you're speaking of the -j option still,
then it's probably because nobody has bothered supporting old features
on new userspace tools with new (large-OOB) chips. This would require
a developer who cares about JFFS2 to compare the various versions of
"autoplace." It wouldn't be too hard to make this use
MTD_OPS_AUTO_OOB; I just haven't studied auto/jffs2 much...

Also, aside from -j, flash_erase is only an *erase* tool, not a
formatting tool, so maybe the -j option is misplaced.

Brian



More information about the linux-mtd mailing list