uboot移植过程出现的错误

时间:2021-04-01 16:30:37

背景:用4.4.3版本的交叉编译环境编译u-boot-2009版u-boot 移植到fl2440开发板平台。


错误一:

main.c:51:error:inline function 'show_boot_progress' cannot bedecleared weak

make[1]:***[main.0]错误1

make[1]:正在离开目录'/home/sns/linux2.6.32/icetek-v3/u-boot-orig/common'

make:***[common/libcommon.a]错误2

解决方法:去掉/home/sns/linux2.6.32/icetek-v3/u-boot-orig/common/main.c 文件里第51行show_boot_progress 前面的inline即可

错误二:

board.c:127: error: inline function 'coloured_LED_init' cannotbe declared weak
board.c:129: error: inline function 'red_LED_on' cannot be declaredweak
board.c:131: error: inline function 'red_LED_off' cannot bedeclared weak
board.c:133: error: inline function 'green_LED_on' cannot bedeclared weak
board.c:135: error: inline function 'green_LED_off' cannot bedeclared weak
board.c:137: error: inline function 'yellow_LED_on' cannot bedeclared weak
board.c:139: error: inline function 'yellow_LED_off' cannot bedeclared weak
board.c:141: error: inline function 'blue_LED_on' cannot bedeclared weak
board.c:143: error: inline function 'blue_LED_off' cannot bedeclared weak
make[1]: *** [board.o] 错误 1
make[1]: Leaving directory`/root/workspace/u-boot-2009.08/lib_arm'
make: *** [lib_arm/libarm.a] 错误 2

解决方法:

打开lib_arm/board.c,定位到127行开始,将其注释掉:

void inline __coloured_LED_init (void){}
//void inline coloured_LED_init (void) __attribute__((weak,alias("__coloured_LED_init")));
这里注释掉了'coloured_LED_init' 的部分,自己做时对照注释掉后面几个带__attribute__的部分即可

 

错误三:cpu/arm920t/start.o: In function`start_code':
/root/workspace/u-boot-2009.08/cpu/arm920t/start.S:117: undefinedreference to `coloured_LED_init'

/root/workspace/u-boot-2009.08/cpu/arm920t/start.S:118: undefinedreference to `red_LED_on'
make: *** [u-boot] 错误 1

解决方法:

打开cpu/arm920t/start.S,搜索“coloured_LED_init”定位到117行,找到如下代码:

bl coloured_LED_init
bl red_LED_on

这两行是AT91RM9200DK开发板的LED初始化,注释掉即可。

 

   错误四: MINI2440.c:In function 'board_init':

          MINI2440.c:101:error‘S3C24X0_GPIO’ has no member named 'GPACON'

          MINI2440.c:102:error‘S3C24X0_GPIO’ has no member named 'GPACON'

           MINI2440.c:103‘S3C24X0_GPIO’has no member named 'GPACON'

           ......

   解决方法:进入include/,编辑s3c24x0.h文件的407行,将#ifdef CONFIG_S3C2410改为#ifdefCONFIG_S3C2440。

五:warning: target CPU does not support interworking

解决:一看就知道是跟CPU有关,到u-boot根目录下执行

 

$sudo gedit  "cpu/arm920t/config.mk"

 

把 PLATFORM_CPPFLAGS += -march=armv4 改成 PLATFORM_CPPFLAGS += -march=armv4t

六:uboot软浮点错误

问题:

opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/lib/gcc/arm-linux/4.1.0 -lgcc \
                        -Map u-boot.map -o u-boot
arm-linux-ld: ERROR: /opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/lib/gcc/arm-linux/4.1.0/libgcc.a(_udivdi3.o) uses hardware FP, whereas u-boot uses software FP
arm-linux-ld: failed to merge target specific data of file /opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/lib/gcc/arm-linux/4.1.0/libgcc.a(_udivdi3.o)
arm-linux-ld: ERROR: /opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/lib/gcc/arm-linux/4.1.0/libgcc.a(_clz.o) uses hardware FP, whereas u-boot uses software FP
arm-linux-ld: failed to merge target specific data of file /opt/crosstool/gcc-4.1.0-glibc-2.3.2/arm-linux/lib/gcc/arm-linux/4.1.0/libgcc.a(_clz.o)
make: *** [u-boot] 错误 1

  以上错误为编译器的软浮点问题,解决办法就是去掉makefile里面的浮点相关编译,建议你直接用3.4.5编译,这个问题就解决了。或者去掉"$CPU/cpu_type/config.mk"文件中的 -msoft-float。这里提供了更详细的解决办法:http://blog.163.com/cmdbat@126/blog/static/170292123201282611251617/ 译链接器3.4.6,3.4.1用的是hardware FP,而u-boot 使用的是 software FP 。用2.95或者3.3.2或者4.4.3版本可解决这个问题
不过用2.95版本的时候还要修改一个链接。