[U-Boot] u-boot: How to read file from FAT filesystem on NorFlash MTD partition

Stefan Roese sr at denx.de
Tue Dec 1 15:25:33 CET 2009


Hi,

sorry for jumping in so late, but Wolfgang just broughtthis thread to my 
attention. So here are my ideas and comments to your approach/patch:

> >   * Which command can do this? (fatload seems can not because the
> > interface is not known)
> >   * From which verion u-boot supports this feature? Our u-boot is based
> > v2009.08. Do we
> >     need to update to latest one? (v2009.11-rc1)
> >
> > I check the document and didn't found the answer. So I have to write it
> > by myself.
>
> I created a patch which provide two functions:
>   fat_norflash_init()
>   fat_norflash_load()
>
> The user call these function in sequence to read file from FAT file system
> on Nor Flash.

It's possible to do it this way of course, but we really shouldn't go this 
way. The "right way" to implement FAT support on NOR FLASH would be to add a 
small block layer to the MTD devices. And MTD block device could then be used 
by the existing file system drivers (e.g. fatls etc).

We already can export the NOR FLASH as an MTD device, using the 
CONFIG_FLASH_CFI_MTD config option. It shouldn't be too hard to add a block 
layer over this MTD device, like done in the Linux kernel 
(drivers/mtd/mtdblock_ro.c).

This approach has multiple advantages:

- Multiple file systems will be usable (FAT, EXT2 etc.)
- Multiple MTD devices will be supported (NOR, NAND etc.)

It would be great if you could rework your patch according to my suggestions.

Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de


More information about the U-Boot mailing list