/*2010.12.08--2010.12.24*/
/*kernel(linux-2.6.22.6)--到fl2440(s3c2440)移植(1)*/
/*操作系统: ubuntu-10.10*/
/*交叉编译工具: 编译uboot-1.1.4用cross-3.3.2.tar.bz2 ; 编译linux2.6.22.6用cross-3.4.1.tar.bz2*/
1.修改uboot1.1.4:
(1) vi include/asm-arm/mach-types.h 添加:
#define MACH_TYPE_SMDK2440 362 /*和linux2.6.22.6中arch/arm/tools/mach-types中s3c2440序号对应*/
(2) vi board/fl2440/fl2440.c
115行(gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;)改为:
gd->bd->bi_arch_number = MACH_TYPE_SMDK2440;
(3) vi include/configs/fl2440.c
添加:
#define CONFIG_SETUP_MEMORY_TAGS 1 /*允许向内核传递内存分布信息*/
#define CONFIG_CMDLINE_TAG 1 /*允许向内核传递命令行参数*/
#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm 0x32000000" /*通过TFTP下载主机上的uImage到开发板内存0x32000000,并启动内核*/
#define CONFIG_BOOTARGS "noinitrd root=/dev/nfs nfsroot=192.168.0.22:/home/arm/rootfs ip=192.168.0.11:192.168.0.22:192.168.0.33:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0,115200" /*给内核的参数,参数意义可参考内核源码下的Documentation/nfsroot.txt*/
2.修改linux-2.6.22.6顶层Makefile:
185行:ARCH ?= $(SUBARCH) -> ARCH ?= arm
186行:CROSS_COMPILE ?= -> CROSS_COMPILE ?= arm-linux-
3.vi arch/arm/mach-s3c2440/mach-smdk2440.c
s3c24xx_init_clocks(16934400); -> s3c24xx_init_clocks(12000000); /*外部晶振12MHz*/
4.修改MTD分区:
vi arch/arm/plat-s3c24xx/common-smdk.c
修改smdk_default_nand_part函数为:
5.添加yaffs文件系统支持:
tar zxvf yaffs_source.tar.gz /*产生Development目录*/
cd Development/yaffs2/
./patch-ker.sh c ~/dev_home/kernel/linux-2.6.22.6/
配置内核(make menuconfig):
File systems-->Miscdllaneous filesystems--><*>YAFFS2 file system support
到此内核已经可以跑了,只是因为缺少根文件系统所以最终会产生panic信息!
6.移植根文件系统:
(1)建立根文件系统目录:
cd ~
mkdir rootfs
chmod 777 rootfs