[ELDK] Erasing NAND Flash rootfs and 2minutes

Detlev Zundel dzu at denx.de
Wed Sep 1 11:46:22 CEST 2010


Hi J.Hwan Kim,

> I'm using ELDK 4.2 for arm and root filsystem made by following DULG.
> My platform is using NAND flash as MTD device.
> NAND memory map is as follows :
>
> 0x00000-200000 : ATMEL boot strap code
> 0x20000-60000 : U-boot
> 0xA0000-2A0000 : Kernel
> 0x2A0000-0x10000000 : Root File System

Ok, so you have ~253MiB rootfs.

> When I write root file system, I uses command in u-boot as follows:
>
>  > tftp 0x22000000 70.7.44.102:root.jffs2
>  > nand erase 0x2a0000 0xfd60000
>  > nand write.jffs2 0x22000000 0x2a0000 0x3a0000
>
> It writes well.

Yes, you completely erased the whole NAND and you have written only
3.625 MiB - all the rest is really empty.

> However, the machine operates  abnormally  during first 2minutes,
> after erasing  root file system area and write  root file system.
>
> It cannot run some system command such as "system("reboot")" in program
> and also in shell. The timer seems operates 2times over than my setting.
> For example , the LED  blinks  per 2second,  which  I  set  1second.
>
> After  2minutes  after erasing flash memory, all operation come back 
> normally.
> For exmple, LED blinks in period I set, and "system("reboot")" works well.
>
> Who did ever see such a case before?
> I don't know what the kernel does in the first 2minutes with NAND Flash 
> root file system.

I don't know why the LED flashes faster, but the rest is expected
behaviour.  JFFS2 uses "clean markers" for its own infrastructure which
have to be present on the device.  When a device is completely clean, it
will write them byitself in a kernel thread in the background on the
first mount (see [1]).

> How can I fix the problem?

The only way to fix this is to pre-write the cleanmarkers.  In U-Boot
this should be done by "nand erase clean" and for Linux the solution
recommended in the FAQ[2] is to use the "flash-eraseall -j" command from
Linux.

Cheers
  Detlev

[1] http://www.linux-mtd.infradead.org/faq/jffs2.html
[2] http://www.linux-mtd.infradead.org/faq/nand.html

-- 
He who can properly define and divide is to be considered a god.
                                        -- Plato
--
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 at denx.de


More information about the eldk mailing list