Running up YAFFS using the MTD interface

Here are the steps required to get YAFFS going with the NANDemulation MTD that I have written.

Warning: This is experimental stuff that plugs into the kernel. It has only been lightly tested. Don't play with this on a box you are not prepared to reboot.

There are a few things you need to do. This document assumes that you're working from the 2.4.18 kernel code base.

Preparing the kernel

First off, you need to patch the mtdcore services.

  1. Replace the mtd files with the latest from the mtd cvs. This fixes problems where special NAND functions are not being copied through the partition handler.

  2. Build the kernel including the following configurations to support mtd.

CONFIG_MTD=y Turn on MTD support

CONFIG_MTD_PARTITIONS=y Turn on partition support

CONFIG_MTD_CHAR=y Need char drivers to access the data from user space.

CONFIG_MTD_BLOCK=y Block driver interface used only to find the device for mounting

may as well also set:

CONFIG_MTD_DEBUG=y

    CONFIG_MTD_DEBUG_VERBOSE=3

Setting up yaffs

  1. Run the mtd utility MAKEDEV to make the /dev/mtdxxx entries.

  2. Load up the NANDemul MTD by typing
    #/sbin/insmod mtdemul/nandemul.o
    You should now be able to see the device in the mtd list by typing
    #cat /proc/mtd
    If all is well, the device will now be accessible as /dev/mtd0 and /dev/mtdblock0 (or whatever).

  3. Now load up the yaffs filesystem module by typing
    #/sbin/insmod mtdemul/yaffs.o
    You should now be able to see the yaffs file systems by typing
    #cat /proc/filesystems

  4. Now create a mount point:
    #mkdir /mnt/y

  5. Mount the file system:
    #mount -t yaffs /dev/mtdblock0 /mnt/y

  6. Well if that all worked you have YAFFS running on the /mnt/y mount point using the NANDemul mtd.

What about real NAND?

You might want to try getting going on a real NAND device.

I have not yet done this, but the NANDemul tests out the mtd interface so in theory it should work on real NAND too.

Note though that since YAFFS applies the ECC and verify, it does not expect the NAND device to be applying ECC or verification.

You probably need to configure the NAND with the following disabled:

CONFIG_MTD_NAND_ECC

CONFIG_MTD_NAND_VERIFY_WRITE

Nick Banes has had YAFFS working on real NAND, with a few issues.



$Id: yaffs_on_mtd.html,v 1.3 2002-11-26 01:15:38 charles Exp $