全部博文(198)
分类:
2012-04-28 09:19:43
1,内核支持
YAFFS2是YAFFS的升级版,能更好的支持NAND FLASH,我们采用最新的YAFFS2文件系统。我们首先下载YAFFS文件系统。
下载完成以后解压着文件包,在文件包的根目录下面有个文件patch-ker.sh,我们执行这个文件,就可以很轻松的把yaffs2加入到内核中。具体命令是:
[root@localhost yaffs2]# sh patch-ker.sh /linux2.6_2410/linux-2.6.14
这里我们假设我们的linux2.6.14的内核在/linux2.6_2410/linux-2.6.14目录下。执行完成以后,我们的yaffs2已经加入到了内核,在内核的fs目录下你会发现多了一个yaffs2目录,在这个目录下是yaffs2的相关内容,在内核的配置菜单[File systems]à[miscellaneous filesystems]中增加了[Yaffs2 file systems support]选项。这个选项就是yaffs2的配置内容。我们可以选择这个选项的全部内容,保存配置,然后退到终端,输入make,重新编译内核,内核中就增加了对yaffs2文件系统的支持。
主要是把yaffs2文件系统的文件拷贝到fs目录,并修改Makefile 和 Kconfig文件。
在配置方面有些地方要注意一下,以下是我的配置信息:
1,首先make menuconfig,进入配置窗口,然后选择”load an Alternate Configuration File”
把arch/arm/configs/smdk2410_defconfig配置文件load进来。
2,进入Device Drivers->Memory Technology Devices(MTD)目录,配置界面如下:
Memory Technology Device (MTD) support
[ ] Debugging │ │
[ ] MTD concatenating support │ │
[*] MTD partitioning support │ │
[ ] RedBoot partition table parsing │ │
[ ] Command line partition table parsing │ │
[ ] ARM Firmware Suite partition parsing │ │
--- User Modules And Translation Layers │ │
[*] Direct char device access to MTD devices │ │
[*] Caching block device access to MTD devices │ │
[ ] FTL (Flash Translation Layer) support │ │
[ ] NFTL (NAND Flash Translation Layer) support │ │
[ ] INFTL (Inverse NAND Flash Translation Layer) support │ │
RAM/ROM/Flash chip drivers ---> │ │
Mapping drivers for chip access ---> │ │
Self-contained MTD device drivers ---> │ │
NAND Flash Device Drivers ---> │ │
3,进入NAND Flash Device Drivers目录,配置界面如下:
[*] NAND Device Support │ │
[ ] Verify NAND page writes │ │
[*] NAND Flash support for S3C2410/S3C2440 SoC │ │
[*] S3C2410 NAND driver debug │ │
[ ] S3C2410 NAND Hardware ECC │ │
[ ] DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplement│ │
[ ] Support for NAND Flash Simulator │ │
回到File systems->Miscellaneous filesystems目录,配置信息如下:
[*] YAFFS2 file system support │ │
--- 512 byte / page devices │ │
[*] Lets Yaffs do its own ECC │ │
[*] Use the same ecc byte order as Steven Hill's nand_ecc.c │ │
--- 2048 byte (or larger) / page devices │ │
[*] Autoselect yaffs2 format │ │
[*] Disable lazy loading │ │
[*] Turn off wide tnodes │ │
[*] Turn off debug chunk erase check │ │
[*] Cache short names in RAM
从2.6.12的fs/Kconfig中拷贝下面几项到2.6.14的fs/Kconfig中去:
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
depends on EXPERIMENTAL
help
This is support for devfs, a virtual
file system (like /proc) which
If unsure, say N.
config DEVFS_MOUNT
bool "Automatically mount at boot"
depends on DEVFS_FS
help
This option appears if you have CONFIG_DEVFS_FS enabled. Setting
this to 'Y' will make the kernel automatically mount devfs onto /dev
when the system is booted, before the init thread is started.
You can override this with the "devfs=nomount" boot option.
If unsure, say N.
config DEVFS_DEBUG
bool "Debug devfs"
depends on DEVFS_FS
help
If you say Y here, then the /dev file system code will generate
debugging messages. See the file
details.
If unsure, say N.
重新make menuconfig 在File systems->Pseudo filesystems目录里面可以后到devfs的配置选项如下:
[*] /proc file system support │ │
[*] /dev file system support (OBSOLETE) │ │
[*] Automatically mount at boot │ │
[*] Debug devfs │ │
[*] Virtual memory file system support (former shm fs) │ │
[ ] Relayfs file system support
改变启动参数
noinitrd root=/dev/mtdblock/3 init=linuxrc console=ttySAC0,115200
好了,应该完成了,保存配置后,make 生成的zImage下载到flash中就可以成功挂载yaffs2文件系统了(我现在用的是原来2.4内核用的yaffs2文件系统,所以,我现在只是帮我的板换了个2.6的内核而已,下一步打算搞一个属于自己的文件系统,呵呵)。
/****************************
声明:
由于这次作Linux确实是第一次接触,大量查找了网上的资源,目的也就是编一个 最为简单的操作系统,于是乎所作步骤所写总结可能会很多copy自其他地方,敬请作者谅解
备注:
编译器版本:arm-linux-gcc3.4.5
参考文档:luofuchong在华恒上的帖子