This is a cache of https://discuss.96boards.org/t/failed-to-build-atf-uefi-from-source/4170. It is a snapshot of the page at 2024-11-01T07:47:44.161+0000.
Failed to build ATF-UEFI from source - HiKey 960 - 96Boards Forum

Failed to build ATF-UEFI from source

I keep getting this error. I already tried to delete everything and start over. Also yes i’m using sudo.
What i try to do eventually is to edit BL1 so that i can run some simple custom code. Without having to run UEFI with an efi application. If there is a way to only get BL1 on the board and run without going through this whole build proces please tell me. I was able to compile BL1 alone.

collect2: error: ld returned 1 exit status
make: *** [/home/nourdin/Documents/thesis/HikeyTools/BuildUefi/edk2/Build/HiKey960/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore/DEBUG/ArmPlatformPrePiUniCore.dll] Error 1

build.py…
: error 7000: Failed to execute command
make tbuild [/home/nourdin/Documents/thesis/HikeyTools/BuildUefi/edk2/Build/HiKey960/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore]

build.py…
: error 7000: Failed to execute command
make tbuild [/home/nourdin/Documents/thesis/HikeyTools/BuildUefi/edk2/Build/HiKey960/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain]

build.py…
: error F002: Failed to build module
/home/nourdin/Documents/thesis/HikeyTools/BuildUefi/edk2/ArmPlatformPkg/PrePi/PeiUniCore.inf [AARCH64, GCC5, DEBUG]

  • Failed -
    Build end time: 14:20:02, Mar.06 2018
    Build total time: 00:00:46

                                     Hikey960 DEBUG	fail

pass 0
fail 1

It would help to explain how you’re building. E.g. build commands, etc. Also, have you tried not using sudo? You’re not supposed to use sudo when running these builds.

Oh, also perhaps try building with -j1 just to see if it makes a difference. Without sudo please.

I’m following this guide: https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md

I placed these commands in an .sh file (build.sh) and ran it.

BUILD_OPTION=DEBUG

export AARCH64_TOOLCHAIN=GCC5

export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools

export EDK2_DIR=${BUILD_PATH}/edk2

EDK2_OUTPUT_DIR=${EDK2_DIR}/Build/HiKey960/${BUILD_OPTION}_${AARCH64_TOOLCHAIN}

cd ${EDK2_DIR}

# Build UEFI & ARM Trust Firmware

${UEFI_TOOLS_DIR}/uefi-build.sh -b ${BUILD_OPTION} -a ../arm-trusted-firmware hikey960 

Removing sudo did not change anything. Where do i have to place the -j1 ? I did ./build.sh -j 1 did not change anything.

Just to be sure, did you remember to create the symbolic link to OpenPlatformPkg in edk2? Which toolchain are you using? Is it in your PATH? If you’re using the correct toolchain and still getting the error, please report it here: https://github.com/96boards-hikey/tools-images-hikey960/issues/new.

BL1 and uefi/edk2 are both part of l-loader.bin so even if you just want to change the BL1 component, you still need the uefi/edk2 build/binary and then rebuild l-loader.bin and flash it to the board. You can build BL1 and uefi/edk2 manually, but the script is supposed to make it easier.

Ignore the “-j1” suggestion for now since you’re using the build script.

Yes i made the symbolic link without it gives a different error. I’m using the lastest gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu.tar.xz link : http://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/. on ubuntu 16.

Update:
I pulled the git files again this morning i did the same yesterday 3 times. But now it’s working maybe some files changed.

Good to know thanks! Good of you to keep trying too. : )

Thank you. Also thanks for the help