Linux- 2.6.25 .3移植
linux- 2.6.25 .3稳定版发布,我们将该内核移植到S 3C 2410平台上,
环境:linux- 2.6.25.3
arm-linux-gcc 3.4.4
u-boot
busybox 1.10.1
硬件:JXARM9-2410开板板 是武汉创维特出的
下
面是移植的步骤:
编译内核:
1) 解压内核,当前目录为/home/wbzh/
tar jxvf /home/wbzh/linux- 2.6.25 .tar.bz2
cd /home/wbzh/linux- 2.6.25
2) 修改体系架构并指定交叉编译器
vi Makefile ,将193行和194行的
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?=
修改为
ARCH ?= arm
CROSS_COMPILE ?= arm-linux- #最后有“-”,Makefile会调用arm-linux-gcc
3) 载入默认配置
make s 3c 2410_defconfig
make menuconfig
System Type --->
S 3C 2400 Machines --->
S 3C 2410 Machines --->
S 3C 2412 Machines --->
S 3C 2440 Machines --->
S 3C 2442 Machines --->
S 3C 2443 Machines --->
去掉多余的开发板,只保留SMDK2410
Boot options --->
Default kernel command string
console=ttySAC0,115200 mem= 64M root=/dev/mtdblock0 rootfstype=jffs2 rw
console=ttySAC0,115200 console=tty0 mem= 64M root=/dev/mtdblock0 rootfstype=jffs2 rw
#说明:
#mtdblock0代表第1个flash分区,用来作根文件系统rootfs;
# console=ttySAC0,115200使kernel启动期间的信息全部输出到串口0上,波特率为115200;
# 2.6内核对于串口的命名改为ttySAC0,但这不影响用户空间的串口编程。
# 用户空间的串口编程针对的仍是/dev/ttyS0等
# mem= 64M 表示内存是 64M ,如果是32则设为 32M
在实践中,我发现“rootfstype= jffs 2 ” 这句还是挺重要的。
按Esc键保存退出。
编译内核、生成内核镜像文件。
make
内核镜像文件的存放位置:arch/arm/boot/zImage
4) 内核启动错误,及解决方法
Error: unrecognized/unsupported machine ID (r1 = 0x
33f
60264).
Linux内核启动时出现:bad machine ID,原因大致是u-boot传递给内核的machine ID错误,可以手动在内核源代码中添加machine ID.
解决方法
修改内核的arch/arm/kernel/head.S,直接将s
3c
2410的参数赋给内核
# cd linux-
2.6.25
.3
# vi arch/arm/kernel/head.S +72
----------------------------------------------
78 .type stext, %function
79 ENTRY(stext)
/********* add here *********/
mov r0, #0
mov r1, #0xc1
ldr r2, =0x30000100
/********* end add *********/
83 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode
84 @ and irqs disabled
5) 添加nand flash划分信息
vi arch/arm/plat-s 3c 24xx/common-smdk.c
115行 35 dd
109 static struct mtd_partition smdk_default_nand_part[] = {
110 [0] = {
111 .name = "Nand Flash Part 0",
112 .size = SZ_ 1M * 16,
113 .offset = 0,
114 },
115 };
6) 添加LCD驱动:
//porting frame buffer driver to s 3c 2410
//linux kernel 26.25.3
//LCD is 640X480 16BPP TFT
arch/arm/mach-s 3c 2410/mach-smdk2410.c
#include <asm/arch/fb.h>
/********************lcd start wbzh chd*************/
/* LCD driver info */
static struct s 3c 2410fb_display smdk2410_lcd_cfg __initdata = {
/* Configuration for 640x480 SHARP LQ080V3DG01 */
.lcdcon5 = S 3C 2410_LCDCON5_FRM565 |
S 3C 2410_LCDCON5_INVVLINE |
S 3C 2410_LCDCON5_INVVFRAME |
S 3C 2410_LCDCON5_PWREN |
S 3C 2410_LCDCON5_HWSWP,
.type = S 3C 2410_LCDCON1_TFT,
.width = 640,
.height = 480,
.pixclock = 40000, /* HCLK/4 */
.xres = 640,
.yres = 480,
.bpp = 16,
.left_margin = 44,
.right_margin = 116,
.hsync_len = 96,
.upper_margin = 19,
.lower_margin = 11,
.vsync_len = 15,
};
static struct s 3c 2410fb_mach_info smdk2410_fb_info __initdata = {
.displays = &smdk2410_lcd_cfg,
.num_displays = 1,
.default_display = 0,
.lpcsel = ((0xCE6) & ~7) | 1<<4,
};
/********************lcd end wbzh chd*************/
static void __init smdk2410_init(void)
{
//add by wbzh chd
s 3c 24xx_fb_set_platdata(&smdk2410_fb_info);
....
}
//在LCD上显示企鹅图标
make menuconfig
Device Drivers --->
Graphics support --->
[*] Bootup logo --->
---Bootup logox x
[*]Standard black and white Linux logo (NEW) x x
[*]Standard 16-color Linux logo (NEW) x x
[*] Standard 224-color Linux logo (NEW)
7) 编译并拷贝到tftp下载目录
make && cp arch/arm/boot/zImage /tftpboot/25zImage -f