Nand flash file system favorites

Source: Internet
Author: User

Nand flash file system
Currently, Flash has many file systems, and jffs2 is widely used. The jffs2 File System Based on nor flash is quite mature, and jffs2 supporting NAND Flash has also been released. Source code can be downloaded on the http://www.linux-mtd.infradead.org. However, during my testing, the jffs2 file system attached to NAND Flash is unstable and CRC errors are often generated. Especially during write operations, each reset will produce a CRC error. It can be said that the jffs2 File System Supporting NAND Flash is not yet mature. The yaffs file system is designed for NAND Flash, and the source code can be
Http://www.aleph1.co.uk/yaffs/index.html. During the test, the stability performance is much more stable than that of the jffs2 file system, and the Mount partition time is much less than that of the jffs2 file system. It takes about 1 s to mount a 2 M file system with jffs2. The following describes how to use jffs2 and yaffs file systems in uClinux.
1. jffs2
Download the latest MTD and jffs2 packages from the http://www.linux-mtd.infradead.org. The package also contains Kernel patches and MTD-related tools. The major patch is ilookup-2.4.23.patch, because an ILookup () function is used in the latest MTD driver. After completing the patch, updating the MTD driver and jffs2 file system, I began to write my own NAND Flash Driver. If you do not want to use jffs2 as the root file system, you also need to modify mtd_block_major. For the driver, refer to the example. The simplest is to refer to SPIA. C.
The write driver mainly defines the flash partition structure, the flash read/write address, and the ** _ hwcontrol () function of the write control flash. The specific operation depends on the NAND flash chip used. The driver is much simpler than nor flash. :)
Configure after modification
Memory technology devices (MTD)
Config_mtd = y
Config_mtd_debug = y
Config_mtd_debug_verbose = 3
Config_mtd_partitions = y
Config_mtd_char = y
Config_mtd_block = y
Under NAND flash device drivers
Config_mtd_nand = y
Define your own driver File
Under file systems
Config_jffs2_fs = y
Config_jffs2_fs_debug = 2
Config_jffs2_fs_nand = y/* This is newly added */
Under uClinux v1.3.4 Configuration
Under Flash tools
Config_user_mtdutils = y
Config_user_mtdutils_erase = y
Config_user_mtdutils_eraseall = y
Config_user_mtdutils_mkfsjffs2 = y
Finally, debugging is hard. (After debugging the MTD driver, you can mount the jffs2 file system on it. See Flash partition: CAT/proc/MTD, erase partition: eraseall/dev/MTD *. For example, mount the first partition to the/mnt directory:
First: eraseall/dev/mtd0
Then: Mount-T jffs2/dev/mtdblock0/mnt
2. yaffs
Yaffs stands for 'yunanother flash File System' and is also an open-source file system. Yaffs is the only file system designed specifically for NAND Flash so far. It has good portability and can be used in Linux, uClinux, and wince.
Run the following command.
Download the source code at http://www.aleph1.co.uk/yaffs/index.html. The compressed package also contains the instructions for yaffs. The source files of the yaffs file system are devextras. H, yaffs_ecc.c, yaffs_ecc.h, yaffs_guts.c, yaffs_guts.h, yaffs_mtdif.h, yaffs_mtdif.c and yportenv.
In addition, the macros to be configured: config_yaffs_fs and config_yaffs_mtd_enabled are configured to mount yaffs on MTD, and other auxiliary configurations can also be configured as needed.
Create a yaffs directory under the FS directory and test the above files to create a new makefile:
O_target: = yaffs. o
OBJ-Y: = yaffs_fs.o yaffs_guts.o yaffs_mtdif.o yaffs_ecc.o
OBJ-M: = $ (o_target)
Include $ (topdir)/rules. Make
Next, change config. In And makefile under the FS directory, and connect yaffs When configuring yaffs.
If the nand mtd driver has been adjusted as before, it is easy to add yaffs. Because yaffs performs ECC verification on its own, we need to remove the ECC in The MTD driver. Change this-> eccmode = nand_ecc_none in the driver.
In addition, yaffs uses mkyaffs to erase flash, so mkyaffs. C is added to MTD-utils and compiled together.
Finally, it is compiled. There are some warnings in the middle that do not matter, that is, writing useless variables and functions. However, the code of yaffs is indeed not standardized. Of course, its performance does not have to be said. If you are interested, try it.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/iltaek/archive/2009/05/01/4140884.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.