ARM筆記:Linux内核移植到JZ2440
扫描二维码
随时随地手机看文章
一、准备工作:
1、Linux内核:Linux2.6.22.6,可从www.kernel.org上下载;
2、交叉工具编译链:arm-linux-gcc-3.4.5-glibc-2.3.6;
3、yaffs2文件代码;
4、ubuntu9.10;
5、JZ2440;
二、内核移植:
1、修改Makefile:
修改内核源码根目录下的Makefile文件
#ARCH?= arm
#CROSS_COMPILE?=arm-linux-
2、修改晶振
修改arch/arm/mach-s3c2440/mach-smdk2440.c
static void __init smdk2440_map_io(void)
{
s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
}
3、修改MTD分区:
修改文件 /arch/arm/plat-s3c24xx/common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "bootloader",
.offset = 0,
.size = 0x00040000,
},
[1] = {
.name = "params",
.offset = MTDPART_OFS_APPEND,
.size = 0x00020000,
},
[2] = {
.name = "kernel",
.offset = MTDPART_OFS_APPEND,
.size = 0x00200000,
},
[3] = {
.name = "root",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
}
};
再修改s3c2410_platform_nand_smdk_nand_info smdk_nand_info = {
…
.tacls = 0,
.twrph0 = 30,
.twrph1=0,
4、修改支持4.3寸LCD:
copy JZ2440光盘中的“4.3寸LCD_mach_smdk2440.c”文件覆盖arch/arm/mach-s3c2440/mach_smdk2440.c
5、向内核打yaffs2补丁
cd yaffs2
./patch-ker.sh c /linux-2.6.22.6
6、内核配置:
进入内核目录,cp /arch/arm/configs/s3c2410_defconfig .config
make menuconfig
修改配置:
①.General setup--->
[*] Configure standard kernel features (for small systems)--->
②. System Type ---->
[*] S3C2410 DMA support[*] Support ARM920T processor
S3C2410 Machines --->
[*] SMDK2410/A9M2410
S3C2440 Machines --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU module
③.Boot options--->
将(root=/dev/hda1 ro init=/bin/bash console=ttySAC0) Default kernel command string
改成(noinitrd root=/dev/mtdblock2console=ttySAC0,115200 init=/linuxrc)
这里要特别注意root=/dev/mtdblock2这个参数,mtdblock2是你的根文件系统所在的位置,和你在bootloader的分配有关,当然也和上述2。步骤的密切相关。不行的话多试几次。
④.[*] Enable loadable module support --->
[*]Module unloading
[*]Automatic kernel module loading
选择这两个,剩下的可以去掉
⑤.Device Drivers --->
<*> Memory Technology Device (MTD) support --->
[*]MTD partitioning support
<*> NAND Device Support --->
<*>NAND Flash support for S3C2410/S3C2440 SoC
[ ]S3C2410 NAND Hardware ECC//这个要去掉
⑥.File systems----->
Miscellaneous filesystems --->
<*>YAFFS2 file system support
7、make zImage
8、制作uImage
将uboot/tools目录下的mkimage文件拷备到交叉编译环境的BIN目录:
cd [uboot所在目录]/tools
cp mkimage /usr/local/arm/gcc-3.4.5-glibc-2.3.6/bin
mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -n linux-2.6.22.6 -d zImage uImage
即可生成支持U-BOOT的uImage镜像文件