摘要:在2011年的时候,本人把u-boot-2011.03成功移植到了S3C2440(utu2440开发板)上。通过这次移植使自己对u-boot有了较深刻的理解并掌握了u-boot的移植。

对于未移植过u-boot的人来说,可能觉得很神秘,甚至觉得很难。实际上,从整个移植过程来看,并未想像中那么难。如果你接触过嵌入式linux的开发,我觉得移植u-boot并不是难事,至少没想象中的难。

reille博客作为技术分享、技术交流的个人博客,把自己移植u-boot-2011.03的过程、遇到的问题及解决方法作为一个系列专题分享出来。希望对正在移植u-boot的人有用。

本节主要介绍u-boot-2011.03的配置和初步编译。

开发环境:主机:Window XP SP2;linux:VMware7.01+ubuntu9.10;目标板:扬创utu2440-F开发板

交叉编译器:arm-linux-gcc4.3.2(一开始用的是编译内核的版本arm-linux-gcc3.4.1,但出现了软浮点问题,于是换成了现在用的版本,当然本人编译内核的时候还是用3.4.1版本)。

1. 下载uboot源码:u-boot-2011.03

本来想移植最新版本u-boot-2011.06,但见其还在修改中,故改为移植u-boot-2011.03,其源码可从如下地址中下载:ftp://ftp.denx.de/pub/u-boot/

2. 裁减和配置

2.1 裁减:

1). 删除u-boot-2011.03/arch目录下除arm目录外的所有目录;

2). 删除u-boot-2011.03/arch/arm/cpu目录下除arm920tmulu外的所有目录;

3). 删除u-boot-2011.03/arch/arch/arm/cpu/arm920t目录下除s3c24x0目录外的所有目录,注:文件不要删;

4). 删除u-boot-2011.03/arch/arm/include/asm目录下除arch-s3c24x0目录外的所有arch-xxxx目录,注:文件不要删;

5). 删除u-boot-2011.03/board目录下除samsung目录外的所有目录;

6). 删除u-boot-2011.03/board/samsung目录下除smdk2410目录外的所有目录;

7). 删除u-boot-2011.03/include/configs目录下除smdk2410.h文件外的所有头文件。

2.2 裁减后,进行配置:

1). 在u-boot-2011.03目录下找到boards.cfg文件,并在其最后添加一行,如下:

reille2440                   arm         arm920t     –                   samsung        s3c24x0

2). 创建板级reille2440的支持文件:

a: 拷贝目录:

reille@ubuntu:~/work/u-boot-2011.03$ cp -r board/samsung/smdk2410 board/samsung/reille2440

b: 在board/samsung/reille2440目录下,把smdk2410.c更名为reille2440.c,

c: 编辑board/samsung/reille2440目录下的Makefile文件,把其中的COBJS := smdk2410.o flash.o改为COBJS    := reille2440.o flash.o

d: 把include/configs目录下smdk2410.h文件拷贝一份在该目录并命名为reille2440.h,然后编辑该reille2440.h文件:

aa: 把其中的#define    CONFIG_SYS_PROMPT        “[smdk2410]# “/* Monitor Command Prompt    */

改为#define    CONFIG_SYS_PROMPT        “[reille2440]# “/* Monitor Command Prompt    */

bb: 在该文件的最后,加上如下定义:

#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1

#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 – GENERATED_GBL_DATA_SIZE)

如果不添加上述定义,则会出现编译错误:

board.c: In function ‘board_init_f’:

board.c:279: error: ‘CONFIG_SYS_TEXT_BASE’ undeclared (first use in this function)

board.c:279: error: (Each undeclared identifier is reported only once

board.c:279: error: for each function it appears in.)

make[1]: *** [board.o] 错误 1

make[1]: 离开目录“/home/bsc/samba/u-boot-2010.12/arch/arm/lib”

make: *** [arch/arm/lib/libarm.o] 错误 2

3. 初步编译:

编译的步骤很简单,如下两步即可:

1) make reille2440_config

选择目标平台。

2) make

编译的时候,遇到了一些问题,我一开始用的交叉编译器版本是arm-linux-gcc3.4.1,出现了网络频现的软浮点问题,如下:

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_udivsi3.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_udivsi3.oS)

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_divsi3.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_divsi3.oS)

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_umodsi3.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_umodsi3.oS)

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_modsi3.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_modsi3.oS)

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_dvmd_lnx.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_dvmd_lnx.oS)

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_lshrdi3.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_lshrdi3.oS)

arm-linux-ld: ERROR: /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_ashldi3.oS) uses hardware FP, whereas u-boot uses software FP

arm-linux-ld: failed to merge target specific data of file /usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/libgcc.a(_ashldi3.oS)

搜索到一篇解决方法的文章:见:http://blog.sina.com.cn/s/blog_6035432c0100j4tm.html

但,根据其方法,并不能解决问题,问题仍旧。于是更换编译器为arm-linux-gcc4.3.2,并把

config.mk文件还源后,直接make,这时是会出现问题的,如下:

arm-linux-ld: ERROR: Source object crc32.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file crc32.o

arm-linux-ld: ERROR: Source object display_options.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file display_options.o

arm-linux-ld: ERROR: Source object gunzip.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file gunzip.o

arm-linux-ld: ERROR: Source object hashtable.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file hashtable.o

arm-linux-ld: ERROR: Source object lmb.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file lmb.o

arm-linux-ld: ERROR: Source object net_utils.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file net_utils.o

arm-linux-ld: ERROR: Source object qsort.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file qsort.o

arm-linux-ld: ERROR: Source object strmhz.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file strmhz.o

arm-linux-ld: ERROR: Source object time.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file time.o

arm-linux-ld: ERROR: Source object vsprintf.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file vsprintf.o

arm-linux-ld: ERROR: Source object zlib.o has EABI version 5, but target libgeneric.o has EABI version 0

arm-linux-ld: failed to merge target specific data of file zlib.o

make[1]: *** [libgeneric.o] Error 1

make[1]: Leaving directory `/home/reille/work/u-boot-2011.03/lib’

这个问题很头痛,花了一些功夫找都未能有解决方法,其实这个问题很简单,只是自己忽略了而已。这是因为更换编译器后,未进行清除才导致的。即:

执行make distclean 后,再make reille2440_config,再make,就可编译成功了!

注意:现在编译好的u-boot.bin是还不能运行的,要使其运行起来还需要更改uboot下的start.S文件,详见本博客的《移植u-boot-2011.03到S3C2440(utu2440)的方法与步骤###2. 让u-boot-2011.03跑起来

» 文章出处: reille博客—http://velep.com , 如果没有特别声明,文章均为reille博客原创作品
» 郑重声明: 原创作品未经允许不得转载,如需转载请联系reille#qq.com(#换成@)
分享到:
推荐阅读相关文章:

 Leave a Reply

(必须)

(我会替您保密的)(必须)

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

 
© 2012 velep.com | reille blog | 管理| 粤ICP备15065318号-2| 谷歌地图| 百度地图| Suffusion theme|Sayontan Sinha

无觅相关文章插件,快速提升流量