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
: error 7000: Failed to execute command
make tbuild [/home/nourdin/Documents/thesis/HikeyTools/BuildUefi/edk2/Build/HiKey960/DEBUG_GCC5/AARCH64/ArmPlatformPkg/PrePi/PeiUniCore]
: error 7000: Failed to execute command
make tbuild [/home/nourdin/Documents/thesis/HikeyTools/BuildUefi/edk2/Build/HiKey960/DEBUG_GCC5/AARCH64/MdeModulePkg/Core/Dxe/DxeMain]
: 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:

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



export UEFI_TOOLS_DIR=${BUILD_PATH}/uefi-tools

export EDK2_DIR=${BUILD_PATH}/edk2


cd ${EDK2_DIR}

# Build UEFI & ARM Trust Firmware

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

Removing sudo did not change anything. Where do i have to place the -j1 ? I did ./ -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:

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 : on Ubuntu 16.

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