Skip to contentSkip to conversation

FAT file system on NAND flash memory

DISCUSSION Seongsu Lee 3 participants 7 messages Apr 12, 2007 – May 29, 2007 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Please let me know if it is wrong.

Signature · 4 lines
Seongsu's personal blog - http://www.senux.com/
LILO, you've got me on my knees! (from David Black,
[email protected], with apologies to Derek and the
Dominos, and Werner Almsberger)
#1 lore raw
Quoted 7 lines · Seongsu Lee

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

Quoted 7 lines

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Please let me know if it is wrong.

That layering is correct, but your results will be bad. mtdblock doesn't handle bad blocks. So if you have one in the middle of your filesystem, it will break things. You need some kind of translation layer if you're going to use NAND.

josh

#2 lore raw
Quoted 14 lines · Josh Boyer
Quoted 13 lines · Seongsu Lee

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Quoted 6 lines
Quoted 1 line

Please let me know if it is wrong.

That layering is correct, but your results will be bad. mtdblock doesn't handle bad blocks. So if you have one in the middle of your filesystem, it will break things. You need some kind of translation layer if you're going to use NAND.

Thank you for the reply.

Just one more question.

Could you tell me the reason that there is no translation layer code in MTD for bare flash memories?
(Because of patent or copyright? or technical reason? I wonder.)

Signature · 3 lines
Seongsu's personal blog - http://www.senux.com/
Beauty may be skin deep, but ugly goes clear to the
bone. -- Redd Foxx
#3 lore raw
Quoted 22 lines · Seongsu Lee
Quoted 14 lines · Josh Boyer
Quoted 13 lines · Seongsu Lee

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Quoted 6 lines
Quoted 1 line

Please let me know if it is wrong.

That layering is correct, but your results will be bad. mtdblock doesn't handle bad blocks. So if you have one in the middle of your filesystem, it will break things. You need some kind of translation layer if you're going to use NAND.

Quoted 6 lines

Thank you for the reply.

Just one more question.

Could you tell me the reason that there is no translation layer code in MTD for bare flash memories?

Because most users of MTD already handle bad blocks themselves on bare NAND. JFFS2, yaffs, etc. all have bad block handling contained within them.

UBI can be used for things that lack the proper translation themselves. JFFS2 can even run on top if a UBI volume. Perhaps you should check into that.

josh

#4 lore raw
In reply to Josh Boyer

Hi,

Quoted 14 lines · Josh Boyer
Quoted 13 lines · Seongsu Lee

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Quoted 7 lines
Quoted 1 line

Please let me know if it is wrong.

That layering is correct, but your results will be bad. mtdblock doesn't handle bad blocks. So if you have one in the middle of your filesystem, it will break things. You need some kind of translation layer if you're going to use NAND.

But UBI could be used between nand and mtdblock ?

Matthieu

#5 lore raw
Quoted 17 lines · Matthieu CASTET

Hi,

Quoted 14 lines · Josh Boyer
Quoted 13 lines · Seongsu Lee

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Please let me know if it is wrong.

That layering is correct, but your results will be bad. mtdblock doesn't handle bad blocks. So if you have one in the middle of your filesystem, it will break things. You need some kind of translation layer if you're going to use NAND.

But UBI could be used between nand and mtdblock ?

Yep, indeed it can.

josh

#6 lore raw
In reply to Josh Boyer
Quoted 14 lines · Josh Boyer
Quoted 13 lines · Seongsu Lee

Hi,

In my knowledge, mtdblock.c must be used to use FAT filesystem on bare NAND flash memories because NFTL is made only for a specific hardware, DiskOnChip.

(Layer 0) VFS
(Layer 1) FAT (or EXT2, EXT3)
(Layer 2) mtdblock.c (nftl.c can be used only with DiskOnChip) (Layer 3) NAND flash memory driver (vendor specific) (Layer 4) Physical NAND flash memory

Quoted 8 lines
Quoted 1 line

Please let me know if it is wrong.

That layering is correct, but your results will be bad. mtdblock doesn't handle bad blocks. So if you have one in the middle of your filesystem, it will break things. You need some kind of translation layer if you're going to use NAND.

josh

I did not know that ftl.c is can be used also in 'Layer 2' instead of dummy mtdblock.c. It's working. I confirmed that the ftl.c can be used on mtdram. I will test whether it works on a physical bare-nand flash memory. (maybe tomorrow)

Follow is what I have tested for a mtdram (64MB).

root@thermopylae:/mnt # modprobe mtdram

root@thermopylae:/mnt # modprobe mtdchar

root@thermopylae:/mnt # ftl_format /dev/mtd0
Partition size = 64 mb, erase unit size = 128 kb, 1 transfer units Reserved 5%, formatted size = 62883328 bytes
Erasing all blocks...
+++++++*+++++++*+++++++*+++++++*+++++++*+++++++*+++++++*+++++++*
Writing erase unit headers...
format successful.

root@thermopylae:/mnt # modprobe ftl

root@thermopylae:/mnt # lsmod

Module                  Size  Used by
ftl                    11404  0
mtd_blkdevs            10368  1 ftl
mtdchar                 9092  0
mtdram                  3972  0
mtdcore                 7172  6 mtd_blkdevs,mtdchar,mtdram
autofs4                22788  1
3c59x                  43560  0
b44                    27276  0
ext3                  122504  1
jbd                    59048  1 ext3

root@thermopylae:/mnt # mkfs.ext3 /dev/ftla
mke2fs 1.38 (30-Jun-2005)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
15360 inodes, 61408 blocks
3070 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=62914560
8 block groups
8192 blocks per group, 8192 fragments per group
1920 inodes per group
Superblock backups stored on blocks:

        8193, 24577, 40961, 57345

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.

root@thermopylae:/mnt # mount /dev/ftla /mnt/data0

root@thermopylae:/mnt # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda1 29G 9.7G 18G 36% /
tmpfs 507M 0 507M 0% /dev/shm

/dev/hdb1              95G  126M   90G   1% /mnt/data1
/dev/ftla              59M  5.2M   50M  10% /mnt/data0
Signature · 3 lines
Seongsu's personal blog - http://www.senux.com/
lp1 on fire (One of the more obfuscated kernel
messages)