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 3286CC77B7A for ; Tue, 16 May 2023 08:25:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2101B8662F; Tue, 16 May 2023 10:25:30 +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="j3mK4UEV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6A0FA8663C; Tue, 16 May 2023 10:25:28 +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 D4D348608F for ; Tue, 16 May 2023 10:25:18 +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; 16 May 2023 17:25:14 +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.106] (HELO smtp001-imp.gov-dooray.com) ([10.162.225.106]) by send001-relay.gov-dooray.com with SMTP id 8c18029164633dea; Tue, 16 May 2023 17:25:14 +0900 DKIM-Signature: a=rsa-sha256; b=j3mK4UEV6Ih4SqSRQs8Qypuh5aJ0pIEnlAd1X1Glvl3n1dwGsogqLPK6iMeEKH8GgmW/rh0hZN FZBLU5cKRUb7+EGjogn9ZV/NG2242qR+QUCRZnygq4MhKg3i7WezW6iiJ5Oubu6cNvAqcYWIUbN0 LX0Ox5OSyC9eE3HH+ufbyb78gU2+tmeDKU13IdyqDV7SiaGzmDAMcsqHgJOjCUe591z8EWseZ9Oc k8nwP4gulj7HgyUCK5zBdKVWyH/A7BjVdNQkPx5BZaLfcZZGdfr3aE/hDToK3p3vk+QK3mFppzTU dXgHEWHs6BPeukDUOOV/JNdi23aaijNJ5u5/H8ow==; c=relaxed/relaxed; s=selector; d=dooray.com; v=1; bh=aFXm/gNXeVUwwVhqkN9US1JK++ly37DK5mg8IKeQvt4=; 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 5119661264633dea; Tue, 16 May 2023 17:25:14 +0900 From: "Chan Kim" To: "'U-Boot Mailing List'" , References: <004301d98191$21ace400$6506ac00$@etri.re.kr> In-Reply-To: Subject: RE: How should I build u-boot for qemu_arm64_defconfig and run it on arm64 qemu virt machine? Date: Tue, 16 May 2023 17:25:13 +0900 Message-ID: <001901d987cf$f01135a0$d033a0e0$@etri.re.kr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHmxDpOnWFAecyA1yQvq4MPJoK6YgHOf3M6rzOfN8A= Content-Language: ko 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 all, I found by compiling u-boot-spl to start at 0x40200000 and using -kernel = option, I can make u-boot-spl start loaded and started from 0x40200000. = And then by loading the .itb file (FIT file) which contains u-boot = proper binary at 0x40400000 using -device loader option, and setting = CONFIG_SPL_LOAD_FIT_ADDERSS to 0x40400000 and I could make u-boot-spl = execute u-boot at the end. To make .itb file, I used 'firmware =3D = "uboot"' int the configuration, and 'type =3D "standalone"', 'os =3D = "U-Boot"' and the 'uboot' image node. And I turned off SPL_BOOT_OS of = course. I referenced the sample its files in u-boot. (I can't copy-paste the file now so I just tell you the key lines) Hope this helps someone layter.=20 Thank you. Chan Kim >-----Original Message----- >From: U-Boot On Behalf Of = =EA=B9=80=EC=B0=AC >Sent: Tuesday, May 9, 2023 3:13 PM >To: U-Boot Mailing List ; qemu-discuss@nongnu.org >Subject: RE: How should I build u-boot for qemu_arm64_defconfig and run = it >on arm64 qemu virt machine? > > >Hi all, > >Hope someone who know this top reads this. >I made the pflashs.img with u-boot-spl and used it as the flash memory = (from >address 0x00000000 ~). So the u-boot-spl program runs. >And I guess I have to load (using qemu command option) a kind of image = that >contains u-boot proper and make the u-boot-spl to load u-boot proper at >another address from that image and jump to that address. >How can I make that image using mkimage if I have the u-boot.bin file? >I think the command should start like 'mkimage -O u-boot -T ... ' but I >don't know what type I should give for -T option. >I will be very much grateful If anyone tells me how to do it. >By the way, I want to check pci_init function once u-boot proper runs = and I >found pci_init is called in board_init_r when u-boot proper runs. > >Thank you! >Chan Kim > >-----Original Message----- >From: "Chan Kim" >To: "U-Boot Mailing List" ; discuss@nongnu.org>; >Cc: >Sent: 2023-05-08 (=EC=9B=94) 18:40:49 (UTC+09:00) >Subject: How should I build u-boot for qemu_arm64_defconfig and run it = on >arm64 qemu virt machine? > >Hello experts, > > > >Today I tried this test from scratch. > >In my environment, CROSS_COMPILE=3Daarch64-none-elf. > >Under u-boot directory, when I do 'make = CROSS_COMPILE=3Daarch64-none-elf- >qemu_arm64_defconfig' and 'make -j28', I see this error at the end. > > > >aarch64-none-elf-ld.bfd: invalid length for memory region .sram > > > >after examining it, I added in include/configs/qemu-arm.h, > > > >#define CONFIG_SPL_MAX_SIZE value to 0x400000 > > > >After fixing it, I got another similar error for .sdram and I added in >include/configs/qemu-arm.h, > > > >#define CONFIG_SPL_BSS_START_ADDR 0x40800000 > >#define CONFIG_SPL_BSS_MAX_SIZE 0x100000 > > > >Now I can do 'make -j28' with no error. > >But I found I have both 'u-boot' and 'spl/u-boot-spl' generated and I >realized for this qemu_arm64_defconfig, CONFIG_SPL=3Dy and I get both = u-boot >proper and u-boot spl. (SPL: secondary program loader, proper: main >bootloader. SPL runs first and the proper runs next). > > > >Until now I did objcopy of the u-boot(proper) and then extended it to >0x400000 byte. (the pflash size of the virt machine which starts at = address >0x00000000). > >$ aarch64-none-elf-objcopy -O binary u-boot.v2022.07/u-boot pflashp.img > >$ dd if=3D/dev/zero of=3Dpflashp.img bs=3D1c count=3D1 seek=3D67108863 > > > >And the qemu command is : > >$ qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine = virt,gic- >version=3Dmax,secure=3Don,virtualization=3Dtrue -cpu max -drive >if=3Dpflash,file=3Dpflashp.img -m 2G -nographic -device >loader,file=3Dlinux-5.15.68/arch/arm64/boot/Image,addr=3D0x80200000 > > > >The qemu virt machine has RAM from 0x40000000 until 0xbfffffff. > >And I could see u-boot runs and it waits input for 3 seconds and = outputs the >u-boot prompt. > >This is running u-boot (proper) from address 0 but since I have = u-boot-spl >too, I should run it from u-boot-spl first, shouldn't I? > > > >How am I supposed to run u-boot-spl and u-boot on this qemu machine? = (from >lds files, it looks like they both start at address 0). > >(qemu machine is arm64 virt machine, qemu 6.2.0). > > > > > >Thank you. > > > >Chan Kim > > >