public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* what are correct sumtool and nandwrite options for NAND flash?
@ 2008-02-14 19:29 Cliff Brake
  2008-02-14 20:34 ` Andrey Yurovsky
  2008-02-14 20:44 ` Blair Barnett
  0 siblings, 2 replies; 3+ messages in thread
From: Cliff Brake @ 2008-02-14 19:29 UTC (permalink / raw)
  To: MTD mailing list

Hello,

I'm trying to determine the correct sumtool, and nandwrite options for
the following NAND flash device:

root@cm-x270:/usb/tmp$ mtd_debug info /dev/mtd5
mtd.type = MTD_NANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 67108864 (64M)
mtd.erasesize = 131072 (128K)
mtd.writesize = 2048 (2K)
mtd.oobsize = 64
regions = 0

My question is how do I get the OOB data into the flash image, and
convince nandwrite to use it.  I have been doing the following:

sumtool -i <input_file> -o <output_file> -e  -p;
flash_eraseall -j /dev/mtd5
nandwrite /dev/mtd5 <output_file>

I'm not sure what happens to the OOB data in the input image file when
I use the above method?  Is it simply mixed up in the image and not
actually written to the 64 byte OOB space?  The above method seems to
work, so I have ignored it thus far.

My question is should I be using the nandwrite -o option?  Looking at
the source it does not look like the OOB data gets written to the OOB
region unless this option is used.

if I try:
nandwrite -o /dev/mtd5 <output_file>

I get the following:
Input file is not page aligned
Data was only partially written due to error
: Success

Appreciate any pointers as to the correct way to do this.

Thanks,
Cliff

-- 
=======================
Cliff Brake
http://bec-systems.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: what are correct sumtool and nandwrite options for NAND flash?
  2008-02-14 19:29 what are correct sumtool and nandwrite options for NAND flash? Cliff Brake
@ 2008-02-14 20:34 ` Andrey Yurovsky
  2008-02-14 20:44 ` Blair Barnett
  1 sibling, 0 replies; 3+ messages in thread
From: Andrey Yurovsky @ 2008-02-14 20:34 UTC (permalink / raw)
  To: Cliff Brake; +Cc: MTD mailing list

You don't want OOB data written (-n) in this case.  For this chip, you
have 128KiB erase blocks.  You can make your image:

$ mkfs.jffs2 -e 128KiB -n -p -d somedir -o image-tmp.jffs2

sum it:

$ sumtool  -e 128KiB -n -p -i image-tmp.jffs2 -o image.jffs2

...and write it:

# flash_erase_all /dev/mtdX
# nandwrite /dev/mtdX image.jffs2

  -Andrey

On 2/14/08, Cliff Brake <cliff.brake@gmail.com> wrote:
> Hello,
>
>  I'm trying to determine the correct sumtool, and nandwrite options for
>  the following NAND flash device:
>
>  root@cm-x270:/usb/tmp$ mtd_debug info /dev/mtd5
>  mtd.type = MTD_NANDFLASH
>  mtd.flags = MTD_CAP_NANDFLASH
>  mtd.size = 67108864 (64M)
>  mtd.erasesize = 131072 (128K)
>  mtd.writesize = 2048 (2K)
>  mtd.oobsize = 64
>  regions = 0
>
>  My question is how do I get the OOB data into the flash image, and
>  convince nandwrite to use it.  I have been doing the following:
>
>  sumtool -i <input_file> -o <output_file> -e  -p;
>  flash_eraseall -j /dev/mtd5
>  nandwrite /dev/mtd5 <output_file>
>
>  I'm not sure what happens to the OOB data in the input image file when
>  I use the above method?  Is it simply mixed up in the image and not
>  actually written to the 64 byte OOB space?  The above method seems to
>  work, so I have ignored it thus far.
>
>  My question is should I be using the nandwrite -o option?  Looking at
>  the source it does not look like the OOB data gets written to the OOB
>  region unless this option is used.
>
>  if I try:
>  nandwrite -o /dev/mtd5 <output_file>
>
>  I get the following:
>  Input file is not page aligned
>  Data was only partially written due to error
>  : Success
>
>  Appreciate any pointers as to the correct way to do this.
>
>  Thanks,
>  Cliff
>
>
>  --
>  =======================
>  Cliff Brake
>  http://bec-systems.com
>
>  ______________________________________________________
>  Linux MTD discussion mailing list
>  http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: what are correct sumtool and nandwrite options for NAND flash?
  2008-02-14 19:29 what are correct sumtool and nandwrite options for NAND flash? Cliff Brake
  2008-02-14 20:34 ` Andrey Yurovsky
@ 2008-02-14 20:44 ` Blair Barnett
  1 sibling, 0 replies; 3+ messages in thread
From: Blair Barnett @ 2008-02-14 20:44 UTC (permalink / raw)
  To: Cliff Brake; +Cc: MTD mailing list

On Thu, 2008-02-14 at 14:29 -0500, Cliff Brake wrote:
> Hello,
> 
> I'm trying to determine the correct sumtool, and nandwrite options for
> the following NAND flash device:
> 
> root@cm-x270:/usb/tmp$ mtd_debug info /dev/mtd5
> mtd.type = MTD_NANDFLASH
> mtd.flags = MTD_CAP_NANDFLASH
> mtd.size = 67108864 (64M)
> mtd.erasesize = 131072 (128K)
> mtd.writesize = 2048 (2K)
> mtd.oobsize = 64
> regions = 0
> 
> My question is how do I get the OOB data into the flash image, and
> convince nandwrite to use it.  I have been doing the following:
> 
> sumtool -i <input_file> -o <output_file> -e  -p;
> flash_eraseall -j /dev/mtd5
> nandwrite /dev/mtd5 <output_file>
> 
> I'm not sure what happens to the OOB data in the input image file when
> I use the above method?  Is it simply mixed up in the image and not
> actually written to the 64 byte OOB space?  The above method seems to
> work, so I have ignored it thus far.
> 
> My question is should I be using the nandwrite -o option?  Looking at
> the source it does not look like the OOB data gets written to the OOB
> region unless this option is used.
> 
> if I try:
> nandwrite -o /dev/mtd5 <output_file>
> 
> I get the following:
> Input file is not page aligned
> Data was only partially written due to error
> : Success
> 
> Appreciate any pointers as to the correct way to do this.
> 
> Thanks,
> Cliff
> 

Hi Cliff,

sumtool doesn't create an image with embedded OOB data by default. You
can check for yourself by doing a hexdump of the image and looking at
the data that is placed at 2049 (1 byte after the first 2k page. If OOB
data is there, it will be obvious. If it's (as I surmise) the next 2k
page, then no oob data is embedded in the image.

I think what you want is 

sumtool -e 131072 -c  -p -i <input_file> -o <output_file>
nandwrite -o -j /dev/mtd5 <output_file>

-blair

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-14 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-14 19:29 what are correct sumtool and nandwrite options for NAND flash? Cliff Brake
2008-02-14 20:34 ` Andrey Yurovsky
2008-02-14 20:44 ` Blair Barnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox