All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stanley.Miao" <stanley.miao@windriver.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH 3/5] Fix the bug of writing a yaffs2 image to NAND
Date: Wed,  3 Feb 2010 10:56:34 +0800	[thread overview]
Message-ID: <1265165796-24686-4-git-send-email-stanley.miao@windriver.com> (raw)
In-Reply-To: <1265165796-24686-3-git-send-email-stanley.miao@windriver.com>

The tool mkyaffs2image doesn't know the oob layout of a NAND flash, so it
puts the yaffs2 tags at the offset 0 of oob area. When nandwrite writes the
image into NAND flash, it should put the yaffs2 tags at the right position
according to the NAND oob layout.

Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
---
 nandwrite.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/nandwrite.c b/nandwrite.c
index c66ab54..35f1e4d 100644
--- a/nandwrite.c
+++ b/nandwrite.c
@@ -429,6 +429,8 @@ int main(int argc, char * const argv[])
 
 		if (writeoob) {
 			int i, start, len;
+			int tags_pos = 0;
+
 			oobreadbuf = writebuf + meminfo.writesize;
 
 			// Read more data for the OOB from the input if there isn't enough in the buffer
@@ -470,8 +472,8 @@ int main(int argc, char * const argv[])
 				start = ecclayout.oobfree[i].offset;
 				len = ecclayout.oobfree[i].length;
 				memcpy(oobbuf + start,
-						oobreadbuf + start,
-						len);
+						oobreadbuf + tags_pos, len);
+				tags_pos += len;
 			}
 			/* Write OOB data first, as ecc will be placed in there*/
 			oob.start = mtdoffset;
-- 
1.5.4.3

  reply	other threads:[~2010-02-03  2:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  2:56 Stanley.Miao
2010-02-03  2:56 ` [PATCH 1/5] clean up the legacy interfaces in nandwrite.c Stanley.Miao
2010-02-03  2:56   ` [PATCH 2/5] check if the start address is page-aligned Stanley.Miao
2010-02-03  2:56     ` Stanley.Miao [this message]
2010-02-03  2:56       ` [PATCH 4/5] Discard the legacy interface MEMGETOOBSEL in flash_eraseall Stanley.Miao
2010-02-03  2:56         ` [PATCH 5/5] Place the cleanmarker in OOB area according to the mode MTD_OOB_AUTO Stanley.Miao
2010-02-03  3:16 ` Mike Frysinger
2010-02-03  4:31   ` Re: stanley.miao
  -- strict thread matches above, loose matches on Subject: below --
2010-02-03  4:45 Fix mtd-utils bugs Stanley.Miao
2010-02-03  4:45 ` [PATCH 1/5] clean up the legacy interfaces in nandwrite.c Stanley.Miao
2010-02-03  4:45   ` [PATCH 2/5] check if the start address is page-aligned Stanley.Miao
2010-02-03  4:45     ` [PATCH 3/5] Fix the bug of writing a yaffs2 image to NAND Stanley.Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1265165796-24686-4-git-send-email-stanley.miao@windriver.com \
    --to=stanley.miao@windriver.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.