The second point is less obvious. The story is that if you build for your target, the build will leave ".o" files all through the U-Boot source tree and those serve to indicate which files were actually used in the build. I find this extremely handy, indispensible in fact. Just for the record, the current mainlin U-Boot has config files for 1432 different targets and not all of these are even ARM boards. This means that only a small fraction of the files in the source tree are actually used to build for my target, and it is all but impossible to figure out which without having the .o files as a helpful guide.
I issue commands as follows:
cd /u1/Projects/OrangePi/Rockchip/U-boot make orangepi-rk3399_defconfig CROSS_COMPILE=aarch64-linux-gnu- export CROSS_COMPILE make clean makeNote that typing "make clean" preserves the config you selected, but in general will be a bad idea as it forces a full compile of everything.
Also note that you can just set CROSS_COMPILE=aarch64-linux-gnu- near the top of the Makefile and avoid having to set the enviroment variable each time, which I find handy. Everything goes nice and smooth except for this:
./"arch/arm/mach-rockchip/make_fit_atf.py" \ arch/arm/dts/rk3399-orangepi.dtb > u-boot.its WARNING: BL31 file bl31.elf NOT found, resulting binary is non-functional WARNING: Please read Building section in doc/README.rockchip MKIMAGE u-boot.itb MKIMAGE tpl/u-boot-tpl-rockchip.bin
What we should do at this point is to take a look at README.rockchip, as advised, and also inspect the U-Boot Makefile and see what is triggering its complaint as well as what it would like to find and what it intends to do with it.
A peek at README.rockchip is quite interesting. They offer two paths. One is to use something called rkbin to create trust.img. The other is to get the ATF sources and build bl31.bin as well as a thing that runs on a Cortex-M0 core in the RK3399, namely the Cortex-M0 PMU. This requires a Cortex M0 cross compiler, which they describe. (they also say the Cortex M0 PMU business is optional.
Now let's look at the Makefile. The message we see comes from a Python script "arch/arm/mach-rockchip/make_fit_atf.py" as indicated in the message. The section in the Makefile is:
# Boards with more complex image requirements can provide an .its source file # or a generator script # NOTE: Please do not use this. We are migrating away from Makefile rules to use # binman instead. ifneq ($(CONFIG_SPL_FIT_SOURCE),"") U_BOOT_ITS := u-boot.its $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) $(call if_changed,copy) else ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),) U_BOOT_ITS := u-boot.its ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py") U_BOOT_ITS_DEPS += u-boot endif $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE $(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \ $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@ endif endifA look at u-boot.cfg shows:
#define CONFIG_SPL_FIT_SOURCE "" #define CONFIG_SPL_FIT_GENERATOR "arch/arm/mach-rockchip/make_fit_atf.py"We can run make as "make V=1" to get a lot more information:
./tools/mkimage -f auto -A arm -T firmware -C none -O u-boot -a 0x00200000 -e 0x00200000 -p 0x0 -n "U-Boot 2022.01""-00450-g25711b07ca-dirty for evb_rk3399 board" -E -b arch/arm/dts/rk3399-orangepi.dtb -d u-boot-nodtb.bin u-boot-dtb.img ./"arch/arm/mach-rockchip/make_fit_atf.py" \ arch/arm/dts/rk3399-orangepi.dtb > u-boot.its WARNING: BL31 file bl31.elf NOT found, resulting binary is non-functional WARNING: Please read Building section in doc/README.rockchip ./tools/mkimage -E -B 0x8 -f u-boot.its -p 0x0 u-boot.itb >/dev/null && cat /dev/null ./tools/mkimage -n "rk3399" -T rksd -d tpl/u-boot-tpl.bin tpl/u-boot-tpl-rockchip.bin cat tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin > idbloader.img aarch64-linux-gnu-objcopy --gap-fill=0xff -j .text -j .secure_text -j .secure_data -j .rodata -j .data -j .u_boot_list -j .rela.dyn -j .got -j .got.plt -j .binman_sym_table -j .text_rest -j .dtb.init.rodata -j .efi_runtime -j .efi_runtime_rel -I binary -O binary --pad-to=8355840 --gap-fill=0xff idbloader.img u-boot-rockchip.bin && cat u-boot.itb >> u-boot-rockchip.bin || { rm -f u-boot-rockchip.bin; false; }We only get the BL31 image the first time we run make. U-Boot has a stub bl31.c file that it compiles to bl31.elf and that eliminates the complaint on the next pass. Will it work though?
So this is an unfinished puzzle -- how to build U-boot from source and stick it on an SD card.
Here are some nice instructions for how to do it (involving bl31) for the pine rock64. The Rock64 is based on the Rockchip RK3328.
setenv bootaddr 0x02000000 setenv kyu_bootcmd "echo Booting Kyu via dhcp ; dhcp ${bootaddr}; go ${bootaddr}" setenv bootcmd "run kyu_bootcmd" saveenv
Tom's electronics pages / tom@mmto.org