Chinaunix首页 | 论坛 | 博客
  • 博客访问: 46926
  • 博文数量: 15
  • 博客积分: 45
  • 博客等级: 民兵
  • 技术积分: 85
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-14 16:12
个人简介

Nothing to tell

文章分类

全部博文(15)

文章存档

2015年(1)

2012年(14)

我的朋友
最近访客

分类:

2012-07-17 18:46:01

在经历了一个星期的痛苦之后的今天,终于将linux系统移植到开发板上了.
Bootloader采用的是u-boot-2010.6.内核用的2.6.31.移植的yaffs2文件系统。那么bootloader,kernel,filesystem到底如何关联起来呢?
一.首先明白两点:
 1.uboot烧写内核到nandflash的A处,再从A处读内核
 2.uboot烧写文件系统到nandflash的B处,内核启动后从B处加载文件系统。

在百问网韦东山大哥的指导下有以下总结:建议先看论坛:
(1)
(2)

二.对Nandflash进行分区:

Nand的分区情况

起始地址--->结束地址

大小


root_yaffs2

0x500000--->0x10000000

0xFB00000:251M

kernel中修改参数

kernel

0x100000--->0x500000

0x400000:4M

param

0x60000--->0x80000

0x20000:128K

u-boot中修改参数

u-boot

0--->0x60000

0x60000:384K


修改代码

1.u-boot中修改nand分区:

(1).gedit include/configs/my2440.h,这里实际上是设置param(即参数区)

#define CONFIG_ENV_IS_IN_NAND 1

#define CONFIG_ENV_OFFSET 0x60000

#define CONFIG_ENV_SIZE 0x20000

#define CONFIG_CMD_SAVEENV

 

(2).gedit include/configs/my2440.h

#define MTDIDS_DEFAULT "nand0=nandflash0"

#define MTDPARTS_DEFAULT "mtdparts=nandflash0:384k@0(bootloader),"\

"128k(params),"\

"4m(kernel),"\

"-(root_yaffs2)"

2.kernel中修改nand分区:

1.gedit arch/arm/plat-s3c24xx/common-smdk.c

static struct mtd_partition smdk_default_nand_part[] = {

[0] = {

.name = "mxh20999_u-boot",

.size = 0x60000,//对应u-boot里的分区,0--->0x60000,大小为384k

.offset = 0,

},

[1] = {

.name = "mxh20999_kernel",

.offset = 0x100000,//内核在nandflash中的地址为0x100000-->0x500000,大小为0x4000004M

.size = 0x400000,//4M

},

[2] = {

.name = "mxh20999_yaffs2",

.offset = 0x500000,//文件系统在nandflash中的地址为0x500000-->0x10000000(256M),大小为251M(0xfb00000)

.size = 0xFB00000, //251M

}

u-boot操作

.烧写u-boot

norflash启动u-boot,u-boot的命令行操作:

nand erase 擦除整个nandflash

usbslave 1 0x30008000----->pc上发送u-boot到内存0x30008000

nand write 0x30008000 0 0x60000 将内存 0x30008000处内容写进nandflash起始地址为0,大小为0x60000384K)处


.烧写kernel

usbslava 1 0x30008000----->pc 发送kernel到内存0x30008000

nand erase 0x100000 0x400000

nand write 0x30008000 0x100000 0x400000


.烧写文件系统

nand erase 0x500000 0xfb00000 擦除起始地址0x500000,大小为0xfb00000nandflash

usbslave 1 0x30008000----->pc 发送文件系统到内存0x30008000

nand write.yaffs2 0x30008000 0x500000 $(filesize)将大小为(filesize)的文件系统从内存0x30008000处写进nandflash的起始地址为0x500000的地方


.启动系统

nand read 0x30008000 0x100000 0x400000

bootm 0x30008000

激动人心的时候到了:


阅读(924) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~