这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » linux2.6.14内核+yaffs系统移植

共1条 1/1 1 跳转至

linux2.6.14内核+yaffs系统移植

专家
2009-03-25 12:06:37     打赏
linux2.6.14内核+yaffs系统移植

 

rar----------------------编译内核-----------------
修改 Makefile
主要是以下两项:
1 ) ARCH = arm
2) CROSS_COMPILE = /arm-linux-
选中 load an Alternate Configuration File ,然后键入配置文件的路径。
在我刚编译内核的时候选择的是 linux-2.6.14/arch/arm/configs/smdk2410_defconfig 这个配置文件。
-------------------让内核支持 yaffs 文件系统----------
1. MTD 分区的支持
进入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  --->                                    │ │

进入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                                 │ │

其它不用多设,甚至 Direct char device access to MTD devices 选项和Mapping drivers for chip access  ---> 目录下的所有选项都可以去掉(经已试验过) 。因为那些是为 nor flash 服务的,一般文件系统都会放在 nand flash 上吧,不过也不排除例外。那你就干脆让它们留着好了,因为编译出来后实在多不了多少,我把它们去掉的原因只是为了试验 ^_^
-----------------------添加驱动---------------------
vi arch/arm/mach-s3c2410/devs.c
添加如下内容:
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
#include <asm/arch/nand.h>
...
/* NAND Controller */
1.建立Nand Flash分区表
/* 一个Nand Flash总共64MB, 按如下大小进行分区 */
static struct mtd_partition partition_info[] ={
[0] = {
.name = "bootloader",
.offset = 0x00000000,
.size = 0x00030000,
},
[1] = {
.name = "kernel",
.offset = 0x00030000,
.size = 0x00200000,
},
[2] = {
.name = "root",
.offset = 0x00230000,
.size = 0x03dcc000,
}
};
注:分区表信息要参考你自己的内核和文件系统的大小,排布来设置,vivi中的分区信息要和mtd分区信息一致,分多少个区由你自己决定,
2. 加入Nand Flash分区
struct s3c2410_nand_set nandset ={
nr_partitions: 3, /* the number of partitions */
partitions: partition_info, /* partition table */
};
nr_partitions: 指明partition_info中定义的分区数目
partitions: 分区信息表

3. 建立Nand Flash芯片支持
struct s3c2410_platform_nand superlpplatform={
tacls:0,
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};
4. 加入Nand Flash芯片支持到Nand Flash驱动
另外,还要修改此文件中的s3c_device_nand结构体变量,添加对dev成员的赋值
struct platform_device s3c_device_nand = {
.name = "s3c2410-nand",
/* Device name */
.id = -1,
/* Device ID */
.num_resources = ARRAY_SIZE(s3c_nand_resource),
.resource = s3c_nand_resource, /* Nand Flash Controller Registers */

/* Add the Nand Flash device */
 .dev = {
   .platform_data = &superlpplatform
 }
};
/*----------------------禁止Flash ECC校验(yaffs系统好像不用)---------
vi drivers/mtd/nand/s3c2410.c
找到s3c2410_nand_init_chip()函数,在该函数体最后加上一条语句:
chip>
eccmode = NAND_ECC_NONE;
保存,退出。*/
----------------------------指定启动时初始化--------------
kernel启动时依据我们对分区的设置进行初始配置修改arch/arm/mach-s3c2410/mach-smdk2410.
static struct platform_device *smdk2410_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
/* 添加如下语句即可 */
&s3c_device_nand,
};
--------------------内核加上对yaffs2支持-----------------
下载yaffs2.tar.gz源码包,解压源码,并进入目录执行
#./patch-ker.sh /linux-2.6.14.1/
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 Hills 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

在这里要说明一下以上的配置,在论坛发贴的时候我因为对它不怎么了解,几乎是全部选上的。后来经过自己的理解和摸索,发现:
1、 ---   2048 byte (or larger) / page devices   目录以下全部不用选,因为这是 yaffs2 文件系统的,如果你是用 yaffs 文件系统的话就不必选择这个了 ( 我到现在还没去研究 yaffs2 比 yaffs 文件系统优越多少,反正 yaffs 文件系统用得好好的 )  
2、 Lets Yaffs do its own ECC 这一项,网上很多人说 yaffs 文件系统和 mtd 驱程的更新速度问题,导致加上 ecc 检测后,会挂不了 yaffs 文件系统,所以要把 mtd 驱程的 ecc 检测去掉,让 yaffs 自己做 ecc 检测(就是要选上这一项)。不过去掉 mtd 驱程 ecc 检测的后果就是换来烦人的 Reading data from NAND FLASH without ECC is not recommended 的提示,后来发现原来把 mtd 驱程的 ecc 检测加回去,也可以很好的支持 yaffs 文件系统,所以就把这一项去掉了,终于可以不用再看那烦人的提示了 ^_^
-----------------------devfs-----------------------
拷贝下面几项到2.6.14的fs/Kconfig中去:
找到menu "Pseudo filesystems"
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
depends on EXPERIMENTAL
help

config DEVFS_MOUNT
bool "Automatically mount at boot"
depends on DEVFS_FS
help

config DEVFS_DEBUG
bool "Debug devfs"
depends on DEVFS_FS
help

重新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
顺便说一下,在内核配置的时候经常会看到 debug 选项吧?这是为了调度内核用的,你不需要的话可以去掉。有时还会让你选择 quiet 和 nosy ,选择 nosy 的话输出的调试信息当然会比 quiet 要多了。

 

保存。

make zImage




关键词: linux2.6.14     内核     +yaffs     系统         

共1条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]