Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E715FC7EE22 for ; Wed, 3 May 2023 09:08:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9B74584749; Wed, 3 May 2023 11:08:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=etri.re.kr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=dooray.com header.i=@dooray.com header.b="IVoXhRQN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5144E8474C; Wed, 3 May 2023 11:08:07 +0200 (CEST) Received: from mscreen.etri.re.kr (mscreen.etri.re.kr [129.254.9.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5BD4084747 for ; Wed, 3 May 2023 11:07:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=etri.re.kr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ckim@etri.re.kr Received: from unknown (HELO send002-relay.gov-dooray.com) (211.180.235.153) by 129.254.9.16 with ESMTP; 3 May 2023 18:07:52 +0900 X-Original-SENDERIP: 211.180.235.153 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: u-boot@lists.denx.de Received: from [10.162.225.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send002-relay.gov-dooray.com with SMTP id 28b359ce64522468; Wed, 03 May 2023 18:07:52 +0900 DKIM-Signature: a=rsa-sha256; b=IVoXhRQNTCJfqCKor/GjTYzJzhkcIBr9PG7AqVqwpdlcD1bGbrXlb4uZmMGPPOI0xUnxRgMIVj 9HtspjrQ7Juti9j4egY5u8kFs0zuBSUlMKu6pS2AtKweTFmqnyga0CFNGlzdI075k0ZO0n1JiTd5 dDgyD6bO+rnokgfz486CABP0rkbW73lAAtqtxKJnftYcvdFrkEFiggWrNNgpIxKTP8zSomW5ZIxI rO0GzSDmhdztEdBigQJilmf5Cx6hewQXG5I7G2cAVf1stlhU5+lrfv3QfTLyig+FGp+9mjiESmt2 /TBVqojaKT3v9Bf3ewXtIFfjbPRaXStWB4DUoQzw==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=jszD4HFchz0FjE6tw0o0qRaPzIAGkc2JehLMfVVSOP8=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp001-imp.gov-dooray.com with SMTP id adf61bc264522468; Wed, 03 May 2023 18:07:52 +0900 From: "Chan Kim" To: "U-Boot Mailing List" 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) Date: Wed, 3 May 2023 18:07:51 +0900 Message-ID: <0b9b01d97d9e$bd50bc70$37f23550$@etri.re.kr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Content-Language: ko Thread-Index: Adl9nrzkP+P3uQrdSnamWA+Cu/vzyg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 here with some update). I used u-boot v2022.07 and I wanted to use SPL mode and 'Boot from RAM' mode. So when calling qemu, I give option so that linux kernel image is at certain 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 config ARCH_QEMU, select SPL select RAM select SPL_DM select SUPPORT_SPL select SPL_RAM_SUPPORT select SPL_RAM_DEVICE select SPL_OS_BOOT select SPL_OF_LIBFDT select OF_LIBFDT select SPL_LIBGENERIC_SUPPORT To make some errors in the link script, I added in include/configs/qemu-arm.h,(in the qemu machine, DRAM seemd to start at 0x40000000 and it said dtb is placed at the first 2MB) #define CONFIG_SYS_INIT_RAM_ADDR 0x40200000 #define CONFIG_SPL_MAX_SIZE 0x400000 #define CONFIG_SPL_BSS_START_ADDR 0x40800000 #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 and I added this function at board/emulation/qemu-arm/qemu-arm.c to avoid compile error(undefined ref for spl_boot_device). #include u32 spl_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- -j28 But I see this compile errors (see at the bottom). ENVC include/generated/env.txt UPD 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.so aarch64-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 OBJCOPY lib/efi_selftest/efi_selftest_miniapp_return.efi lib/efi_selftest/../../tools/file2include lib/efi_selftest/efi_selftest_miniapp_return.efi > \ lib/efi_selftest/efi_miniapp_file_image_return.h OBJCOPY lib/efi_selftest/efi_selftest_miniapp_exception.efi lib/efi_selftest/../../tools/file2include lib/efi_selftest/efi_selftest_miniapp_exception.efi > \ lib/efi_selftest/efi_miniapp_file_image_exception.h AR 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.so aarch64-none-elf-ld.bfd: warning: -z norelro ignored OBJCOPY lib/efi_selftest/efi_selftest_miniapp_exit.efi lib/efi_selftest/../../tools/file2include lib/efi_selftest/efi_selftest_miniapp_exit.efi > \ lib/efi_selftest/efi_miniapp_file_image_exit.h CC 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.so aarch64-none-elf-ld.bfd: warning: -z norelro ignored OBJCOPY lib/efi_loader/initrddump.efi LD lib/efi_loader/dtbdump_efi.so aarch64-none-elf-ld.bfd: warning: -z norelro ignored OBJCOPY lib/efi_loader/dtbdump.efi CC 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-spl aarch64-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 to `calloc' aarch64-none-elf-ld.bfd: drivers/core/device.o: in function `device_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 to `calloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:137: undefined reference to `calloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:151: undefined reference to `calloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/device.c:234: undefined reference to `free' 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' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/uclass.c:78: undefined reference to `calloc' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/uclass.c:101: undefined reference to `free' aarch64-none-elf-ld.bfd: /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/core/uclass.c:106: undefined reference to `free' aarch64-none-elf-ld.bfd: drivers/firmware/psci.o: in function `psci_bind': /home/ckim/SuperCom/U-BOOT/temp/u-boot.v2022.07/drivers/firmware/psci.c:101: 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 to `device_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 2 How 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