ARM 64 位交叉编译

Cross compilation for ARM 64Bit

我正在尝试编译支持 TPM 的 U-Boot,我遵循了这个指南:https://github.com/joholl/rpi4-uboot-tpm。我使用带有 Ubuntu 20.04.1 LTS 服务器的 VM 来进行交叉编译。它工作正常,但是当我在 make menuconfig(命令行界面 → 信息命令 → cpu)期间添加其他选项时,将 cpu 命令添加到 U-Boot,编译失败并显示以下内容:

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'

我试过 32 位交叉编译器,我也试过直接在 raspberry pi 上编译,但还是失败了。

有人可以建议我如何解决这个问题吗?

CONFIG_CMD_CPU 取决于 CONFIG_CPU。不幸的是,cmd/Kconfig 中缺少此依赖项。使用 CONFIG_CPU=y 您的编译错误已解决。我为此创建了一个补丁:

[补丁 1/1] 命令:CMD_CPU 取决于 CPU
https://lists.denx.de/pipermail/u-boot/2020-November/431952.html

CMD_CPU 需要驱动程序提供任何输出。 Raspberry Pi 的 CPU 没有合适的驱动程序。所以你不会通过 'cpu list' 和 'cpu detail'.

得到任何输出

我认为可以编写一个通用驱动程序来解析设备树,它可以告诉您您有 4 * arm,cortex-a72。但你可能已经意识到了这一点。