1、獲取yaffs2 源代碼
安裝git工具
clx@think:~$ sudo apt-get install git-core
然後運行
clx@think:/work/armlinux$ git clone git://www.aleph1.co.uk/yaffs2
Initialized empty Git repository in /work/armlinux/yaffs2/.git/
remote: Counting objects: 7556, done.
remote: Compressing objects: 100% (4654/4654), done.
remote: Total 7556 (delta 5977), reused 3624 (delta 2818)
Receiving objects: 100% (7556/7556), 3.56 MiB | 118 KiB/s, done.
Resolving deltas: 100% (5977/5977), done.
clx@think:/work/armlinux$ ls
linux-2.6.32.2 linux-2.6.32.2.tar.gz yaffs2
2、爲內核打上yaffs2補丁
clx@think:/work/armlinux$ cd yaffs2
clx@think:/work/armlinux/yaffs2$ ./patch-ker.sh c /work/armlinux/linux-2.6.32.2
usage: ./patch-ker.sh c/l m/s kernelpath
if c/l is c, then copy. If l then link
if m/s is m, then use multi version code. If s then use single version code
clx@think:/work/armlinux/yaffs2$ ./patch-ker.sh c m /work/armlinux/linux-2.6.32.2
Updating /work/armlinux/linux-2.6.32.2/fs/Kconfig
Updating /work/armlinux/linux-2.6.32.2/fs/Makefile
3、配置和編譯帶YAFFS2支持的內核
clx@thinclx@think:/work/armlinux/linux-2.6.32.2$ make menuconfig
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
make: *** [menuconfig] Error 2
google安裝clx@think:~$ sudo apt-get install ncurses-dev問題解決
此時可以運行配置界面
移動上下按鍵找到File Systems;
按回車進入該子菜單,再找到“Miscellaneous filesystems”菜單項;
按回車進入該子菜單,找到“YAFFS2 file system support”;
按空格選中它,這樣我們就在內核中添加了yaffs2文件系統的支持,按“Exit”退出內核配置,選中“Yes”保存。
4、編譯測試
將編譯好的zImage燒寫入開發板,啓動內核將能看到如下信息:
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
此時燒寫友善之臂提供的現成的yaffs2 文件系統映像rootfs_qtopia_qt4.img進行測試,就可以正常啓動內核了。