[PATCH 6/6] [MTD-UTILS] nandwrite: Add Support for Reading from Standard Input
ladis at linux-mips.org
Thu Nov 20 17:50:22 EST 2008
On Mon, Sep 08, 2008 at 09:36:52AM -0700, Grant Erickson wrote:
> On 9/8/08 9:14 AM, Ladislav Michl wrote:
> > - code uses lseek. Obviously, you cannot seek on pipe.
> True enough. The patch avoids the lseek to determine input file size;
> however, did not address the 'markbad' recovery lseek case.
> Short-term proposal: like 'writeoob', disable 'markbad' support when reading
> from standard input and condition the whole 'markbad' logic on not reading
> from standard input.
It is not about marking bad blocks. Nandwrite will end with unrecoverable
error on first failed write and that is not acceptable in production
> > PS: It is remotely possible that one day I do it myself, but I'm
> > notoriously slow on doing things I do not urgently need.
Well, it took less than three months. Not so bad :-)
And it turned out to be imposible to fix it properly without solving
following issue first.
MEMSETOOBSEL ioctl used to implement these options
-a, --autoplace Use auto oob layout
-j, --jffs2 Force jffs2 oob layout (legacy support)
-y, --yaffs Force yaffs oob layout (legacy support)
-f, --forcelegacy Force legacy support on autoplacement-enabled mtd device
-n, --noecc Write without ecc
was removed more than two years ago and found its way into 2.6.18-rc1. See
I hope legacy support can be safely removed (please raise your voice now)
which leaves only --noecc for implementation. Possible scenarios are:
1. Image does not contain OOB data
Read whole eraseblock to buffer and write it to flash
2. Image contains OOB data (--oob is given)
Set MTDFILEMODE to MTD_MODE_RAW, read whole eraseblock
(data:oob:data:oob...) into buffer and write it to flash
3. Image does not contain OOB data and --noecc is given
Set MTDFILEMODE to MTD_MODE_RAW, read whole eraseblock,
insert 0xff into OOB after each writeblock, write into
4. Image contains OOB data and --noecc is given
As I have never need writing images with OOB I'd like to ask for help
how should be case 3 and 4 handled.
More information about the linux-mtd