⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kernel-yizhi.txt

📁 将内核移植到s3c2410上
💻 TXT
📖 第 1 页 / 共 2 页
字号:
一. 准备必要的文件 
     首先去官方网站下载最新的 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 文件 
       增加头文件定义 
              /***********add here***********/ 
              #include  <linux/mtd/partitions.h> 
              #include  <asm/arch/nand.h> 
              #include  <linux/mtd/nand.h> 
               /**************end add********/ 
     Te2410 板子分区表:
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 //配置2410的相关的信息
[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 ,把这个文件下载到开发板上!
七 .修改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)                                                                     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -