Compiling U-Boot for Verdin AM62

We are currently writing our application for the AM62, therefore we need to change U-Boot. I’ve found a tutorial for compiling U-Boot from source code :
https://developer.toradex.com/linux-bsp/os-development/build-u-boot-and-linux-kernel-from-source-code/build-u-boot/#downstream

At the point in the tutorial “Get and Apply the Necessary Patches”. In step 3 I get stuck.

The directory is filled with patch files. And when I run the command “git am 0001-toradex-tdx-cfg-block-use-only-snprintf.patch” I get the response:


Applying: toradex: tdx-cfg-block: use only snprintf
error: patch failed: board/toradex/common/tdx-common.c:89
error: board/toradex/common/tdx-common.c: patch does not apply
Patch failed at 0001 toradex: tdx-cfg-block: use only snprintf
hint: Use ‘git am --show-current-patch’ to see the failed patch
When you have resolved this problem, run “git am --continue”.
If you prefer to skip this patch, run “git am --skip” instead.
To restore the original branch and stop patching, run “git am --abort”.

What is going wrong?

I think the list given in the tutorial is not up-to-date anymore. You need to apply the patches in the exact same order like they’re applied in the .bb file.

If you take e.g. the .bb from the Kirkstone branch: u-boot-toradex_2022.07.bb « u-boot « recipes-bsp - meta-toradex-bsp-common.git - Toradex BSP layer, recipes common to all modules

Then you can see in line 11 the variable TDX_PATCHES being assigned. You need to apply patches like they’re ordered in this variable.

Thank you! I will try this.

The first file in u-boot-toradex_2022.07.bb from the Kirckstone branch is 0001-toradex-tdx-cfg-block-use-only-snprintf.patch and this is the same as the first file listed in the tutorial.
It it possible that i need to use the hash of a newer BSP Version? A version what is not listed now in the tutorial? The hash of the BSP version i currently use is 6.4.0.

Apparently there is also another way to build U-Boot for AM62. Described on Specifics: Build U-Boot for TI AM62x-based SoMs | Toradex Developer Center

Following this tutorial I get an error in the part Build OP-TEE Image.
After the make command (make PLATFORM=k3 CFG_ARM64_core=y)
I get after a whole list of successful compiled files :
GEN out/arm-plat-k3/core/ta_pub_key.c
Traceback (most recent call last):
File “scripts/pem_to_pub_c.py”, line 71, in
main()
File “scripts/pem_to_pub_c.py”, line 24, in main
from cryptography.hazmat.backends import default_backend
ModuleNotFoundError: No module named ‘cryptography’
make: *** [mk/subdir.mk:185: out/arm-plat-k3/core/ta_pub_key.c] Error 1

How to fix this?

Hi @RemcoSeascape !

I am double checking the steps for compiling U-Boot for Verdin AM62. I will get back you here once I have an answer.

I would like to take some steps back:

Could you please share why you would need to rebuild the U-Boot? The need to develop an application for Verdin AM62 doesn’t mean that you will need to rebuild U-Boot. What is your requirement for U-Boot?

Best regards,

We want to turn on the wdt command in U-Boot.

The following packages in needed to install
apt install python3-pip
apt install python3-pyelftools
pip3 install cryptography
pip3 install -U ‘jsonschema<4.0’

It would be nice to mention this in the prerequisites part or in then Prepare the Host Machine for Cross-Compilation section.
After installing this I get a lot further. An error occurred in “Build U-Boot for R5”.

When downloading “ti-fs-firmware-am62x-gp.bin”

Its look like $TI_LINUX_FW_DIR isnt set.

Hi @RemcoSeascape !

I was informed that indeed seems like we have some issues on our documentation on how to build U-Boot for AM62.

Following this might help you: Verdin AM62 Module — Das U-Boot unknown version documentation.

We will double check our step-by-step.

Thanks for bringing this up.

About this, please be aware that the WDT for AM62 on U-Boot is still not working: AM625: U-boot crash when RTI watchdog is enabled - Processors forum - Processors - TI E2E support forums.

Best regards,

Hello Henrique,

Thank you the documentation from Das U-Boot is helping. But only for the u-boot part.

During compiling I get a missing Blob error. It still is making the files:
tiboot3-am62x-hs-fs-verdin.bin, tispl.bin and u-boot.bin
But when i flash them the U-Boot isnt starting at boot. After a recovery i only flash u-boot.bin . Now it works. But still missing the first two files.

The errors i get when compiling are:
make CROSS_COMPILE=$CC32 BINMAN_INDIRS=$LNX_FW_PATH

Image ‘tiboot3-am62x-hs-verdin.bin’ is missing optional external blobs but is still functional: ti-fs-enc.bin sysfw-inner-cert
/binman/tiboot3-am62x-hs-verdin.bin/ti-fs-enc.bin (ti-sysfw/ti-fs-firmware-am62x-hs-enc.bin):
Missing blob
/binman/tiboot3-am62x-hs-verdin.bin/sysfw-inner-cert (ti-sysfw/ti-fs-firmware-am62x-hs-cert.bin):
Missing blob
Image ‘tiboot3-am62x-hs-fs-verdin.bin’ is missing optional external blobs but is still functional: ti-fs-enc.bin sysfw-inner-cert
/binman/tiboot3-am62x-hs-fs-verdin.bin/ti-fs-enc.bin (ti-sysfw/ti-fs-firmware-am62x-hs-fs-enc.bin):
Missing blob

and the second compile part.
make CROSS_COMPILE=$CC64 BINMAN_INDIRS=$LNX_FW_PATH BL31=$TFA_PATH/build/k3/$TFA_BOARD/release/bl31.bin TEE=$OPTEE_PATH/out/arm-plat-k3/core/tee-raw.bin

MKIMAGE u-boot-dtb.img
BINMAN .binman_stamp
Image ‘ti-dm’ is missing external blobs and is non-functional: blob-ext
/binman/ti-dm/blob-ext (ti-dm/am62xx/ipc_echo_testb_mcu1_0_release_strip.xer5f):
Missing blob

Some images are invalid
make: *** [Makefile:1125: .binman_stamp] Error 103