Search code examples
cross-compilingu-boottpm

Cross compilation for ARM 64Bit


I am trying to compile U-Boot with TPM support and I followed this guide: https://github.com/joholl/rpi4-uboot-tpm . I used VM with Ubuntu 20.04.1 LTS server, to do cross compilation. It works ok, but when I add additional option during make menuconfig (Command line interface →Info commands → cpu), that adds cpu command to U-Boot, compilation fails with following:

aarch64-linux-gnu-ld.bfd: cmd/built-in.o: in function `print_cpu_list':
/home/user/u-boot/cmd/cpu.c:34: undefined reference to `cpu_get_desc'
aarch64-linux-gnu-ld.bfd: /home/user/u-boot/cmd/cpu.c:39: undefined reference to `cpu_get_info'
Segmentation fault (core dumped)
make: *** [Makefile:1757: u-boot] Error 139
make: *** Deleting file 'u-boot'

I tried 32 bit cross compiler and I tried also to compile on raspberry pi directly, but it fails all the same.

Can someone please suggest what I could do to solve this problem?


Solution

  • CONFIG_CMD_CPU depends on CONFIG_CPU. Unfortunately this dependency is missing in cmd/Kconfig. With CONFIG_CPU=y your compilation error is resolved. I have created a patch for this:

    [PATCH 1/1] cmd: CMD_CPU depends on CPU
    https://lists.denx.de/pipermail/u-boot/2020-November/431952.html

    CMD_CPU requires a driver to provide any output. There is no suitable driver for the CPU of the Raspberry Pi. So you will not get any output via 'cpu list' and 'cpu detail'.

    I think a generic driver could be written that parses the device tree which would be able to tell you that you have 4 * arm,cortex-a72. But probably you are already aware of this.