linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Linux 2.6.x, MTD drivers and NAND flashes
@ 2007-06-11 15:20 Laurent Lagrange
  2007-06-11 15:59 ` Bill Gatliff
  2007-06-12 13:37 ` Detlev Zundel
  0 siblings, 2 replies; 5+ messages in thread
From: Laurent Lagrange @ 2007-06-11 15:20 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

Hello,

I use a Linux 2.6.9 on a 85xx custom board with a NAND flash.

This flash has some bad blocks.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V
8-bit)
Scanning device for bad blocks
Bad eraseblock 8 at 0x00100000
Bad eraseblock 430 at 0x035c0000
...
Creating 1 MTD partitions on "NAND 128MiB 3,3V 8-bit":
0x00000000-0x08000000 : "flash partition 1".

I have selected in the kernel :
1) the MTD character and block supports for NAND,
2) the CRAMFS and JFFS2 supports for NAND.

I can erase the flash but receive IO errors for each bad blocks (that seems
right).
I can mount an empty JFFS2 partition on the NAND and untar some directories
and files in it.

I would like to generate some JFFS2 images and program them in the flash
with a character
command like "cat img > /dev/mtd/0". If I dont encounter a bad block, it
runs right else the
command fails.

This is a little bit annoying. So my question is simple :
Is there a MTD character driver which can detect and ignore the bad blocks
in a NAND flash ?

Thanks for any tips.
Bye
Laurent




[-- Attachment #2: Type: text/html, Size: 2693 bytes --]

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

* Re: Linux 2.6.x, MTD drivers and NAND flashes
  2007-06-11 15:20 Linux 2.6.x, MTD drivers and NAND flashes Laurent Lagrange
@ 2007-06-11 15:59 ` Bill Gatliff
  2007-06-11 19:59   ` Gary Kenaley
  2007-06-12 13:37 ` Detlev Zundel
  1 sibling, 1 reply; 5+ messages in thread
From: Bill Gatliff @ 2007-06-11 15:59 UTC (permalink / raw)
  To: Laurent Lagrange; +Cc: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]

Laurent Lagrange wrote:
> Hello,
>
> I use a Linux 2.6.9 on a 85xx custom board with a NAND flash.
>  
> This flash has some bad blocks.
> NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 
> 3,3V 8-bit)
> Scanning device for bad blocks
> Bad eraseblock 8 at 0x00100000
> Bad eraseblock 430 at 0x035c0000
> ...
> Creating 1 MTD partitions on "NAND 128MiB 3,3V 8-bit":
> 0x00000000-0x08000000 : "flash partition 1".
>  
> I have selected in the kernel :
> 1) the MTD character and block supports for NAND,
> 2) the CRAMFS and JFFS2 supports for NAND.
>  
> I can erase the flash but receive IO errors for each bad blocks (that 
> seems right).
> I can mount an empty JFFS2 partition on the NAND and untar some 
> directories and files in it.
>  
> I would like to generate some JFFS2 images and program them in the 
> flash with a character
> command like "cat img > /dev/mtd/0". If I dont encounter a bad block, 
> it runs right else the
> command fails.
>  
> This is a little bit annoying. So my question is simple :
> Is there a MTD character driver which can detect and ignore the bad 
> blocks in a NAND flash ?

Wrong question.  :)

With NAND, working directly with the media is indeed a pain because of 
bad blocks.  What's done instead is to leave that to the filesystem.  
Pick a NAND-aware one like YAFFS.


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com


[-- Attachment #2: Type: text/html, Size: 2835 bytes --]

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

* RE: Linux 2.6.x, MTD drivers and NAND flashes
  2007-06-11 15:59 ` Bill Gatliff
@ 2007-06-11 19:59   ` Gary Kenaley
  2007-06-12 10:06     ` Laurent Lagrange
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Kenaley @ 2007-06-11 19:59 UTC (permalink / raw)
  To: Bill Gatliff, Laurent Lagrange; +Cc: linuxppc-embedded

Laurent,

Can't you just use the flashcp copy command from the mtd-utils package?
-----------------------------------------------------------------------
flash_eraseall -j /dev/mtd0

mkfs.jffs2 -b -n --eraseblock=3D131072 --pagesize=3D2048 -p -r =
/test_root -v -o test_root.img

flashcp test_root.img /dev/mtd0


The other way is what Bill mentions:
------------------------------------
flash_eraseall -j /dev/mtd0
mount -t jffs2 /dev/mtdblock0 /tmp/mnt
tar -xzf test_root.tgz -C /tmp/mnt
umount /tmp/mnt

Gary

> > ________________________________________
> > From: linuxppc-embedded-bounces+gkenaley=3Dechelon.com@ozlabs.org > =
> > [mailto:linuxppc-embedded-bounces+gkenaley=3Dechelon.com@ozlabs.org] =
On Behalf > > Of Bill Gatliff
> > Sent: Monday, June 11, 2007 9:00 AM
> > To: Laurent Lagrange
> > Cc: linuxppc-embedded@ozlabs.org
> > Subject: Re: Linux 2.6.x, MTD drivers and NAND flashes
> >
> > Laurent Lagrange wrote:=20
> > Hello,
> >
> > I use a Linux 2.6.9 on a 85xx custom board with a NAND flash.=20
> >=A0
> > This flash has some bad blocks.
> > NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND =
128MiB > > 3,3V 8-bit)
> > Scanning device for bad blocks
> > Bad eraseblock 8 at 0x00100000
> > Bad eraseblock 430 at 0x035c0000
> >...
> > Creating 1 MTD partitions on "NAND 128MiB 3,3V 8-bit":
> > 0x00000000-0x08000000 : "flash partition 1".
> >=A0
> > I have selected in the kernel :
> > 1) the MTD character and block supports for NAND,
> > 2) the CRAMFS and JFFS2 supports for NAND.
> >=A0
> > I can erase the flash but receive IO errors for each bad blocks =
(that > > seems right).
> > I can mount an empty JFFS2 partition on the NAND and untar some > > =
directories and files in it.
> >=A0
> > I would like to generate some JFFS2 images and program them in the =
flash > > with a character=20
> > command like "cat img > /dev/mtd/0". If I dont encounter a bad =
block, it > > runs right=A0else the=20
> > command fails.=20
> >=A0
> > This is a little bit annoying. So my question is simple :=20
> > Is there a MTD character driver which can detect and ignore the bad =
> blocks > in a NAND flash=A0?=20
> >
> Wrong question.=A0 :)

> With NAND, working directly with the media is indeed a pain because of =
bad > blocks.=A0 What's done instead is to leave that to the =
filesystem.=A0 Pick a > NAND-aware one like YAFFS.
>
>
> b.g.
>
> --=20
> Bill Gatliff
> bgat@billgatliff.com

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

* RE: Linux 2.6.x, MTD drivers and NAND flashes
  2007-06-11 19:59   ` Gary Kenaley
@ 2007-06-12 10:06     ` Laurent Lagrange
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Lagrange @ 2007-06-12 10:06 UTC (permalink / raw)
  To: 'Gary Kenaley', 'Bill Gatliff'; +Cc: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]


Gary and Bill,

My need is to load a basic Linux kernel on boards to program multiple 
NOR and NAND flashes with CRAMFS and JFFS2 (perhaps YAFFS) images.

I usually used mtd character accesses to do the job on NOR flashes.
But flash_eraseall and flashcp seem to be excellent tools.
I'll try them quickly.

Many thanks for your help
Bye
Laurent

> -----Message d'origine-----
> De : Gary Kenaley [mailto:gkenaley@echelon.com]
> Envoyé : lun. 11 juin 2007 21:00
> À : Bill Gatliff; Laurent Lagrange
> Cc : linuxppc-embedded@ozlabs.org
> Objet : RE: Linux 2.6.x, MTD drivers and NAND flashes
> 
> 
> Laurent,
> 
> Can't you just use the flashcp copy command from the 
> mtd-utils package?
> --------------------------------------------------------------
> ---------
> flash_eraseall -j /dev/mtd0
> 
> mkfs.jffs2 -b -n --eraseblock=131072 --pagesize=2048 -p -r 
> /test_root -v -o test_root.img
> 
> flashcp test_root.img /dev/mtd0
> 
> 
> The other way is what Bill mentions:
> ------------------------------------
> flash_eraseall -j /dev/mtd0
> mount -t jffs2 /dev/mtdblock0 /tmp/mnt
> tar -xzf test_root.tgz -C /tmp/mnt
> umount /tmp/mnt
> 
> Gary

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 2264 bytes --]

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

* Re: Linux 2.6.x, MTD drivers and NAND flashes
  2007-06-11 15:20 Linux 2.6.x, MTD drivers and NAND flashes Laurent Lagrange
  2007-06-11 15:59 ` Bill Gatliff
@ 2007-06-12 13:37 ` Detlev Zundel
  1 sibling, 0 replies; 5+ messages in thread
From: Detlev Zundel @ 2007-06-12 13:37 UTC (permalink / raw)
  To: linuxppc-embedded

Hi Laurent,

> I use a Linux 2.6.9 on a 85xx custom board with a NAND flash.
>  
> This flash has some bad blocks.
> NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V
> 8-bit)
> Scanning device for bad blocks
> Bad eraseblock 8 at 0x00100000
> Bad eraseblock 430 at 0x035c0000
> ...
> Creating 1 MTD partitions on "NAND 128MiB 3,3V 8-bit":
> 0x00000000-0x08000000 : "flash partition 1".
>  
> I have selected in the kernel :
> 1) the MTD character and block supports for NAND,
> 2) the CRAMFS and JFFS2 supports for NAND.
>  
> I can erase the flash but receive IO errors for each bad blocks (that seems
> right).
> I can mount an empty JFFS2 partition on the NAND and untar some directories and
> files in it.
>  
> I would like to generate some JFFS2 images and program them in the flash with a
> character
> command like "cat img > /dev/mtd/0". If I dont encounter a bad block, it runs
> right else the
> command fails.
>  
> This is a little bit annoying. So my question is simple :
> Is there a MTD character driver which can detect and ignore the bad blocks in a
> NAND flash ? 

Actually there is the UBI[1] subsystem dedicated to this problem which
entered mainline late in April.  If you have that in your kernel, you
can feed your flash to UBI and get an bad-block aware mtd device out
of it.  This should allow your intended usage.  Of course you can have
JFFS2 sit on top of that.

Cheers
  Detlev

[1] http://www.linux-mtd.infradead.org/faq/ubi.html

-- 
I have always observed that the pretensions of all people are in
exact inverse ratio to their merits; this is one of the axioms of
morals.                            -- Joseph Lagrange
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu@denx.de

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

end of thread, other threads:[~2007-06-12 13:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-11 15:20 Linux 2.6.x, MTD drivers and NAND flashes Laurent Lagrange
2007-06-11 15:59 ` Bill Gatliff
2007-06-11 19:59   ` Gary Kenaley
2007-06-12 10:06     ` Laurent Lagrange
2007-06-12 13:37 ` Detlev Zundel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).