This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] [参考译文] [FAQ] AM62x:在 SDK v8.06上构建 u-Boot 失败,出现&'make[1]:arm-linux-androideabi-ld.gold:没有此类文件或目录&'错误

Guru**** 2540720 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1206123/faq-am62x-u-boot-build-on-sdk-v8-06-fails-with-make-1-arm-linux-androideabi-ld-gold-no-such-file-or-directory-error

器件型号:AM625

问题症状

当使用 SDK v8.06在 AM62x 上为 A53编译 U-Boot 时、生成可能会中断、并显示以下错误消息:

arm-linux-androideabi-ld.gold  -r -b binary common/avb_pubkey -o common/avb_pubkey.o
make[1]: arm-linux-androideabi-ld.gold: No such file or directory
make[1]: *** [common/Makefile:172: common/avb_pubkey.o] Error 127
make[1]: *** Waiting for unfinished jobs....

问题分析

导致此问题的原因是 Aarch64交叉工具链链接器的路径完全扩展、其中包含"arm-"子字符串以及当前正在使用的 AM62的 U-Boot 构建 CONFIG_AVB_VERIFY=y。 中的摘要如下所示 共同/Makefile U-Boot 源码树中有一部分代码将切换到用于生成 AVB 密钥的替代工具链、但在大多数情况下应该不需要这个代码段。 这会导致编译中断、因为主机系统上通常找不到该工具链。 。 GCC-ARM-9.2-2019.12-x86_64-aarch64-none-linux-GNU 推荐与 TI Linux SDK v8.x 配合使用的工具链能够完美地将探头转换为 ELF 文件。 SDK v8.06出现此问题而 SDK v8.05未出现此问题的原因是  自源树中引入的上行提交7988f62633 ("common:avb_verify:Add CONFIG_AVB_PUBKEY_FILE 以指定根 AVB 公共密钥")。

# Workaround: ARM linker (bfd) has a bug that segfault occurs when trying to
# parse a binary file as an input. That issue is fixed in GCC 6.2 [1] but we
# are using GCC 4.9 and it doesn't look like we are going to upgrade to the
# recent version. Fortunately, the gold linker doesn't have the problem. So,
# forcibely use the gold linker when building the avb_pubkey.o.  U-boot has
# been using bfd linker [2] for features (like OVERLAY), but that matters only
# for the final linking. Gold linker is okay for converting the binary key file
# into an ELF object file.
# [1] sourceware.org/.../msg00110.html
# [2] u-boot.denx.narkive.com/.../patch-config-always-use-gnu-ld
ld_for_avbpubkey := $(LD)
ifneq ($(findstring arm-,$(LD)),)
    ifeq ($(shell $(LD) -v | grep "GNU gold" 2> /dev/null),)
        ld_for_avbpubkey := arm-linux-androideabi-ld.gold
    endif
endif

工作区/解决方案

  1. 通过根据需要重命名工具链文件夹、确保 Aarch64交叉工具链的整个路径不包含"arm-"子字符串。 例如、在官方 TI Processor SDK v8.06中手动编译 U-Boot 不应出现此问题、或
  2. 关闭 CONFIG_AVB_VERIFY=y U-Boot 中的 CONFIG 选项。 除非使用 AVB,否则该选项不相关。