(1)下载YAFFS文件系统代码,下载网址:
http://www.aleph1.co.uk/cgi-bin/viewcvs.cgi/
点击页面左下角的Download tarball即可下载全部相关代码。也可在此处下载
当然如果你的NAND FLASH只是512+16B的,可以只移植yaffs,因为即使你移植了yaffs2,它也会自动选择挂载yaffs1的。
#cd /public
#tar zxf yaffs2.tar.gz
则/public/yaff2/ 目录之下即是yaffs2的源码。
(2)在要移植的内核目录下建立yaffs2文件夹,并将需要的文件拷贝过来:
#cd /public/linux-2.6.11.7-2410/
# cd fs
# mkdir yaffs2
# cd yaffs2
# cp /public/yaffs2/*.h .
# cp /public/yaffs2/*.c .
# cp /public/yaffs2/Makefile-kernel Makefile
# cp /public/yaffs2/Kconfig .
(3)修改 /public/linux-2.6.11.7-2410/fs/Makefile 和 Kconfig文件。
# cd /public/linux-2.6.11.7-2410/fs/
# vi Makefile (将下面一行添加到Makefile中)
obj-$(CONFIG_YAFFS_FS) += yaffs2/
# vi Kconfig (将下面一行添加到Kconfig中)
source "fs/yaffs2/Kconfig
(4)cd /public/linux-2.6.11.7-2410/
make menuconfig
在编译内核时选择:
<*> YAFFS2 file system support
<*> 512 byte / page devices
<*> Lets Yaffs do its own ECC
<*> 2048 byte (or larger) / page devices
<*> Autoselect yaffs2 format
<*> Disable lazy loading
<*> Turn off wide tnodes
<*> Turn off debug chunk erase check
(5) 编译内核make zImage
看网上有人编译过程中出现了问题, 我没有碰到任何问题,很顺利。
By the way : 编译yaffs时出现了问题,编译通过不了, 这也是我选择yaff2 而没有选yaffs的一大原因。
(6) 现在板子上跑的是2.4的内核,将板子上的根文件系统换为yaffs文件系统。具体过程参见文档。
然后在vivi >param set linux_cmd_line "noinitrd root=/dev/mtdblock/3 init=/linuxrc console=ttySAC0"
修改启动参数,然后烧写刚才生成的2.6的内核。
(7) 启动成功。
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NetWinder Floating Point Emulator V0.95 (c) 1998-1999 Rebel.com
IrCOMM protocol (Dag Brattli)
yaffs: dev is 7939 name is "1f:03"
VFS: Mounted root (yaffs filesystem).
Mounted devfs on /dev
Freeing init memory: 76K
hub.c: USB new device connect on bus1/2, assigned device number 2
usb.c: USB device not accepting new address=2 (error=-110)
hub.c: USB new device connect on bus1/2, assigned device number 3
usb.c: USB device not accepting new address=3 (error=-110)
mount /etc as ramfs
re-create the /etc/mtab entries
/lib/yaffs.o: init_module: Device or resource busy
Hint: insmod errors can be caused by incorrect module parameters, including invsyaffs: dev is 7940 name is "1f:04"
console=/dev/coconsole=/dev/co?sole
init started: BusyBox v0.60.3 (2002.05.13-08:36+0000) multi-c?ll binary
Starting pid 20, console /dev/console: '/etc/init.d/rcS'
Waiting for enter to start '/bin/sh' (pid 25, terminal /dev/console)
Please press Enter to activate this console.
Starting pid 25, console /dev/console: '/bin/sh'
BusyBox v0.60.3 (2002.05.13-08:36+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.