Linux-2.6.39在Tiny6410上的移植

时间:2021-12-08 12:39:53

Linux内核版本号:linux 2.6.39
交叉编译工具:arm-linux-gcc 4.5.1
Linux内核下载:www.kernel.org
开发板:友善之臂Tiny6410

一、解压内核

tar xzvf linux-2.6.39.tar.gz

 

二、修改Makefile

ARCH ?= $(SUBARCH)
CROSS_COMPILE
?= $(CONFIG_CROSS_COMPILE:"%"=%)

改成:

ARCH ?= arm
CROSS_COMPILE
?= arm-linux-

 

三、进入解压出来的linux-2.6.39目录,拷贝arch/arm/configs/s3c6400_defconfig到当前目录并重命名为.config

cp arch/arm/configs/s3c6400_defconfig ./.config

 

四、基本配置
执行make menuconfig
1、选择CPU型号:

System Type --->
*** System MMU ***
│ │
-*- S3C64XX DMA
│ │ [ ] SMDK6400
│ │ [ ] A
&W6410
│ │ [
*] MINI6410
│ │ [ ] REAL6410
│ │ [ ] SMDK6410
│ │ [ ] NCP
│ │ [ ] Airgoo HMT
│ │ [ ] SmartQ
5
│ │ [ ] SmartQ
7

只选上MINI6410其它的不选。
2、支持进程中通信

General setup --->
│ │ [
*] System V IPC

 

3、退出内核图形配置菜单,执行make生成zImage镜像文件,将arch/arm/boot/zImage拷贝到tftp共享目录,tftp服务器搭建见贴http://www.cnblogs.com/ape-ming/p/5100449.html

 

五、启动开发板通过tftp下载内核镜像文件并启动内核,出现以下信息:

VFS: Cannot open root device "nfs" or unknown-block(0,255)
Please append a correct
"root=" boot option; here are the available partitions:
Kernel panic
- not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
[
<c002c680>] (unwind_backtrace+0x0/0xe4) from [<c01b2384>] (panic+0x50/0x16c)
[
<c01b2384>] (panic+0x50/0x16c) from [<c0008d64>] (mount_block_root+0x238/0x288)
[
<c0008d64>] (mount_block_root+0x238/0x288) from [<c0009074>] (prepare_namespace+0x160/0x1b4)
[
<c0009074>] (prepare_namespace+0x160/0x1b4) from [<c00089ec>] (kernel_init+0x100/0x13c)
[
<c00089ec>] (kernel_init+0x100/0x13c) from [<c00283d4>] (kernel_thread_exit+0x0/0x8)

这是没有支持MTD分区或者没有文件系统支持,先修改下MTD分区:
打开arch/arm/mach-s3c64xx/mach-mini6410.c,并修改分区

static struct mtd_partition mini6410_nand_part[] = {
[
0] = {
.name
= "uboot",
.size
= SZ_1M,
.offset
= 0,
},
[
1] = {
.name
= "kernel",
.size
= SZ_2M,
.offset
= SZ_1M,
},
[
2] = {
.name
= "file system",
.size
= MTDPART_SIZ_FULL,
.offset
= SZ_1M + SZ_2M,
},
};

配置内核支持MTD:

Device Drivers --->
<*> Memory Technology Device (MTD) support --->
│ │
--- Memory Technology Device (MTD) support
│ │ [ ] Debugging
│ │
< > MTD tests support
│ │ [
*] MTD partitioning support
│ │
< > RedBoot partition table parsing
│ │ [
*] Command line partition table parsing
│ │
< > ARM Firmware Suite partition parsing
│ │
< > TI AR7 partitioning support
│ │
*** User Modules And Translation Layers ***
│ │
<*> Direct char device access to MTD devices
│ │
-*- Common interface to block layer for MTD 'translation layers'
│ │
<*> Caching block device access to MTD devices

配置内核支持DM9000:

[*] Networking support  ---> 
Networking options
--->
│ │
<*> Packet socket //包套接字接口
│ │ <*> Unix domain sockets //Unix域套接字
│ │ < > PF_KEY sockets
│ │ [
*] TCP/IP networking //TCP/IP网络
│ │ [*] IP: multicasting //IP广播协议
│ │ [ ] IP: advanced router //高级路由
│ │ [*] IP: kernel level autoconfiguration //IP:内核级别自动配置
│ │ [*] IP: DHCP support //DHCP支持,启动时挂在NFS需要
│ │ [*] IP: BOOTP support //启动时挂在启动机子上的启动文件
│ │ [*] IP: RARP support //RARP支持,此项和DHCP需要网络中相应服务器支持

 

Device Drivers --->
[
*] Network device support --->
│ │
--- Network device support
│ │ [
*] Ethernet (10 or 100Mbit) --->
│ │ [ ] Ethernet (
1000 Mbit) --->
│ │ [ ] Ethernet (
10000 Mbit) --->
│ │ [ ] Wireless LAN
--->
[
*] Ethernet (10 or 100Mbit) --->
│ │
--- Ethernet (10 or 100Mbit)
│ │
< > ASIX AX88796 NE2000 clone support
│ │
< > SMC 91C9x/91C1xxx support
│ │
<*> DM9000 support
│ │ (
4) DM9000 maximum debug level

配置内核文件系统为NFS网络文件系统:

File system  --->
[
*] Network File Systems --->
<*> NFS client support
│ │ [
*] NFS client support for NFS version 3
│ │ [ ] NFS client support
for the NFSv3 ACL protocol extension
│ │ [ ] NFS client support
for NFS version 4
│ │ [
*] Root file system on NFS

如果Network File Systems里面没有Root file system on NFS这一项,请检查下Networking options里面的DHCP支持有没有选上。

 

六、重新make生成内核镜像拷贝到tftp目录并启动系统,至此Linux内核在S3C6410上的基本移植工作完成。

系统启动过程中遇到以下错误信息的解决办法:
1、机器ID无法识别

Boot with zImage
do not support this address : 50008000

Starting kernel ...

Uncompressing Linux...
done, booting the kernel.

Error: unrecognized
/unsupported machine ID (r1 = 0x000009d8).

在内核启动过程中,系统会检查uboot传递过来的机器ID是否与内核ID匹配,不匹配则会报这个错误。找一下CPU型号是否选对,如果CPU型号没问题则打开arch/arm/mach-xxx/mach-xxx.c(根据所选的CPU确定)找到
MACHINE_START(MINI6410, "MINI6410")函数所指定的CPU型号(MINI6410),之后在arch/arm/tool/mach-types文件里面找到MACHINE_START所指定的CPU型号:
mini6410 MACH_MINI6410 MINI6410 2520
修改最后的机器ID(2520)为修改成上面错误信息打印出来的那个值(r1 = 0x000009d8)。
2、网络文件系统加载失败:
在上面配置没问题的情况下这种错误应该是网卡芯片DM9000的驱动程序有问题,打开arch/arm/mach-xxx/mach-xxx.c(根据所选的CPU确定)修改网卡设备信息:

/* DM9000AEP 10/100 ethernet controller */

static struct resource mini6410_dm9k_resource[]
= {
[
0] = {
.start
= S3C64XX_PA_XM0CSN1,
.end
= S3C64XX_PA_XM0CSN1 + 1,
.flags
= IORESOURCE_MEM
},
[
1] = {
.start
= S3C64XX_PA_XM0CSN1 + 4,
.end
= S3C64XX_PA_XM0CSN1 + 5,
.flags
= IORESOURCE_MEM
},
[
2] = {
.start
= S3C_EINT(7),
.end
= S3C_EINT(7),
.flags
= IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL
}
};

 

 


参考链接:
http://blog.sina.com.cn/s/blog_752fa65f0100p6m4.html
http://blog.csdn.net/lqrensn/article/details/5533613