天天看點

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
   裡的庫啟動成功的
           

繼續閱讀