一、下载并解压Linux2.6.24.7内核源码
从网上下载linux-2.6.24.7内核源码到/arm2410s目录下,并解压
#tar xzvf linux2.6.24.7.tar.gz
# cd linux2.6.24.7
进入内核解压后的目录
注:以后示例中,只要是相对路径全部是相对于/arm2410s/linux2.6.24.7/此目录
--------------------------------------------------------------------------------
二、修改内核源码根目录下的Makefile文件
#vi Makefile
修改Makefile中的ARCH和CROSS_COMPILE变量,修改为
ARCH = arm
CROSS_COMPILE = arm-linux- //该值是交叉编译器的前缀,具体值因人而异
注:arm和arm-linux-后面不能有空格,否则make menuconfig时会出现“/arm2410s/linux-2.6.24.7/arch/arm: 是一个目录”错误。
--------------------------------------------------------------------------------
三、设置nand flash分区信息
修改arch/arm/plat-s3c24xx/common-smdk.c文件,修改Nand Flash的分区信息和Nand Flash的硬件信息(这部分信息应该与vivi中的flash(mtd)分区对应起来,不可随便设置)。
(LED 器件的初始化也在这个文件里,但是博创的平台没有那四个LED管,所以要不要那些程序都无所谓。我就把它们放在那里,反正启动时不会有影响,也没有出错信息。)
修改的内容如下:
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "vivi",
.size = SZ_128K,
.offset = 0,
},
[1] = {
.name = "param",
.offset = SZ_128K,
.size = SZ_1M-SZ_128K,
},
[2] = {
.name = "kernel",
.offset = SZ_1M,
.size = SZ_1M * 3,
},
[3] = {
.name = "root",
.offset = SZ_4M,
.size = SZ_4M * 5,
},
[4] = {
.name = "user",
.offset = SZ_4M * 6,
.size = SZ_4M * 10,
},
};
注意:请不要画蛇添足地在进行自定义nand flash分区时仍然按照以前内核的移植步骤,在devs.c中自己添加分区信息,不然系统启动时会有出错信息:
kobject_add failed for s3c2410-nand with -EEXIST, don't try to register things with the same name in the same directory.
[<c00290a8>] (dump_stack+0x0/0x14) from [<c0110a9c>] (kobject_shadow_add+0x160/0x1a8)
[<c011093c>] (kobject_shadow_add+0x0/0x1a8) from [<c0110af8>] (kobject_add+0x14/0x18)
[<c0110ae4>] (kobject_add+0x0/0x18) from [<c015117c>] (device_add+0xa0/0x568)
[<c01510dc>] (device_add+0x0/0x568) from [<c0155180>] (platform_device_add+0x100/0x150)
[<c0155080>] (platform_device_add+0x0/0x150) from [<c01551f0>] (platform_device_register+0x20/0x24)
r7:c0022a10 r6:c0020a1c r5:00000000 r4:c02cab30
[<c01551d0>] (platform_device_register+0x0/0x24) from [<c01553f8>] (platform_add_devices+0x24/0x6c)
r4:00000000
[<c01553d4>] (platform_add_devices+0x0/0x6c) from [<c0011df4>] (smdk_machine_init+0x84/0x98)
r8:c03b8000 r7:00000000 r6:c0020a1c r5:00000000 r4:c0021404
[<c0011d70>] (smdk_machine_init+0x0/0x98) from [<c0011178>] (smdk2410_init+0x1c/0x24)
[<c001115c>] (smdk2410_init+0x0/0x24) from [<c000f0bc>] (customize_machine+0x20/0x2c)
[<c000f09c>] (customize_machine+0x0/0x2c) from [<c0008914>] (kernel_init+0xb8/0x284)
[<c000885c>] (kernel_init+0x0/0x284) from [<c003d688>] (do_exit+0x0/0x76c)
我一开始就犯了这个毛病。具体情况请参阅:以及/arch/arm/plat-s3c24xx文件夹下的common-smdk.c和devs.c。
--------------------------------------------------------------------------------
四、 禁止nand flash的ECC校验
修改文件drivers/mtd/nand/s3c2410.c文件,查找函数s3c2410_nand_init_chip(),在函数的最后一行,添加chip->ecc.mode=NAND_ECC_NONE;
--------------------------------------------------------------------------------