uboot移植第一阶段relocate中的error总结1

一、背景
主要是在学习朱老师物联网课程uboot移植中碰到的问题的解决。
二、工具介绍
使用VMware虚拟机搭建Ubuntu14.04的Linux运行环境。将从uboot官方fip下载的2013.10的uboot移植到九鼎x210开发板。
三、问题及解决方案

  1. 问题描述:

    /root/porting_x210/uboot_2013_10/u-boot-	2013.10/arch/arm/lib/eabi_compat.o  -L /usr/local/arm/arm-		2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1 -lgcc -Map u-boot.map -o 	u-boot
    u-boot contains relocations other than 	R_ARM_RELATIVE
    make: *** [checkarmreloc] Error 1
    
  2. 分析:主要为链接过程中发现的错误,看到此错误先去百度了一下,发现主要为重定位错误。在Linux中使用grep "R_ARM_RELATIVE" -nR * 命令查找,结果如下:
    uboot移植第一阶段relocate中的error总结1_第1张图片
    由此猜测是MakeFile中出了问题,打开MakeFile的789行,看到如下代码:

     # ARM relocations should all be R_ARM_RELATIVE.
     checkarmreloc: $(obj)u-boot
     @if test "R_ARM_RELATIVE" != \
              "`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
              then echo "$< contains relocations other than \
              R_ARM_RELATIVE"; false; fi
    

根据注释解释,这段代码的作用为检查重定位的规则,我们尝试将其屏蔽,绕过这个规则检测机制,发现可以成功链接。

  1. 解决方案:
    在MakeFile中屏蔽掉789~794行开始的规则检测代码。
# ARM relocations should all be R_ARM_RELATIVE.
checkarmreloc: $(obj)u-boot
 #       @if test "R_ARM_RELATIVE" != \
             "`$(CROSS_COMPILE)readelf -r $< | cut -d ' ' -f 4 | grep R_ARM | sort -u`"; \
          then echo "$< contains relocations other than \
         R_ARM_RELATIVE"; false; fi

你可能感兴趣的:(官方uboot移植笔记)