當然如果你的NAND FLASH只是512+16B的,可以只移植yaffs,因為即使你移植了yaffs2,它也會自動選擇掛載yaffs1的。
#cd /public
#tar zxf yaffs2.tar.gz
則/public/yaff2/ 目錄之下即是yaffs2的源碼。
(2)在要移植的內(nèi)核目錄下建立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
在編譯內(nèi)核時選擇:
<*> 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) 編譯內(nèi)核make zImage
看網(wǎng)上有人編譯過程中出現(xiàn)了問題, 我沒有碰到任何問題,很順利。
By the way : 編譯yaffs時出現(xiàn)了問題,編譯通過不了,這也是我選擇yaff2 而沒有選yaffs的一大原因。
(6) 現(xiàn)在板子上跑的是2.4的內(nèi)核,將板子上的根文件系統(tǒng)換為yaffs文件系統(tǒng)。具體過程參見文檔。
然后在vivi >param set linux_cmd_line "noinitrd root=/dev/mtdblock/3 init=/linuxrc console=ttySAC0"
修改啟動參數(shù),然后燒寫剛才生成的2.6的內(nèi)核。
(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.