今天终于让Linux内核在飞凌的板子上跑起来了,想来也是艰辛,为了移植成功,断断续续做了将近两个月的努力,期间郁闷不可言
语形容啊, 了解其中艰辛,将自己移植步骤与心得与大家分享,希望对初踏次领域之人有所帮助,我所写的成果一部分也是网上前
辈的所作,并非完全本人原创。
一、 移植环境
主 机:VMWare-Ubuntu
开发板:飞凌OK6410 nandflash,Kernel:2.6.36.2
编译器:arm-linux-gcc-4.3.2.tgz
u-boot:u-boot-1.1.6
注:编译器和u-boot 都是飞凌开发板自带的
二、 源码获得
内核源码到http://www.all.kernel.org/下载;
三、 移植步骤:
1.将Linux2.6.34.2内核源码放到工作目录文件夹下,并解压。
#tar xzvf linux2.6.36.2.tar.gz –c /
#pwd
/
# cd linux2.6.36.2
2. 修改内核源码根目录下的Makefile文件(CROSS_COMPILE =的值因个人情况而定,其他可以照做)
#gedit Makefile
......
#SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
# -e s/arm.*/arm/ -e s/sa110/arm/ \
# -e s/s390x/s390/ -e s/parisc64/parisc/ \
# -e s/ppc.*/powerpc/ -e s/mips.*/mips/ )
......
#ARCH ?= $(SUBARCH)
#CROSS_COMPILE ?=
ARCH = arm
CROSS_COMPILE = /usr/local/arm/usr/local/arm/4.3.2/bin/arm-none-linux- gnueabi-
3添加NandFlash分区信息.
修改arch/arm/mach-s3c64xx/mach-smdk6410.c文件,添加Nand Flash的分区信息和Nand Flash的硬件信息。(蓝色字体为添加部分)
#pwd
#gedit mach-smdk6410.c //add here 注意:此处的nandflash分区信息是飞凌自带的2.6.28的内核设置,由
于此处要用到uboot是飞凌的,所以分区信息也要按人家的来 添加头文件 #include
= {
{
.name = "Bootloader",
.offset = 0,
.size = (256*SZ_1K),
.mask_flags =MTD_CAP_NANDFLASH,
},
{
.name = "Kernel",
.offset = (256*SZ_1K),
.size = (4*SZ_1M) - (256*SZ_1K),
.mask_flags = MTD_CAP_NANDFLASH,
},
#if defined (CONFIG_SPLIT_ROOT_FILESYSTEM)
{
.name = "Rootfs",
.offset = (4*SZ_1M),
.size = (80*SZ_1M),//
},
#endif
{
.name = "File System",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
}
};
static struct s3c2410_nand_set s3c_nandset[]={
[0]= {
.name ="s3c24xx-nand",
.nr_chips = 1,
.nr_partitions =ARRAY_SIZE(s3c_partition_info),
.partitions =s3c_partition_info,
}
};
static struct s3c2410_platform_nand s3c_platform={
.tacls =25,
.twrph0 =55,
.sets = &s3c_nandset,
.nr_sets =ARRAY_SIZE(s3c_nandset),};
//add here…
static struct platform_device *smdk6410_devices[] __initdata = {
#ifdef CONFIG_SMDK6410_SD_CH0
&s3c_device_hsmmc0,
#endif
#ifdef CONFIG_SMDK6410_SD_CH1
&s3c_device_hsmmc1,
#endif
&s3c_device_i2c0,
&s3c_device_i2c1,
&s3c_device_fb,
&s3c_device_ohci,
&s3c_device_usb_hsotg,
&s3c64xx_device_iisv4,
//add here
&s3c_device_nand,
//add here…
}
static void __init smdk6410_map_io(void){
u32 tmp;
//add here
s3c_device_nand.name = "s3c6410-nand";
//add here…
…
}
static void __init smdk6410_machine_init(void){
u32 cs1;
s3c_i2c0_set_platdata(NULL);
s3c_i2c1_set_platdata(NULL);
s3c_fb_set_platdata(&smdk6410_lcd_pdata);
//add here
s3c_nand_set_platdata(&s3c_platform);//
//add here…
}
本篇文章来源于飞凌S3C6410论坛www.witech.com.cn 原文链接:http://www.linuxidc.com/Linux/2011-01/31185.htm