unfortunately ARM trusted firmware has no support for g12b platform yet
so instead hardkernel repo is used for images other than BL33 (u-boot
payload itself). that in turn makes the experience pretty nightmarish ie
hardkernel uboot requires x86_64 host (x86_64 binaries are literally
part of the process) and an ancient toolchain (gcc4). summary of patches
to make build fully working on aarch64 with modern toolchain:
hardkernel-uboot-gcc5.patch: don't fail on gcc newer than 4 and instead
use same include file as for gcc4 with newer gcc versions
hardkernel-uboot-werror.patch: disable -Werror preventing successful
compilation with modern toolchain
hardkernel-uboot-arm_cross.patch: boot image requires toolchains for
both aarch64 and arm. hardkernel hardcoded the values without a
possibility to override them independently so add such support
hardkernel-uboot-no_stdint.patch: don't include unused stdint.h which
likely requires glibc
hardkernel-uboot-x86_64_bin.patch: build process requires use of x86_64
binaries so add support for emulation wrappers -- separately for static
binaries (qemu) and dynamic binaries (box64)
hardkernel-uboot-acs.patch: acs.bin is a simple binary with
configuration data organized around acs_setting struct loaded into fixed
address in memory. first value in this binary points to beginning of
acs_setting struct. now likely due to toolchain differences first value
with address is either followed by 2 words of zeros (original gcc4 based
toolchain) or 1 word of zeros (up-to-date toolchain) which is enough of a
difference to create broken image. ensure acs_setting address is
followed by at least two words of zeros
hardkernel-uboot-uboot_payload.patch: make BL33 image location
customizable so final image assembly can refer to uboot payload we
target. note that this way process is much simpler than following:
https://u-boot.readthedocs.io/en/latest/board/amlogic/odroid-n2.html
and it also produces smaller image than docs from u-boot which is pretty
significant difference as the bigger image is big enough to prevent
creation of first partition at 2048 sector boundary