build error "undefined reference to `fdtdec_setup_memory_banksize'" (running u-boot and linux on qemu arm64 machine using SPL BOOT from RAM mode)
I soon found how to fix it..
From internet search, I found my old post on stackexchange :
https://stackoverflow.com/questions/70017750/undefined-reference-to-memcpy-d
uring-u-boot-spl-build-how-can-i-use-the-archt
So after adding 'select SPL_LIBCOMMON_SUPPORT' to 'config ARCH_QEMU' in arch/arm/Kconfig, those errors are gone.
Thank you.
Chan Kim
Quoted 8 lines
-----Original Message-----
From: Chan Kim <[email protected]>
Sent: Wednesday, May 3, 2023 6:08 PM
To: U-Boot Mailing List <[email protected]>
Subject: [Question] build error "undefined reference to `fdtdec_setup_memory_banksize'" (running u-boot and linux on qemu arm64 machine using SPL BOOT from RAM mode)
Quoted 5 lines
Hello u-boot experts,
I tried running u-boot on qemu arm64 machine and wanted to make u-boot-spl automatically switch to linux.
(I asked this question on qemu-discuss email, but no answer yet, so I ask
it
Quoted 4 lines
here with some update).
I used u-boot v2022.07 and I wanted to use SPL mode and 'Boot from RAM'
mode.
Quoted 1 line
So when calling qemu, I give option so that linux kernel image is at
certain
Quoted 111 lines
DRAM address already, and I wish u-boot will switch to the kernel address. Originally, the qemu-arm64 board doesn't support SPL so I added/fixed some things.
I added in
arch/arm/Kconfig, under configARCH_QEMU,
select SPL
select RAM
selectSPL_DM
selectSUPPORT_SPL
selectSPL_RAM_SUPPORT
selectSPL_RAM_DEVICE
selectSPL_OS_BOOT
selectSPL_OF_LIBFDT
selectOF_LIBFDT
selectSPL_LIBGENERIC_SUPPORTTo make some errors in the link script, I added in
include/configs/qemu-arm.h,(in the qemu machine, DRAM seemd to start at0x40000000and it said dtb is placed at the first 2MB)#define
CONFIG_SYS_INIT_RAM_ADDR0x40200000#defineCONFIG_SPL_MAX_SIZE0x400000#defineCONFIG_SPL_BSS_START_ADDR0x40800000#defineCONFIG_SPL_BSS_MAX_SIZE0x100000and I added this function at
board/emulation/qemu-arm/qemu-arm.cto avoid compileerror(undefined ref for spl_boot_device).#include <
asm/spl.h>
u32spl_boot_device(void){ return BOOT_DEVICE_NONE; }This is how I compile u-boot-spl.
$ make CROSS_COMPILE=aarch64_none_elf- qemu_arm64_defconfig $ make CROSS_COMPILE=aarch64_none_elf- -j28But I see this compile errors (see at the bottom).
ENVC
include/generated/env.txtUPD include/generated/timestamp_autogenerated.h CFGCHK u-boot.cfg ENVP include/generated/env.in ENVT include/generated/environment.h OFCHK .config CC cmd/version.o CC env/common.o AR cmd/built-in.o CC lib/efi_loader/dtbdump.o CC lib/efi_loader/initrddump.o CC lib/efi_selftest/efi_selftest_miniapp_exception.o CC lib/efi_selftest/efi_selftest_miniapp_exit.o CC lib/efi_selftest/efi_selftest_miniapp_return.o LD lib/efi_selftest/efi_selftest_miniapp_return_efi.soaarch64-none-elf-ld.bfd LD
lib/efi_selftest/efi_selftest_miniapp_exception_efi.so: warning: -z norelro ignored aarch64-none-elf-ld.bfd: warning: -z norelro ignored
OBJCOPYlib/efi_selftest/efi_selftest_miniapp_return.efilib/efi_selftest/../../tools/file2includelib/efi_selftest/efi_selftest_miniapp_return.efi> \lib/efi_selftest/efi_miniapp_file_image_return.h
OBJCOPYlib/efi_selftest/efi_selftest_miniapp_exception.efilib/efi_selftest/../../tools/file2includelib/efi_selftest/efi_selftest_miniapp_exception.efi> \lib/efi_selftest/efi_miniapp_file_image_exception.hAR env/built-in.o CC lib/efi_selftest/efi_selftest_startimage_return.o CC lib/efi_selftest/efi_selftest_exception.o LD lib/efi_selftest/efi_selftest_miniapp_exit_efi.soaarch64-none-elf-ld.bfd: warning: -z norelro ignored
OBJCOPYlib/efi_selftest/efi_selftest_miniapp_exit.efilib/efi_selftest/../../tools/file2includelib/efi_selftest/efi_selftest_miniapp_exit.efi> \lib/efi_selftest/efi_miniapp_file_image_exit.hCC lib/efi_selftest/efi_selftest_load_file.o CC lib/efi_selftest/efi_selftest_loadimage.o CC lib/efi_selftest/efi_selftest_startimage_exit.o LD lib/efi_loader/initrddump_efi.soaarch64-none-elf-ld.bfd: warning: -z norelro ignored
OBJCOPYlib/efi_loader/initrddump.efi
LDlib/efi_loader/dtbdump_efi.so
aarch64-none-elf-ld.bfd: warning: -z norelro ignored
OBJCOPYlib/efi_loader/dtbdump.efiCC spl/common/spl/spl.o AR lib/efi_selftest/built-in.o AR lib/built-in.o AR spl/common/spl/built-in.o LD spl/u-boot-splaarch64-none-elf-ld.bfd:
drivers/core/device.o: in function `alloc_priv':/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:308:
undefined reference to `memalign'
aarch64-none-elf-ld.bfd:/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:340: undefined reference tocalloc' aarch64-none-elf-ld.bfd: drivers/core/device.o: in functiondevice_bind_common':/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:64:
undefined reference to `calloc'
aarch64-none-elf-ld.bfd:/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:118: undefined reference tocalloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u- boot.v2022.07/drivers/core/device.c:137: undefined reference tocalloc' aarch64-none-elf-ld.bfd:/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:151: undefined reference tocalloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u- boot.v2022.07/drivers/core/device.c:234: undefined reference tofree' aarch64-none-elf-ld.bfd:drivers/core/uclass.o: in function `uclass_add':/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/uclass.c:72:
undefined reference to `calloc'
Quoted 8 lines
aarch64-none-elf-ld.bfd:
/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/uclass.c:78: undefined reference tocalloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u- boot.v2022.07/drivers/core/uclass.c:101: undefined reference tofree' aarch64-none-elf-ld.bfd:/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/uclass.c:106: undefined reference tofree' aarch64-none-elf-ld.bfd: drivers/firmware/psci.o: in functionpsci_bind':/home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/firmware/psci.c:101
:
Quoted 15 lines
undefined reference to
device_is_compatible' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u- boot.v2022.07/drivers/firmware/psci.c:102: undefined reference todevice_is_compatible'
aarch64-none-elf-ld.bfd: u-boot-spl: hidden symbol `calloc' isn't defined aarch64-none-elf-ld.bfd: final link failed: bad value make[1]: *** [scripts/Makefile.spl:525: spl/u-boot-spl] Error 1
make: *** [Makefile:2106: spl/u-boot-spl] Error 2How can I remove this kind of errors?
If someone could provide me an anser or hind, I will be very grateful. Thank you!Chan Kim