Chinaunix首页 | 论坛 | 博客
  • 博客访问: 188759
  • 博文数量: 33
  • 博客积分: 1460
  • 博客等级: 上尉
  • 技术积分: 500
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-24 18:08
文章分类

全部博文(33)

文章存档

2009年(4)

2008年(9)

2007年(20)

我的朋友

分类: LINUX

2007-10-09 20:23:35

移植u-boot到smdk2410在skyeye下运行(u-boot系列初级篇)

环境:
 本人使用的操作系统是magiclinux2.0。
 模拟器:
 skyeye-1.2.8RC3
 交叉编译器:
 arm-linux-gcc-3.3.2.tar.bz2
 arm-linux-toolchain-post-2.2. 13.tar.gz
 安装内《移植u-boot到ep7312在skyeye下运行(u-boot系列入门篇)》


1. 修改Uboot

从uboot的网站上可以下载到最新的uboot源代码,你可以从以下的网址下载


uboot 的源码结构清晰,注释详细,是学习嵌入系统的很好的例子。我下载的是最新的U-Boot-1.1.2。
因为我们要模拟smdk2410的芯片,而uboot已经支持一个基于smdk2410的板子了,所以我们只要对uboot里面有关smdk2410的板子的配置略作修改就可以了。uboot里面有关主板的配置文件都在"include/configs/.h"下,所以我们找到include/configs/smdk2410.h,对它进行修改。
代码:

找到
   #define CONFIG_DRIVER_CS8900    1
改为
   #define CONFIG_DRIVER_CS8900    0

找到
#define CONFIG_BOOTDELAY 3
改为
#define CONFIG_BOOTDELAY -1 /* autoboot disabled */

然后回到uboot的根目录下,配置,编译:
代码:

make smdk2410_config
make all

等待结束以后我们会发现u-boot.bin和u-boot两个文件,其中u-boot.bin是raw的二进制文件。u-boot是ELF格式的。

4. 配置skyeye,并运行uboot

首先,新建一个目录代表你的smdk2410的主板。这样也可以保持文件的清洁和有序。
代码:

mkdir board01

将你刚才编译成功的u-boot拷贝到这个目录下来。skyeye支持raw binary和ELF的格式,这里我们用raw binary的格式。

关于skyeye.conf(这个文件是用来配置主板的)我参考了

代码如下:
#skyeye config file sample

cpu: arm920t
mach: s3c2410x

#all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x00000000, size=0x20000000
#physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x01000000, file=./u-boot, boot=yes
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x01000000

但不能启动,后又改为
#skyeye config file sample

cpu: arm920t
mach: s3c2410x

#physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x01000000, file=./u-boot, boot=yes
mem_bank: map=M, type=RW, addr=0x30000000, size=0x01000000

#all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020

仍不能启动。嘿嘿,问题出在哪呢?
我们来分析"include/configs/smdk2410.h"

/*-----------------------------------------------------------------------
 * Physical Memory Map
 */
#define CONFIG_NR_DRAM_BANKS    1          /* we have 1 bank of DRAM */

#define PHYS_SDRAM_1            0x30000000 /* SDRAM Bank #1 */起始地址

#define PHYS_SDRAM_1_SIZE       0x04000000 /* 64 MB */大小

#define PHYS_FLASH_1            0x00000000 /* Flash Bank #1 */

#define CFG_FLASH_BASE          PHYS_FLASH_1

所以我们的
mem_bank: map=M, type=RW, addr=0x30000000, size=0x01000000
要改为:
mem_bank: map=M, type=RW, addr=0x30000000, size=0x04000000

再看
/*-----------------------------------------------------------------------
 * FLASH and environment organization
 */

#define CONFIG_AMD_LV400        1       /* uncomment this if you have a LV400 flash */
#if 0
#define CONFIG_AMD_LV800        1       /* uncomment this if you have a LV800 flash */
#endif

#define CFG_MAX_FLASH_BANKS     1       /* max number of memory banks */
#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE         0x00100000 /* 1MB */
#define CFG_MAX_FLASH_SECT      (19)    /* max number of sectors on one chip */
#define CFG_ENV_ADDR            (CFG_FLASH_BASE + 0x0F0000) /* addr of environment */
#endif
#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE         0x00080000 /* 512KB */
#define CFG_MAX_FLASH_SECT      (11)    /* max number of sectors on one chip */
#define CFG_ENV_ADDR            (CFG_FLASH_BASE + 0x070000) /* addr of environment */
#endif


#define PHYS_FLASH_1            0x00000000 /* Flash Bank #1 */起始地址
#define PHYS_FLASH_SIZE         0x00080000 /* 512KB */大小

所以我们的

mem_bank: map=M, type=RW, addr=0x00000000, size=0x01000000, file=./u-boot, boot=yes
要改为:
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00080000, file=./u-boot, boot=yes


这时候你的skyeye-smdk2410主板就配置好了。

你可以试着运行了。在你现在的目录下打入
skyeye


这时候你可以看到uboot的启动界面,和提示符,
SKYEYE: If you have ELF kernel file, please use -e option to indicate your ELF format kernel filename
SKYEYE: If you only have kernel binary image, you should put the filename of kernel binary image in skyeye.conf file
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x805fab0
SKYEYE: use arm920t mmu ops
Loaded RAM   ./u-boot.bin


U-Boot 1.1.2 (Dec 21 2006 - 13:53:57)

U-Boot code: 33F80000 -> 33F96464  BSS: -> 33F9A74C
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
SMDK2410 #
呵呵,成攻了。
我这次移植是根据smdk2410.h的配置,来更改sykeye.conf的配置
下一回,我们再做其它基于s3c2410的板子时,就反过来,通过给定的板了,来改头文件。

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

chinaunix网友2011-04-28 22:35:15

学习了!!!!!!!!!!