移植u-boot-2011.03到S3C2440(utu2440)方法与步骤###1. 配置和初步编译

时间:2022-07-06 17:14:35

作者:reille

本博客网址:http://blog.csdn.net/reille/

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

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

详细描述了本人移植u-boot-2011.03到S3C2440(utu2440)的方法与步骤,同时把移植过程中遇到的问题及其解决方法记录了下来,以供参考步骤

——————————————————————————————————————————————————————————————————

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: 在该文件的最后,加上如下定义:

 

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

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跑起来》