removed - more testing
[yaffs/.git] / Documentation / yaffs_on_mtd.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <HTML>
3 <HEAD>
4         <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
5         <TITLE></TITLE>
6         <META NAME="GENERATOR" CONTENT="StarOffice/5.2 (Linux)">
7         <META NAME="CREATED" CONTENT="20020517;23103700">
8         <META NAME="CHANGEDBY" CONTENT=" ">
9         <META NAME="CHANGED" CONTENT="20020518;7200400">
10 </HEAD>
11 <BODY>
12 <H2 ALIGN=CENTER>Running up YAFFS using the MTD interface</H2>
13 <P>Here are  the steps required to get YAFFS going with the
14 NANDemulation MTD that I have written.</P>
15 <P><FONT COLOR="#800000"><FONT SIZE=4 STYLE="font-size: 16pt"><I><U><B>Warning:
16 This is experimental stuff that plugs into the kernel. It has only
17 been lightly tested. Don't play with this on a box you are not
18 prepared to reboot.</B></U></I></FONT></FONT></P>
19 <P>There are a few things you need to do. This document assumes that
20 you're working from the 2.4.18 kernel code base.</P>
21 <H3>Preparing the kernel</H3>
22 <P>First off, you need to patch the mtdcore services.</P>
23 <OL>
24         <LI><P>Replace the devices/mtd/mtdpart.c file with the one enclosed.
25         This patches the problem where special NAND functions are not being
26         copied through the partition handler. The changes are marked with a
27         comment containing my initials <B><FONT FACE="Courier, monospace">cdhm</FONT></B>.</P>
28         <LI><P>Build the kernel including the following configurations to
29         support mtd.</P>
30 </OL>
31 <P STYLE="margin-left: 2cm">CONFIG_MTD=y Turn on MTD support</P>
32 <P STYLE="margin-left: 2cm">CONFIG_MTD_PARTITIONS=y Turn on partition
33 support</P>
34 <P STYLE="margin-left: 2cm">CONFIG_MTD_CHAR=y Need char drivers to
35 access the data from user space.</P>
36 <P STYLE="margin-left: 2cm">CONFIG_MTD_BLOCK=y Block driver interface
37 used only to find the device for mounting</P>
38 <P STYLE="margin-left: 2cm">may as well also set:</P>
39 <P STYLE="margin-left: 2cm">CONFIG_MTD_DEBUG=y</P>
40 <OL>
41         <P>CONFIG_MTD_DEBUG_VERBOSE=3</P>
42         <H3 ALIGN=LEFT></H3>
43 </OL>
44 <H3 ALIGN=LEFT>Setting up yaffs</H3>
45 <OL>
46         <LI><P>Run the mtd utility MAKEDEV to make the /dev/mtdxxx entries.</P>
47         <LI><P>Load up the NANDemul MTD by typing<BR><FONT FACE="Courier, monospace">#/sbin/insmod
48         mtdemul/nandemul.o</FONT><BR>You should now be able to see the
49         device in the mtd list by typing  <BR>#<FONT FACE="Courier, monospace">cat
50         /proc/mtd</FONT><BR>If all is well, the device will now be
51         accessible as <FONT FACE="Courier, monospace">/dev/mtd0</FONT> and
52         <FONT FACE="Courier, monospace">/dev/mtdblock0</FONT> (or whatever).</P>
53         <LI><P>Now load up the yaffs filesystem module by
54         typing<BR><FONT FACE="Courier, monospace">#/sbin/insmod
55         mtdemul/yaffs.o<BR><FONT FACE="Times, serif">You should now be able
56         to see the yaffs file systems by typing</FONT><BR>#cat
57         /proc/filesystems</FONT></P>
58         <LI><P><FONT FACE="Times, serif">Now create a mount point:<BR><FONT FACE="Courier, monospace">#mkdir
59         /mnt/y</FONT></FONT></P>
60         <LI><P><FONT FACE="Times, serif">Mount the file system:<BR><FONT FACE="Courier, monospace">#mount
61         -t yaffs /dev/mtdblock0 /mnt/y</FONT></FONT></P>
62         <LI><P><FONT FACE="Times, serif">Well if that all worked you have
63         YAFFS running on the /mnt/y mount point using the NANDemul mtd.</FONT></P>
64 </OL>
65 <H3>What about real NAND?</H3>
66 <P><FONT FACE="Times, serif">You might want to try getting going on a
67 real NAND device.</FONT></P>
68 <P><FONT FACE="Times, serif">I have not yet done this, but the
69 NANDemul tests out the mtd interface so in theory it should work on
70 real NAND too.</FONT></P>
71 <P><FONT FACE="Times, serif">Note though that since YAFFS applies the
72 ECC, it does not expect the NAND device to be applying ECC.  You
73 probably want to configure the NAND driver with ECC disabled.</FONT></P>
74 <P><BR><BR>
75 </P>
76 </BODY>
77 </HTML>