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 9CC81C7EE22 for ; Wed, 3 May 2023 09:17:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A5B7084747; Wed, 3 May 2023 11:17:33 +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="fjPlgOen"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E097684749; Wed, 3 May 2023 11:17:32 +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 E8A7A84729 for ; Wed, 3 May 2023 11:17:24 +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 send001-relay.gov-dooray.com) (211.180.235.152) by 129.254.9.16 with ESMTP; 3 May 2023 18:17:18 +0900 X-Original-SENDERIP: 211.180.235.152 X-Original-MAILFROM: ckim@etri.re.kr X-Original-RCPTTO: u-boot@lists.denx.de Received: from [10.162.225.112] (HELO smtp002-imp.gov-dooray.com) ([10.162.225.112]) by send001-relay.gov-dooray.com with SMTP id c7aacd006452269e; Wed, 03 May 2023 18:17:18 +0900 DKIM-Signature: a=rsa-sha256; b=fjPlgOena/KzBZkTeAdFIgtciy8me71ZsYrv92/4QPypkddsw39EVBvlshbqo3N4ilR2dhBA/P oOvPFo395YowAorCdNm4uj9UHuALNeXWlTI6ReSk22UQTf0HlXZB0d/tQg3bDVP8ZEt03jMCJoEj 1pjmXDil6SSm0zasuqWWuGlj3bDC9AMAlUnSCo/OQmlJWkukn3MEjG+zPJrhayg4JU2tKZkpxSo5 mWdtL87qQnXTyBYi8+HBlMCZX7C993nqJQOf6sEVklKrkkZz0pxDnWLmCHcj5L6U7EgINLPRx5H1 4Dakgd83+IPDMNf3D1YzlRdwMaqiqeDP532H4xEQ==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=t9b+BCSwif2OtHPt8UTnW5HTrf4IwJmbkS88tzuwln0=; h=From:To:Subject:Message-ID; Received: from [129.254.132.39] (HELO CHANKIMPC) ([129.254.132.39]) by smtp002-imp.gov-dooray.com with SMTP id f1f8e5226452269d; Wed, 03 May 2023 18:17:18 +0900 From: "Chan Kim" To: "U-Boot Mailing List" References: In-Reply-To: Subject: RE: [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:17:17 +0900 Message-ID: <0b9d01d97da0$0e75c9a0$2b615ce0$@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: AQJiwq0uvSxh6KHFth55LvI5CHuFta41ujQg 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 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 >-----Original Message----- >From: Chan Kim >Sent: Wednesday, May 3, 2023 6:08 PM >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) > >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