1
修改
linux2.6.14
下面的
makefile
文件
找到
ARCH
和
CROSS_COMPILE
,
修改
ARCH ?= arm
CROSS_COMPILE ?= /usr/local/arm/3.4.1/bin/arm-linux-
(
此处为你交叉编译的路径
)
2
设置
flash
分区
在
arch/arm/machs3c2410/devs.c
文件中添加头文件
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
#include <asm/arch/nand.h>
然后建立分区表
/*
一个
Nand Flash
总共
64MB,
按如下大小进行分区 分区大小自己看着办
*/
static struct mtd_partition partition_info[] ={
{ /* 1MB */
name: "vivi",
size: 0x00100000,
offset: 0x0,
},{ /* 3MB */
name: "kernel",
size: 0x00300000,
offset: 0x00100000,
}, { /* 40MB */
name: "root",
size: 0x02800000,
offset: 0x00400000,
}, { /* 20MB */
name: "user",
size: 0x00f00000,
offset: 0x02d00000,
}
};
/*加入Nand Flash分区*/
struct s3c2410_nand_set nandset ={
nr_partitions: 4, /*指明partition_info中定义的分区数目*/
partitions: partition_info, /* partition table分区信息表*/
};
/*建立Nand Flash芯片支持*/
struct s3c2410_platform_nand superlpplatform={
tacls:0,
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};
tacls, twrph0, twrph1
的意思见
S3C2410
手册的
63,
这
3
个值最后会被设置到
NFCONF
中
,
见
S3C2410
手册
66.
sets:
支持的分区集
nr_set:
分区集的个数
/*
加入
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
}
};
指定启动时初始化
arch/arm/machs-3c2410/mach-smdk2410.c
文件
找到
platform_device *smdk2410_devices[] __initdata
函数
,
在该函数体最后加上一条语句
:
&s3c_device_nand,
禁用禁止
Flash ECC
校验
(
有不同说法
)
修改
drivers/mtd/nand/s3c2410.c
找到
chip->eccmode = NAND_ECC_SOFT;
改为
chip->eccmode = NAND_ECC_NONE;
支持启动挂载
devfs
修改
fs/Kconfig
文件
找到
menu "Pseudo filesystems"
添加
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
default y
config DEVFS_MOUNT
bool "Automatically mount at boot"
default y
depends on DEVFS_FS
3
Yaffs2
文件系统支持
下载yaffs2.tar.gz
源码包,解压源码,并进入目录执行
#./patch-ker.sh c /linux-2.6.14.1/
注:假定内核源码在/linux-2.6.14.1/
4
编译配置内核
,
首先先
load
一个默认的内核
/linux-2.6.14/arch/arm/configs/smdk2410_defconfig,
在这个配置文件上改
Loadable module support >
[*] Enable loadable module support
[*] Automatic kernel module loading
System Type >
[*] S3C2410 DMA support
Boot options >
Default kernel command string:
noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200
Floating point emulation >
[*] NWFPE math emulation
Device Drivers >
Memory Technology Devices (MTD) >
[*] MTD partitioning support
#支持MTD分区,这样我们在前面设置的分区才有意义
[*] Command line partition table parsing
#支持从命令行设置flash分区信息,灵活
RAM/ROM/Flash chip drivers >
<*> Detect flash chips by Common Flash Interface (CFI) probe
<*> Detect nonCFI AMD/JEDECcompatible flash chips
<*> Support for Intel/Sharp flash chips
<*> Support for AMD/Fujitsu flash chips
<*> Support for ROM chips in bus mapping
NAND Flash Device Drivers >
<*> NAND Device Support
<*> NAND Flash support for S3C2410/S3C2440 SoC
Character devices >
[*] Nonstandard serial port support
[*] S3C2410 RTC Driver
File systems >
<> Second extended fs support #
去除对
ext2
的支持
Pseudo filesystems >
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)
[*] /dev file system support (OBSOLETE)
[*] Automatically mount at boot (NEW)
#
这里会看到我们前先修改
fs/Kconfig
的成果
,devfs
已经被支持上了
Miscellaneous filesystems >
<*> Compressed ROM file system support (cramfs) #
支持
cramfs
<*> YAFFS2 file system support
#
支持
yaffs2
Network File Systems >
<*> NFS file system support