适用于ARM 64Bit的交叉编译

问题描述

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

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位交叉编译器,也尝试直接在树莓派上进行编译,但都失败了。

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

解决方法

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

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

CMD_CPU需要驱动程序来提供任何输出。 Raspberry Pi的CPU没有合适的驱动程序。因此,您将不会通过“ cpu列表”和“ cpu详细信息”获得任何输出。

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