Failure to link when building u-boot using R32.2.3 sources

Hello, I’m trying to build u-boot using the R32.2.3 sources for the TX1. My .config for u-boot can be found at this link http://dpaste.com/01E9HYT .

I’m using the cross compiler called gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu which I got from https://developer.nvidia.com/embedded/dlc/l4t-gcc-7-3-1-toolchain-64-bit Here is the way I am invoking make:

make ARCH="arm64" CROSS32CC="/home/ryan/usr/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc-7.3.1" CROSS_COMPILE="aarch64-linux-gnu-" -j8

I don’t actually type that every time, but it lives in a little script file in my $PATH.

The error I see is from the linker related to multiple definitions of many things found in arch/arm/cpu/armv8/start.S, which is weird because I can only find one definition and any inclusion guards I have tried to use have not made any affect on the linking step. Here is the error message

LD      u-boot
arch/arm/cpu/armv8/start.o: In function `_start':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_start'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_TEXT_BASE':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_TEXT_BASE'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_end_ofs':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_end_ofs'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_bss_start_ofs':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_bss_start_ofs'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_bss_end_ofs':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_bss_end_ofs'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `save_boot_params_ret':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:71: multiple definition of `save_boot_params_ret'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:71: first defined here
arch/arm/cpu/armv8/start.o: In function `c_runtime_cpu_setup':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:307: multiple definition of `c_runtime_cpu_setup'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:307: first defined here
make: *** [u-boot] Error 1

The regular verbosity make log can be found here http://dpaste.com/0BT7HA7

The uname -a from the machine I am compiling on currently is

Linux tetris 3.19.0-41-generic #46~14.04.2-Ubuntu SMP Tue Dec 8 17:46:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

I will be very disappointed if somebody recommends I upgrade to a newer Ubuntu. I highly doubt this is the problem as I have attempted the same thing, and have run into the exact same error message using a recently built x86_64 Gentoo VM (kernel 4.19.72) using an aarch64-unknown-linux-gnueabi-8.3.0 toolchain

I hope somebody can help me with this. Thanks for spending time looking into it.

Hi RLC,

List build u-boot steps for you reference:

export CROSS_COMPILE=<toolchain_install_path>/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
tar xpvf u-boot_src.tbz2
cd u-boot
make distclean
make p2371-2180_defconfig
make

You got it!

ryan@tetris:~/RegOS/public_sources_R32.2.3/u-boot$ make ARCH="arm64" CROSS_COMPILE="/home/ryan/usr/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-" distclean
ryan@tetris:~/RegOS/public_sources_R32.2.3/u-boot$ make ARCH="arm64" CROSS_COMPILE="/home/ryan/usr/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-" p2371-2180_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
ryan@tetris:~/RegOS/public_sources_R32.2.3/u-boot$ make ARCH="arm64" CROSS_COMPILE="/home/ryan/usr/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-" -j8 > /dev/null
arch/arm/cpu/armv8/start.o: In function `_start':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_start'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_TEXT_BASE':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_TEXT_BASE'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_end_ofs':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_end_ofs'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_bss_start_ofs':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_bss_start_ofs'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `_bss_end_ofs':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: multiple definition of `_bss_end_ofs'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/./arch/arm64/include/asm/boot0-linux-kernel-header.h:40: first defined here
arch/arm/cpu/armv8/start.o: In function `save_boot_params_ret':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:98: multiple definition of `save_boot_params_ret'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:98: first defined here
arch/arm/cpu/armv8/start.o: In function `c_runtime_cpu_setup':
/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:307: multiple definition of `c_runtime_cpu_setup'
arch/arm64/cpu/armv8/start.o:/home/ryan/RegOS/public_sources_R32.2.3/u-boot/arch/arm/cpu/armv8/start.S:307: first defined here
make: *** [u-boot] Error 1

For posterity, here is the diff between the default config(left) and the one I uploaded earlier(right):

ryan@tetris:~/RegOS/public_sources_R32.2.3/u-boot$ diff .config /tmp/u-boot.config 
32c32
< # CONFIG_POSITION_INDEPENDENT is not set
---
> CONFIG_POSITION_INDEPENDENT=y
36d35
< CONFIG_STATIC_RELA=y
192,193c191,192
< CONFIG_DEFAULT_DEVICE_TREE="tegra210-p2371-2180"
< # CONFIG_AHCI is not set
---
> CONFIG_DEFAULT_DEVICE_TREE="tegra210-jetson-tx1-p2597-2180-a01-devkit"
> CONFIG_AHCI=y
199c198
< CONFIG_LOCALVERSION=""
---
> CONFIG_LOCALVERSION="LRI-Ryan"
201c200
< CONFIG_CC_OPTIMIZE_FOR_SIZE=y
---
> # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
211c210
< CONFIG_OF_SYSTEM_SETUP=y
---
> # CONFIG_OF_SYSTEM_SETUP is not set
229,230c228,229
< # CONFIG_SATA_BOOT is not set
< # CONFIG_SD_BOOT is not set
---
> CONFIG_SATA_BOOT=y
> CONFIG_SD_BOOT=y
232c231
< CONFIG_BOOTDELAY=2
---
> CONFIG_BOOTDELAY=3
240c239
< CONFIG_SYS_PROMPT="Tegra210 (P2371-2180) # "
---
> CONFIG_SYS_PROMPT="hush> "
246c245,250
< # CONFIG_AUTOBOOT_KEYED is not set
---
> CONFIG_AUTOBOOT_KEYED=y
> CONFIG_AUTOBOOT_PROMPT="Autoboot in %d seconds\n"
> # CONFIG_AUTOBOOT_ENCRYPTION is not set
> CONFIG_AUTOBOOT_DELAY_STR=""
> CONFIG_AUTOBOOT_STOP_STR=""
> # CONFIG_AUTOBOOT_KEYED_CTRLC is not set
265c269
< # CONFIG_CMD_BOOTZ is not set
---
> CONFIG_CMD_BOOTZ=y
271c275
< # CONFIG_CMD_IMI is not set
---
> CONFIG_CMD_IMI=y
282c286
< # CONFIG_CMD_GREPENV is not set
---
> CONFIG_CMD_GREPENV=y
303c307
< # CONFIG_CMD_FLASH is not set
---
> CONFIG_CMD_FLASH=y
307,308c311,312
< CONFIG_CMD_SF=y
< CONFIG_CMD_SPI=y
---
> # CONFIG_CMD_SF is not set
> # CONFIG_CMD_SPI is not set
311,313c315,317
< CONFIG_CMD_DFU=y
< CONFIG_CMD_USB_MASS_STORAGE=y
< # CONFIG_CMD_FPGA is not set
---
> # CONFIG_CMD_DFU is not set
> # CONFIG_CMD_USB_MASS_STORAGE is not set
> CONFIG_CMD_FPGA=y
322c326
< # CONFIG_CMD_SETEXPR is not set
---
> CONFIG_CMD_SETEXPR=y
333,334c337,338
< CONFIG_CMD_MII=y
< CONFIG_CMD_PING=y
---
> # CONFIG_CMD_MII is not set
> # CONFIG_CMD_PING is not set
343c347
< # CONFIG_CMD_CACHE is not set
---
> CONFIG_CMD_CACHE=y
392c396
< # CONFIG_SPL_DM_SEQ_ALIAS is not set
---
> CONFIG_SPL_DM_SEQ_ALIAS=y
427c431
< # CONFIG_DMA is not set
---
> CONFIG_DMA=y
511,523c515
< CONFIG_SPI_FLASH=y
< # CONFIG_SPI_FLASH_BAR is not set
< # CONFIG_SPI_FLASH_ATMEL is not set
< # CONFIG_SPI_FLASH_EON is not set
< # CONFIG_SPI_FLASH_GIGADEVICE is not set
< # CONFIG_SPI_FLASH_MACRONIX is not set
< # CONFIG_SPI_FLASH_SPANSION is not set
< # CONFIG_SPI_FLASH_STMICRO is not set
< # CONFIG_SPI_FLASH_SST is not set
< CONFIG_SPI_FLASH_WINBOND=y
< CONFIG_SPI_FLASH_USE_4K_SECTORS=y
< # CONFIG_SPI_FLASH_DATAFLASH is not set
< # CONFIG_SPI_FLASH_MTD is not set
---
> # CONFIG_SPI_FLASH is not set
526,533c518
< CONFIG_NETDEVICES=y
< # CONFIG_ALTERA_TSE is not set
< # CONFIG_DWC_ETH_QOS is not set
< # CONFIG_E1000 is not set
< # CONFIG_ETH_DESIGNWARE is not set
< # CONFIG_PCH_GBE is not set
< # CONFIG_RTL8139 is not set
< CONFIG_RTL8169=y
---
> # CONFIG_NETDEVICES is not set
540c525
< CONFIG_PCI_TEGRA=y
---
> # CONFIG_PCI_TEGRA is not set
588c573
< CONFIG_SYS_NS16550=y
---
> # CONFIG_SYS_NS16550 is not set
607c592
< CONFIG_TEGRA114_SPI=y
---
> # CONFIG_TEGRA114_SPI is not set
640d624
< # CONFIG_USB_DWC3 is not set
657,666c641
< CONFIG_USB_GADGET=y
< # CONFIG_USB_GADGET_ATMEL_USBA is not set
< # CONFIG_USB_GADGET_DWC2_OTG is not set
< CONFIG_CI_UDC=y
< CONFIG_USB_GADGET_VBUS_DRAW=2
< CONFIG_USB_GADGET_DUALSPEED=y
< CONFIG_USB_GADGET_DOWNLOAD=y
< CONFIG_G_DNL_MANUFACTURER="NVIDIA"
< CONFIG_G_DNL_VENDOR_NUM=0x0955
< CONFIG_G_DNL_PRODUCT_NUM=0x701a
---
> # CONFIG_USB_GADGET is not set

I am by no means saying the one I uploaded is acceptable. I didn’t start from the default config, which I should have. I’ll use the default one in the future, but as far as I can tell, the default config will still be unable to link.

I noticed this excerpt in your original compile line:

...ARCH="arm64" CROSS32CC="...

“CROSS32CC” is for arm32, not arm64. I don’t know about this particular bootloader code, but I don’t think you need CROSS32CC anymore. Back when arm64 was new the only 64-bit code was in the Linux kernel itself, and everything else (bootloader, user space, so on) was still 32-bit. The CROSS32CC was used only when two compilers were used simultaneously (there was a vdso kernel feature which needed 32-bit in the first releases).

That is very useful and interesting information. Thank you. I had just included that environment variable definition because the guy before me had done the same.

I’m not sure how linuxdev’s post was selected as the solution, as that did not solve the problem.

If you are building just U-Boot, then you may need “ARCH=armhf” instead since U-Boot (so far as I know) has always been 32-bit even on 64-bit ARM systems (you’d need a different cross compiler for 32-bit, which is ARMv7-a). Any error message you get would be useful.