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] AM62x: U-Boot Build on SDK v8.06 fails with 'make[1]: arm-linux-androideabi-ld.gold: No such file or directory' error

Part Number: AM625

Issue Symptoms

When building U-Boot for A53 on AM62x using SDK v8.06, the build may break with the following error message:

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....

Issue Analysis

This issue is caused by the fully-expanded path of the aarch64 cross toolchain linker containing the 'arm-' substring in combination with the U-Boot build for AM62 which currently is using CONFIG_AVB_VERIFY=y. The extract shown below from common/Makefile from the U-Boot source tree contains a section of code that will switch to an alternative toolchain for AVB key generation, that however should not be needed in most cases. This causes the build to break as this toolchain is usually not found on host systems. The gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu toolchain recommended to be used with the TI Linux SDKs v8.x is perfectly capable of doing the job of turning they key blob into an ELF file. The reason this issue is happening with SDK v8.06 and not happening with SDK v8.05 is the upstream commit 7988f62633 ("common: avb_verify: Add CONFIG_AVB_PUBKEY_FILE to specify the root avb public key") that was since introduced into the source tree.

# 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] https://sourceware.org/legacy-ml/binutils-cvs/2016-10/msg00110.html
# [2] https://u-boot.denx.narkive.com/5JODsok5/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

Workarounds / Solutions

  1. Make sure the entire path of the aarch64 cross toolchain does not contain the 'arm-' substring by renaming the toolchain folder as needed. For example building U-Boot manually within the official TI Processor SDK v8.06 should not exhibit this issue, or
  2. Turn off the CONFIG_AVB_VERIFY=y config option in U-Boot. Unless you use AVB, this option is irrelevant.