Reduce boot time with jffs2 and CM-X255

Ricard Wanderlof ricard.wanderlof at axis.com
Wed Dec 20 04:17:04 EST 2006


On Wed, 20 Dec 2006, Michel LECONTE wrote:

> I use a CM-X255 with a NAND Flash of 512 Mo
> where roughly 250 Mo are used (90 Mo for the native distribution
> provided by Compulab and 160 Mo for specific applications).
>
> At the boot, there's a scanning of the MTD1 (4096 blocks) corresponding
> to the NAND Flash.
> This scanning takes 1mn20s. The full boot time, from a reset to the
> login prompt, takes 4mn.
>
> I hope that these precisions can be useful.

I don't know if this helps, but I have noted that when mounting a flash 
partition which contains lots of erased blocks/sectors, that jffs2 after 
the mount has completed in the background (re-)erases the blocks and 
writes cleanmarkers to them (the logic of this is clearly explained in the 
JFFS2 documentation on the mtd home page). For NOR flash, this can be 
alleviated easily by instructing mkfs.jffs2 to add cleanmarkers to unused 
parts of the image. For NAND flash, the cleanmarkers are stored in the 
out-of-band (OOB) area, which is normally not part of an image; 
consequently, it is easier to leave it up to jffs2 on the target system to 
erase and write cleanmarkers, which takes time, or at least takes up 
system resources, causing other processes to run slower. Admittedly, NAND 
is faster than NOR, but then you've got quite a lot of empty flash too 
(250 MB).

I don't know what the solution is - one idea is that a program like 
nandwrite could be instructed to write cleanmarkers to the OOB of unused 
parts of a partition. Currently there is no support for this but it could 
be added.

Hm, sidetracking here a bit, I'm thinking a general erase + write image 
utility for NAND flash would be useful, given that bad block management 
gets a bit hairy when you write to NAND and the write fails - should the 
block be re-erased (not really part of a nand writing tool's job) and 
retried, or just marked as bad (because most likely the block had recently 
been erased by an erasing tool)? Having erase+write in the same tool would 
make it easier for the tool to manage this, and it could also write jffs2 
cleanmarkers to the oob as part of the whole procedure.

Except for testing, most of the flash writing I come across is writing a 
complete image (usually jffs2, but also boot images) to a flash partition.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30




More information about the linux-mtd mailing list