一. 移植环境
主机:虚拟机fedora9
目标机:自己的2440板
交叉编译器:友善的arm-linux-gcc4.3.2
内核版本: linux-2.6.32.2.tar.bz2
二、移植步骤
解压内核:tar -jxvf linux-2.6.32.2.tar.bz2
cd linux-2.6.32.2
修改Makefile 183行 184行:gedit Makefile
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
测试环境:make s3c2410_defconfig;make
结束后检查arch/arm/boot/目录下是否生成了zImage文件
修改晶振频率 163行:gedit arch/arm/mach-s3c2440/mach-smdk2440.c
s3c24xx_init_clocks(12000000);
修改MTD分区信息 110行,要和bootloader的分区一致:gedit arch/arm/plat-s3c24xx/common-smdk.c
修改此结构体为static struct mtd_partition smdk_default_nand_part[] ={
[0] = {
.name = "jdboot",
.offset = 0,
.size = 0x00100000,
},
[1] = {
.name = "kernel",
.offset = 0x00100000,
.size = 0x00300000,
},
[2] = {
.name = "rootfs",
.offset = 0x00400000,
.size = 0x07c00000,
},
[3] = {
.name = "program",
.offset = 0x08000000,
.size = 0x18000000,
},
[4] = {
.name = "userfs",
.offset = 0x20000000,
.size = 0x1c400000,
},
[5] = {
.name = "jdboot1",
.offset = 0x3c400000,
.size = 0x00100000,
},
[6] = {
.name = "kernel1",
.offset = 0x3c500000,
.size = 0x00300000,
},
[7] = {
.name = "rootfs1",
.offset = 0x3c800000,
.size = 0x03600000,
}
}
修改ECC校验:gedit drivers/mtd/nand/s3c2410.c
在static void s3c2410_nand_init_chip函数最后加一句
chip->ecc.mode = NAND_ECC_NONE;
修改机器码 379行:gedit arch/arm/tools/mach-types
s3c2440 ARCH_S3C2440 S3C2440 782
拷贝友善的linux-2.6.29/fs下的yaffs2文件夹到linux-2.6.32.2/fs目录下(这一步比较关键,也耗费我好多时间,从网上下载的最新的yaffs2文件在启动后会报错,无法正常启动,目前还不知道原因)
修改yaffs2文件配置:gedit fs/Kconfig 在177行上添加
source "fs/yaffs2/Kconfig"
gedit fs/Makefile 在81行上添加
obj-$(CONFIG_YAFFS_FS) += yaffs2/
开始配置内核:
make s3c2410_defconfig
make menuconfig
1> [*]Enable loadable module support--->
[*]Forced module loading
[*]Module unloading
2> System Type--->
S3C2410 Machines--->
[*]SMDK2410/A9M2410选上 其余不选
S3C2440 Machines--->
[*]SMDK2440
[*]SMDK2440 with S3C2440 CPU module,其余不选
3> Kernel Features--->
[*]Use the ARM EABI to compile the kernel
[*]Allow old ABI binaries to run with this kernel (EXPERIMENTA
4> Boot options--->
root=/dev/mtdblock2 rw noinitrd init=/linuxrc console=ttySAC0,115200
5> Userspace binary formats--->
[*]Kernel support for ELF binaries 其它的可以全部不选
6> Filesystem--->
Miscellaneous filesystems--->
<*>YAFFS2 file system support
[*] Lets Yaffs do its own ECC
7>Native language support
<*>Codepage 437 (United States,Canada)
<*>Simplified Chinese charset(GB2312)
<*>Traditional Chinese charset(Big5)
<*>NLS ISO 8859-1(Latin1:Western European Languages)
<*>NLS UTF-8
保存,退出。
开始编译内核:make zImage
下载
运行
enjoy
当然你得先做好yaffs2文件系统