Subject: Re: Flash translation layer
To: Perry E. Metzger <perry@piermont.com>
From: Herb Peyerl <hpeyerl@beer.org>
List: tech-embed
Date: 10/04/2005 14:03:30
On 4-Oct-05, at 1:43 PM, Perry E. Metzger wrote:
>> If anyone could offer me some pointers (or a mentorship!) or let me
>> know if it was decided that this wasn't needed, had already been  
>> done,
>> etc then it would be much appreciated!
>
> I haven't looked at the web page for SoC, but the general problem is
> to produce a set of drivers so that a chunk of flash memory can be
> used effectively as a disk. As I recall, the primary issue is wear
> leveling. There are, however, lots of references on the net for wear
> leveling algorithms and you should be able to implement one pretty
> easily.
>
> You might also want to study how the Linux stuff works, if only to get
> ideas for the interface, and check (I haven't in a while) whether
> there is code to do any of this stuff in FreeBSD or OpenBSD that might
> be of use.
>
> In theory, one could produce a new file system specifically geared to
> the needs of flash memory, and that might be a lot more efficient than
> a wear leveling adaptation layer, but that is a much more ambitious
> project and I would try the simpler one first.

I have the misfortune of having experience with the Linux Flash  
'stuff'.  You want to look at 'mtd' (memory technology device) for  
the flash driver, and 'jffs2' which is the filesystem layer that is  
commonly used over top of an mtd partition.

Quick example:

Creating 8 MTD partitions on "IXP2000 flash":
0x00000000-0x00040000 : "RedBoot"
0x00040000-0x00140000 : "diag"
0x00140000-0x00200000 : "linux"
0x00200000-0x00560000 : "unallocated"
0x00560000-0x00640000 : "linux_kern"
0x00640000-0x01fe0000 : "unallocated"
0x01fe0000-0x01fff000 : "FIS directory"
0x01fff000-0x02000000 : "RedBoot config"

Under Linux, each of those partitions is mapped to a /dev/mtd/N where  
N is the partition number (0-7 in the above case) as well as /dev/ 
mtdblock/N for the block devices.