天天看点

linux3.4.2移植总结(s3c2440)

环境:Linux version 3.5.0-23-generic ([email protected])

(gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) )

ubuntu12

目标板:JZ2440

待移植内核:3.4.2

交叉编译器:arm-linux-gcc-4.3.2

1.

make s3c2410_defconfig //使用默认配置

2.

修改时钟频率

linux-3.4.2/arch/arm/mach-s3c24xx/mach-smdk2440.c

公板上用的晶振和JZ2440的不一样,不修改会导致串口输出异常等
           
static void __init smdk2440_map_io(void)
{
        s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
        s3c24xx_init_clocks(); //改为12M
        s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
}
           

3.

修改分区信息

inux-3.4.2/arch/arm/mach-s3c24xx/common-smdk.c

分区大小要和uboot的对应,否则会出错

我修改nand分区如下

/* NAND parititon from 2.4.18-swl5 */

static struct mtd_partition smdk_default_nand_part[] = {
        [] = {
                .name   = "Boot Agent",
                .size   = SZ_256K,
                .offset = ,
        },
        [] = {
                .name   = "params",
                .offset = MTDPART_OFS_APPEND,
                .size   = SZ_128K,
        },
        [] = {
                .name   = "kernel",
                .offset = MTDPART_OFS_APPEND,
                .size   = SZ_2M,
        },
        [] = {
                .name   = "rootfs",
                .offset = MTDPART_OFS_APPEND,
                .size   = MTDPART_SIZ_FULL,
        }
};
           
linux3.4.2移植总结(s3c2440)

这是我内核分区后启动打印的信息

4.

由于JZ2440使用的是nand flash所以我们使用yaffs文件系统,3.4.2默 认没有支持yaffs,我们要自己移植,具体就不描述了,提一句的是注意yaffs版本和内核版本匹配,否则会出现

Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b 错误 (具体解决和分析我会在后期博文写)

我使用是xshell,如果出现内核启动出现乱码可以试试设置下环境变量

set bootargs root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200

这里要提一句,我用arm-unknown-linux-gnueabi-gcc-4.6.3 编译时,内核会卡在

Uncompressing Linux… done, booting the kernel.

Booting Linux on physical CPU 0

估计是编译器版本太高

System Type  --->    
      (0) S3C UART to use for low-level messages     
  这个表示使用串口0打印信息如果使用其他板子,要注意下这里。
           

完事后内核就ok了

/*******************************************************/
           
这里说下我文件系统制作的坑

1.注意文件的权限,最好给make install 后的文件夹给个chmod 777 xxx 的权限
2.在指定编译器时最好直接修改Makefile
    CROSS_COMPILE ?= arm-linux-
    ARCH ?= arm
3.如果是动态链接的话我是复制了
   编译器目录/arm-none-linux-gnueabi/libc/armv4t/lib
   里的库启动成功的
           

继续阅读