首页 新闻资讯 技术资料 论坛 网站地图
应用产品 嵌入式系统 通信产品 工业控制 汽车电子 计算机外设 数控系统
电子元器件搜索:
IC库存(8958万) PDF资料(329万) IC价格 IC求购 资讯 技术资料
维库电子市场网是知名的电子元器件交易网站, 为电子生产企业提供IC库存和技术资料查询服务。
位置: 首页 > 详细信息
  LINUX2.6.14在TE2410开发板上的移植
出处:综合电子论坛 时间: 2007-09-14
witech 发布于 2007-9-14 14:53:28
表情LINUX2.6.14在TE2410开发板上的移植

LINUX2.6.14在TE2410开发板上的移植

作者:高福东  张银翠  王 鹏  乔  鹏  宋雪雁

本实验是在TE2410开发板上实现的。TE2410开发板是保定飞凌嵌入式技术有限公司自主研发的一款ARM9开发平台(http://www.witech.com.cn),基于三星公司的ARM处理器S3C2410A。

一. 准备必要的文件

首先去官方网站下载最新的 linux 内核

http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.bz2

因为 linux2.6.14 内核需要更新版本的编译器,所以需要下载交叉编译器

ftp://ftp.handhelds.org/projects/toolchain/arm-linux-gcc-3.4.1.tar.bz2

二. 安装文件

把 arm-linux-gcc 安装在 /usr/local/arm/3.4.1 目录下,安装方法和安装 gcc2.95.3 和 gcc3.3.2 是相同的!

接下来需要解压 linux 内核,输入命令:

[root · localhost hfrk]# tar jxvf linux-2.6.14.tar.bz2

内核被解压到 linux-2.6.14 目录下。

三. 修改 makefile 文件

内核的编译是根据 makefile 文件的指示进行的, Makefile 文件来组织内核的各模块之间的关系,记录了各个模块之间的相互联系和依赖关系。

我们首先修改 linux-2.6.14 的根目录下的 makfile 文件,须改的主要内容是目标代码的类型和为编译内核指定一个编译器。注释掉以下内容:

#ARCH   ?= $(SUBARCH)

#CROSS_COMPILE      ?=

增加如下内容:

ARCH     : = arm

CROSS_COMPILE =/usr/local/arm/3.4.1/bin/arm-linux-

四. 修改相关的文件。

1、修改 arch\arm\mach-s3c2410\devs.c 文件

       增加头文件定义

#include  <linux/mtd/partitions.h>

#include  <asm/arch/nand.h>

#include  <linux/mtd/nand.h>

/**************end add********/

Te2410 开发板mtd分区表:

name              offset        size        flag

------------------------------------------------

vivi            : 0x00000000    0x00020000     0  128k

param           : 0x00020000    0x00010000     0   64k

kernel          : 0x00030000    0x001c0000     0    1M+768k

root            : 0x00200000    0x00400000     0    4M

usr             : 0x00600000    0x03a00000     0   58M

增加 nand flash 分区信息

              /***********add here***********/

              static struct mtd_partition partition_info[] ={

              {

              name: "vivi",

              size: 0x00020000,

              offset: 0,

              }, {

              name: "param",

              size: 0x00010000,

              offset: 0x00020000,

              }, {

              name: "kernel",

              size: 0x001c0000,

              offset: 0x00030000,

              }, {

              name: "root",

              size: 0x00400000,

              offset: 0x00200000,

              mask_flags: MTD_WRITEABLE,

              }, {

              name: "user",

              size: 0x03a00000,

              offset: 0x00600000,

              }

              };

  

              struct s3c2410_nand_set nandset ={

              nr_partitions: 5 ,

              partitions: partition_info ,

              };

  

              struct s3c2410_platform_nand superlpplatform={

              tacls:0,

              twrph0:30,

              twrph1:0,

              sets: &nandset,

              nr_sets: 1,

              };

              /**************end add********/

  

              struct platform_device s3c_device_nand = {

              .name= "s3c2410-nand",

              .id             = -1,

              .num_resources       = ARRAY_SIZE(s3c_nand_resource),

              .resource  = s3c_nand_resource,

  

              /***********add here****************/

              .dev = {

              .platform_data = &superlpplatform

              }

              /**************end here************/

              };

2. 修改 arch\arm\mach-s3c2410\mach-smdk2410.c 文件

              Startic struct platform_device *smdk2410_devices[] __initdata={

      &s3c_device_usb,

      &s3c_device_lcd;

      &s3c_device_wdt,

      &s3c_device_i2c;

      &s3c_device_iis,

      &s3c_device_nand, /*add here*/

              };

五  解决ECC问题

修改drivers/mtd/nand/s3c2410.c 文件:

vi drivers/mtd/nand/s3c2410.c

找到s3c2410_nand_init_chip()函数,在该函数体最后加上一条语句:

chip->eccmode = NAND_ECC_NONE;

保存,退出。

六.做完以上修改以后,内核编译以后就可以在te2410 开发板上运行了。

    打开终端窗口,切换到 linux-2.6.14 目录下,输入命令:

[root · localhost linux-2.6.14]# make smdk2410_defconfig

[root · localhost linux-2.6.14]#make meueconfig

我的配置选项如下:

System Type--->[*]S3C2410 DMA support

General setup--->[*]NWFPE math emulation

Memory Technology Devices(MTD)--->[*]MTD partitioning support

          [*]Command line partition table parsing

  NAND Flash Device Drivers

          [*]NAND Device Support

          [*]NAND Flash support for S3C2410 SoC

Block devices--->[*]Initial RAM disk(initrd) support

Character devices--->[*]Non-standard serial port support

           [*]S3C2410 RTC Driver

File systems--->Miscellaneous filesystems

  [*]Compressed Rom file system support(cramfs)

      --->Pseudo filesystems

   [*]Virtual memory file system support(former shm fs)

   [*]/dev file system support(OBSOLETE)

   [*] Automatically mount at boot

[root · localhost linux-2.6.14]# make

等编译完成以后,会生成镜像文件 arch/arm/boot/zImage ,把这个文件下载到开发板上!


witech 发布于 2007-9-14 14:54:19
表情

.修改vivi串口参数

在 2.6 内核中, 2410 的串口由原来的 ttyS0 变为 ttySAC0

启动te2410目标板,进入vivi,在vivi提示符下输入:

vivi>param set linux_cmd_line "noinitrd root=/dev/mtdblock/3  init= /linuxrc console=ttySAC0,115200"

vivi>param save

八.启动信息  

    welcome          

S3C2410 DEVELOP KIT    

VIVI version 0.1.4 (root@localhost.localdomain) (gcc version 2.95.2 20000516 (re          

lease) [Rebel.com]) #0.1.4 日 12月 24 13:09:55 CST 2006

MMU table base address = 0x33DFC000        

Succeed memory mapping.        

NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)

Found saved vivi parameters.

CS8900 - type: 630e, rev: a00  

CS8900 - status: ad6 (EEPROM present)          

Setting MAC address...      

Display format changed to VGA 640X480 mode

Press Return to start the LINUX now, any other key fo        

Copy linux kernel from 0x00030000 to 0x30008000, size = 0x001c0000 ... done      

zImage magic = 0x016f2818          

Setup linux parameters at 0x30000100        

linux command line is: "noinitrd root=/dev/mtdblock/3  init= nuxrc console=ttySA          

C0 ,115200"          

MACH_TYPE = 193

NOW, Booting Linux......        

Uncompressing Linux.............................................................

... done, booting the kernel.  

Linux version 2.6.14 (root@localhost.localdomain) (gcc version 3.4.1) #1 Sat Aug          

11 16:36:16 CST 2007      

CPU: ARM920Tid(wb) [41129200] r  

Machine: SMDK2410  

ATAG_INITRD is deprecated; please update your bootloader.  

Memory policy: ECC disabled, Data cache writeback      

CPU S3C2410A (id 0x32410002)

S3C2410: core 200.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz              

S3C2410 Clocks, (c) 2004 Simtec Electronics CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on

CPU0: D VIVT write-back cache

CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets            

CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets            

Built 1 zonelists

Kernel command line: noinitrd root=/dev/mtdblock/3 init=nuxrc console= ttySAC0 ,115200

irq: clearing subpending status 00000003

irq: clearing subpending status 00000002

PID hash table entries: 512 (order: 9, 8192 bytes)        

timer tcon=00000000, tcnt a2c1, tcfg 00000200,00000000, usec 00001eb8

Console: colour dummy device 80x30      

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)        

Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)      

Memory: 64MB = 64MB total          

Memory: 62720KB available (1620K code, 32

Mount-cache hash table entries: 512        

CPU: Testing write buffer coherency: ok            

softlockup thread 0 started up.    

NET: Registered protocol family 16      

S3C2410: Initialising architecture      

usbcore: registered new driver usbfs        

usbcore: registered new driver hub      

S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics  

DMA channel 0 at c4800000, irq 33      

DMA channel 1 at c4800040, irq 34      

DMA channel 2 at c4800080, irq 35      

DMA channel 3 at c48000c0, irq 36      

NetWinder Floating Point Emulator V0.97 (double precision)    

Console: switching to colour frame buffer device 80x25

fb0: Virtual frame buffer device, using 1024K of video memory      

S3C2410 RTC, (c) 2004 Simtec Electronics            

s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410    

s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410    

s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410    

io scheduler noop registered

io scheduler anticipatory registered        

io scheduler deadline registered    

io scheduler cfq registered

RAMDISK driver initialized: 16 RAM disks of 4096K size

S3C24XX NAND Driver, (c) 2004 Simtec Electronics      

s3c2410-nand: mapped registers at c4980000

s3c2410-nand: timing: Tacls 10ns, Twrph0 40ns, Twrph1 10ns    

NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit

)

Scanning device for bad blocks

Creating 5 MTD partitions on "NAND 64MiB 3,3V 8-bit":

0x00000000-0x00020000 : "vivi"

0x00020000-0x00030000 : "param"

0x00030000-0x001f0000 : "kernel"

0x00200000-0x00600000 : "root"

0x00600000-0x04000000 : "user"

usbmon: debugfs is not available

mice: PS/2 mouse device common for all mice

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 4096 (order: 2, 16384 bytes)

TCP bind hash table entries: 4096 (order: 2, 16384 bytes)

TCP: Hash tables configured (established 4096 bind 4096)

TCP reno registered

TCP bic registered

NET: Registered protocol family 1

Please press Enter to activate this console.

Starting pid 714, console /dev/console: '/bin/sh'

BusyBox v0.60.3 (2002.05.13-08:36+0000) Built-in shell (ash)

Enter 'help' for a list of built-in commands.

#

九、 网卡驱动的移植:

1、把cs8900.c和cs8900.h两个针对2.6.14的内核的驱动程序源代码,将其放在drivers/net/arm/目录下面。

#cp cs8900.c ./drivers/net/arm/

#cp cs8900.h ./drivers/net/arm/

并在cs8900_probe()函数中,memset (&priv,0,sizeof (cs8900_t));函数之后添加如下两条语句:

__raw_writel(0x2211d110,S3C2410_BWSCON);

__raw_writel(0x1f7c,S3C2410_BANKCON3);

2、修改drivers/net/arm/目录下的Kconfig文件,在最后添加如下内容:

Config ARM_CS8900

tristate "CS8900 support"

depends on NET_ETHERNET && ARM && ARCH_SMDK2410

help

Support for CS8900A chipset based Ethernet cards. If you have a network (Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available from as well as . To compile this driver as a module, choose M here and read.The module will be called cs8900.o.

内核系统配置文件由2.4版本的config.in变成了2.6版本Kconfig文件,在这个文件里面添加如上内容,则在运行make menuconfig或者make xconfig命令的时候就会出现:

[ ] CS8900 support

这一选项。

3、修改drivers/net/arm/目录下的Makefile文件,在最后添加如下内容:

obj-$(CONFIG_ARM_CS8900) += cs8900.o

2.6版本内核的Makefile文件也与2.4版本的有所不同。添加以上语句,就会使内核在编译的时候根据配置将cs8900A的驱动程序以模块或静态的方式编译到内核当中。

4、在/arch/arm/mach-s3c2410/mach-smdk2410.c文件中,找到smdk2410_iodesc[]结构数组,添加如下如下内容:{vSMDK2410_ETH_IO, 0x19000000, SZ_1M, MT_DEVICE}

修改之后变成了:

static struct map_desc smdk2410_iodesc[] __initdata = {

/* nothing here yet */

/* Map the ethernet controller CS8900A */ {vSMDK2410_ETH_IO, 0x19000000, SZ_1M, MT_DEVICE}

};

添加#include <asm-arm/arch-s3c2410/smdk2410.h>

由于在驱动程序的开发的时候,在驱动程序当中所用到的跟设备有关的地址都是虚拟地址,也就是说驱动程序操作的都是虚拟地址,那么要使驱动程序对设备的操作反映到设备上去,就得将设备的物理地址映射到正确的虚拟地址上去,从而保证驱动程序对虚拟地址的操作也就是对相应的物理地址操作。以上添加的语句就是为了将网卡的物理地址(0x19000000)映射到vSMDK2410_ETH_IO所指向的虚拟地址上去,上面的结构还定义了网卡虚拟地址所占用的区间,也就是从vSMDK2410_ETH_IO开始的SZ_1M大小的去间,并指定了该区间所指向的域(的属性)。

5、在include/asm-arm/arch-s3c2410/目录下创建smdk2410.h文件,其内容为:

#ifndef _INCLUDE_SMDK2410_H_

#define _INCLUDE_SMDK2410_H_

#include <linux/config.h>

#define pSMDK2410_ETH_IO 0x19000000

#define vSMDK2410_ETH_IO 0xE0000000

#define SMDK2410_ETH_IRQ IRQ_EINT9

#endif // _INCLUDE_SMDK2410_H_

因为在网卡驱动程序当中,用到了一些常量,所以特意在此添加这个头文件。这个头文件定义了网卡的物理地址、虚拟地址以及网卡占用的中断线。

6、配置、编译内核。在内核顶层目录当中键入:

#make smdk2410_defconfig

由于2.6的内核默认就支持了S3C2410,所以就有一个默认的内核配置文件。里面只是包括了一个简单的配置,要使网卡编译进内核,还要进行手工配置。

#make menuconfig

Networking support --->

Ethernet (10 or 100Mbit) --->

[*] CS8900 support

将刚才添加的网卡驱动程序静态添加到内核当中。

最后进行内核编译。

#make


关闭】 【打印
相关专题  
存储器
综合电子技术
软件开发
测试测量
接口电路
传感控制
医疗电子
安防产品
消费电子
应用产品
AD/DA
嵌入式硬件
军工/航空航天
计算机外设
CPLD/FPGA
IC设计
开发工具
嵌入式系统
嵌入式开发新闻
通信产品
汽车电子
电源系列
SOPC
工业控制
数控系统

© 2007 百斯嵌入式开发网 网站地图