Added docs and code for use with real MTD as well as emulation, and patched
[yaffs/.git] / Documentation / yaffs_on_mtd.html
diff --git a/Documentation/yaffs_on_mtd.html b/Documentation/yaffs_on_mtd.html
new file mode 100644 (file)
index 0000000..b994fba
--- /dev/null
@@ -0,0 +1,77 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+       <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
+       <TITLE></TITLE>
+       <META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Linux)">
+       <META NAME="CREATED" CONTENT="20020517;23103700">
+       <META NAME="CHANGEDBY" CONTENT=" ">
+       <META NAME="CHANGED" CONTENT="20020518;7200400">
+</HEAD>
+<BODY>
+<H2 ALIGN=CENTER>Running up YAFFS using the MTD interface</H2>
+<P>Here are  the steps required to get YAFFS going with the
+NANDemulation MTD that I have written.</P>
+<P><FONT COLOR="#800000"><FONT SIZE=4 STYLE="font-size: 16pt"><I><U><B>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.</B></U></I></FONT></FONT></P>
+<P>There are a few things you need to do. This document assumes that
+you're working from the 2.4.18 kernel code base.</P>
+<H3>Preparing the kernel</H3>
+<P>First off, you need to patch the mtdcore services.</P>
+<OL>
+       <LI><P>Replace the devices/mtd/mtdpart.c file with the one enclosed.
+       This patches the problem where special NAND functions are not being
+       copied through the partition handler. The changes are marked with a
+       comment containing my initials <B><FONT FACE="Courier, monospace">cdhm</FONT></B>.</P>
+       <LI><P>Build the kernel including the following configurations to
+       support mtd.</P>
+</OL>
+<P STYLE="margin-left: 2cm">CONFIG_MTD=y Turn on MTD support</P>
+<P STYLE="margin-left: 2cm">CONFIG_MTD_PARTITIONS=y Turn on partition
+support</P>
+<P STYLE="margin-left: 2cm">CONFIG_MTD_CHAR=y Need char drivers to
+access the data from user space.</P>
+<P STYLE="margin-left: 2cm">CONFIG_MTD_BLOCK=y Block driver interface
+used only to find the device for mounting</P>
+<P STYLE="margin-left: 2cm">may as well also set:</P>
+<P STYLE="margin-left: 2cm">CONFIG_MTD_DEBUG=y</P>
+<OL>
+       <P>CONFIG_MTD_DEBUG_VERBOSE=3</P>
+       <H3 ALIGN=LEFT></H3>
+</OL>
+<H3 ALIGN=LEFT>Setting up yaffs</H3>
+<OL>
+       <LI><P>Run the mtd utility MAKEDEV to make the /dev/mtdxxx entries.</P>
+       <LI><P>Load up the NANDemul MTD by typing<BR><FONT FACE="Courier, monospace">#/sbin/insmod
+       mtdemul/nandemul.o</FONT><BR>You should now be able to see the
+       device in the mtd list by typing  <BR>#<FONT FACE="Courier, monospace">cat
+       /proc/mtd</FONT><BR>If all is well, the device will now be
+       accessible as <FONT FACE="Courier, monospace">/dev/mtd0</FONT> and
+       <FONT FACE="Courier, monospace">/dev/mtdblock0</FONT> (or whatever).</P>
+       <LI><P>Now load up the yaffs filesystem module by
+       typing<BR><FONT FACE="Courier, monospace">#/sbin/insmod
+       mtdemul/yaffs.o<BR><FONT FACE="Times, serif">You should now be able
+       to see the yaffs file systems by typing</FONT><BR>#cat
+       /proc/filesystems</FONT></P>
+       <LI><P><FONT FACE="Times, serif">Now create a mount point:<BR><FONT FACE="Courier, monospace">#mkdir
+       /mnt/y</FONT></FONT></P>
+       <LI><P><FONT FACE="Times, serif">Mount the file system:<BR><FONT FACE="Courier, monospace">#mount
+       -t yaffs /dev/mtdblock0 /mnt/y</FONT></FONT></P>
+       <LI><P><FONT FACE="Times, serif">Well if that all worked you have
+       YAFFS running on the /mnt/y mount point using the NANDemul mtd.</FONT></P>
+</OL>
+<H3>What about real NAND?</H3>
+<P><FONT FACE="Times, serif">You might want to try getting going on a
+real NAND device.</FONT></P>
+<P><FONT FACE="Times, serif">I have not yet done this, but the
+NANDemul tests out the mtd interface so in theory it should work on
+real NAND too.</FONT></P>
+<P><FONT FACE="Times, serif">Note though that since YAFFS applies the
+ECC, it does not expect the NAND device to be applying ECC.  You
+probably want to configure the NAND driver with ECC disabled.</FONT></P>
+<P><BR><BR>
+</P>
+</BODY>
+</HTML>
\ No newline at end of file