红联Linux门户
Linux帮助

我的mini2440 Linux2.9.32移植问题记录

发布时间:2015-03-17 10:40:37来源:csdn作者:Charistain_huang

1.总是出现MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux.................................. done, booting the kernel.

停止的情况

下面的是tools/mach-types中关于体系的参数定义

s3c2440            ARCH_S3C2440        S3C2440           362

mini2440        MACH_MINI2440        MINI2440        1999

解决方法:将第一行改成 s3c2440 ARCH_S3C2440 S3C2440 1999


2.内核的配置

1..[*] Enable loadable module support --->

[*]   Module unloading

2. System Type ---->
[*] S3C2410 DMA support       [*] Support ARM920T processor
S3C2440 Machines --->
[*] SMDK2440
[*] SMDK2440 with S3C2440 CPU moduleq

其他的比如2410,2443相关的全部去掉

3.Boot options   --->
将 (root=/dev/hda1 ro init=/bin/bash console=ttySAC0) Default kernel command string

改成(noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 )
其中 mtdblock2 表示 MTD 分区的第二个分区存文件系统; Linuxrc 为启动的首个脚本。

4.关掉nand ecc .因为bootload中已经有ecc校验算法

Device Drivers --->
<*> Memory Technology Device (MTD) support --->
[*]   MTD partitioning support
<*> NAND Device Support --->
<*>   NAND Flash support for S3C2410/S3C2440 SoC
[ ]     S3C2410 NAND Hardware ECC     // 这个要去掉


3.添加nand flash驱动(可参考arm/plat-s3c24xx/common-smdk.c)

在arm/mach-mini2440.c

中添加static struct mtd_partition mini2440_default_nand_part[] = {
[0] = {
.name    = "supervivi",
.size    =  0x00040000,//dev/mdkbloack0
.offset    = 0,
},
[1] = {
.name    = "param",
.offset = 0x00040000,
.size    = 0x00020000,
},
[2] = {
.name    = "Kernel",
.offset = 0x00560000,
.size    =1024 * 1024 * 1024,
},
[3] = {
.name    = "nand",
.offset    = 0x00000000,
.size    = 1024 * 1024 * 1024,
},
};
static struct s3c2410_nand_set mini2440_nand_sets[] = {
[0] = {
.name        = "NAND",
.nr_chips    = 1,
.nr_partitions    = ARRAY_SIZE(mini2440_default_nand_part),
.partitions    =mini2440_default_nand_part,
},
};

static struct s3c2410_platform_nand mini2440_nand_info = {
.tacls        = 20,
.twrph0        = 60,
.twrph1        = 20,
.nr_sets    = ARRAY_SIZE(mini2440_nand_sets),
.sets        = mini2440_nand_sets,
.ignore_unset_ecc = 1,
};

更改下列函数:

static void __init mini2440_machine_init(void)
{
s3c24xx_fb_set_platdata(&mini2440_fb_info);
s3c_i2c0_set_platdata(NULL);
s3c_device_nand.dev.platform_data = &mini2440_nand_info;  //添加内容
platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
//smdk_machine_init();
}

static struct platform_device *mini2440_devices[] __initdata = {

&s3c_device_usb,

&s3c_device_lcd,

&s3c_device_wdt,

&s3c_device_i2c0,

&s3c_device_iis,

&s3c_device_nand,   // 把 nand flash 设备添加到开发板的设备列表结构

};

更改drivers/mtd/nand/s3c2410.c关闭ecc校验

chip->ecc.mode        = NAND_ECC_SOFT;

改为:chip->ecc.mode        = NAND_ECC_NONE;

注意:否则将会出现很多问题Unable to handle kernel NULL pointer dereference at virtual address 00000018
pgd = c0004000
[00000018] *pgd=00000000
Internal error: Oops: 5 [#1]

make zIamge下载后报错

出现一大堆错误:

arch/arm/mach-s3c2440/mach-mini2440.c:84: error: array type has incomplete element type
arch/arm/mach-s3c2440/mach-mini2440.c:85: error: array index in non-array initializer
arch/arm/mach-s3c2440/mach-mini2440.c:85: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:86: error: field name not in record or union initializer
arch/arm/mach-s3c2440/mach-mini2440.c:86: error: (near initialization for 'mini2440_nand_sets')
arch/arm/mach-s3c2440/mach-mini2440.c:87: error: field name not in record or union initializer

在macn-mini2440中添加头文件

#include <plat/common-smdk.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/partitions.h>
#include <plat/nand.h>//这个也不能少的哦 

编译后下载:

affs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: auto selecting yaffs2
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 128K
Kernel panic - not syncing: Attempted to kill init

解决办法: 这个时候懵了,哪里错呢~ 没办法,只能对照着友善的配置一个个大模块对着来改
当改到Kernel Features的时候错误消失了,原来需要选上
Use the ARM EABI to compile the kernel
Allow old ABI binaries to run with thie Kernel
为什么呢?~ Google了一下,原来友善的根文件系统在编译的时候也启用了EABI特性,内核和文件系统需要对上
文件系统用了EABI 内核也要用EABI 内核不用EABI 也只能读取不用EABI的文件系统