歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 我的mini2440 Linux2.9.32 移植問題記錄

我的mini2440 Linux2.9.32 移植問題記錄

日期:2017/2/28 16:29:52   编辑:Linux教程

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的文件系統

Copyright © Linux教程網 All Rights Reserved