I downloaded a build of ATF and U-boot from the SD-images site, and it worked just fine. It indicates that it used specific versions of both ATF and U-boot, as follows:
ATF - v2.9.0 U-boot - v2025.10The current version of ATF is 2.14.0, so the trick is to get the source for a specific older version, namely 2.9.0.
v2.9 v2.9-rc0 v2.9-rc1 v2.9.0 ... v2.10 v2.10-rc0 v2.10-rc1 v2.10.0 ... v2.14 v2.14-rc0 v2.14-rc1 v2.14.0It is somewhat common to clone just the current (latest) version using a command like "git clone --depth 1". This creates a "shallow clone" with no history and no tags or branches. This is certainly faster and saves disk space, but will give you only the latest version (v2.14.0 in this case).
I find it useful to examine the file docs/change-log.md which will show the version you are working with (I see v2.14.0 on 2025-11-20 in my case).
Once you have a full clone, you can switch to any tag you like using one of:
git checkout v2.9.0 git switch --detach v2.9.0This puts you in "detached HEAD" stage, which will make you crazy if you try to do much of anything. To get out of this, use one of:
git checkout master git switch -
export CROSS_COMPILE=aarch64-linux-gnu- cd /Projects/ARM-sources/ cd arm-trusted-firmware make clean git checkout v2.9.0 make PLAT="sun50i_a64" DEBUG=1 bl31I still get this error:
BL31 image has exceeded its limit. aarch64-linux-gnu-ld.bfd: region `RAM' overflowed by 224 bytesThis is disappointing and leaves me wondering how the SD-images guy built ATF for the h5. Perhaps the difference is the compiler.
make PLAT="sun50i_a64" DECRYPTION_SUPPORT=none DEBUG=1 bl31 make PLAT="sun50i_a64" DECRYPTION_SUPPORT=none TRUSTED_BOARD_BOOT=0 DEBUG=1 bl31Neither of these makes any difference (presumably these options were already off).
make PLAT="sun50i_a64" DEBUG=1 CFLAGS="-Os" bl31Typing "make clean" does not seen to work, so do this:
rm -rf build/* make PLAT="sun50i_a64" DEBUG=1 CFLAGS="-Os" bl31Note -- what you want to do is make PLAT="sun50i_a64" clean. This will clean the build/sun50i_a64 directory I believe. The build system sets up separate build subdirectories for each platform and you can keep multiple builds side by side this way.
Enabling optimization makes no difference either. Apparently the -Os option is already built into the Makefile
I use the V=1 option to get full details of the compile options and decide to try this. I am assuming that "backtrace" is a debugging feature for when things go badly wrong.
rm -rf build/* make PLAT="sun50i_a64" ENABLE_BACKTRACE=0 DEBUG=1 bl31And it works! Results are:
cd build/sun50i_a64/debug -rwxr-xr-x 1 tom tom 45277 Jan 22 22:40 bl31.bin cd build/sun50i_a64/debug/bl31.elf -rwxr-xr-x 1 tom tom 550712 Jan 22 22:40 bl31.elf
Tom's electronics pages / tom@mmto.org