From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mx.groups.io with SMTP id smtpd.web11.7941.1686920814522000293 for ; Fri, 16 Jun 2023 06:06:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@canonical.com header.s=20210705 header.b=OQ/vcrf/; spf=pass (domain: canonical.com, ip: 185.125.188.122, mailfrom: heinrich.schuchardt@canonical.com) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 430073F18B for ; Fri, 16 Jun 2023 13:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1686920812; bh=LTfOW1qJdGqXoSRTIIVxnFYOMv3U2KA/i/8CA8M1xL8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OQ/vcrf/P80PKkv/NXu4+7Z+BqQTXY9iyCtI5yVD+RP/xGL3lmQ9v+OwMojvKTfW4 RDYuxBMSuOs2HN8hBGAF5ZcBJ7R0EsBuNIMucu6+2b9uXJ96YENhCu2NXed2P6WyoV QOSnzhUBvHEmoQ39yHuG2qwILJAhwLZqsbwFaWp5cKUzfqlhgALgVxHTsHTFwYn06r 9xNN/6jWWGBR6naDeLtXn9e+iLyhqwRF7fS4wJKtMVk/7Ah7M8CjtGtsLZyAilISuv 2EOiRKp94Aq+4PZ33qF8d7YR2XsgaKp2pakutmnCdrS8Pm4Lr7KBXDBwdDx1SXSs0e g1NFLDkVKPVFw== Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-30fc7ab9ff3so273467f8f.0 for ; Fri, 16 Jun 2023 06:06:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686920811; x=1689512811; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LTfOW1qJdGqXoSRTIIVxnFYOMv3U2KA/i/8CA8M1xL8=; b=K2we1FFUyehireGNjUn3wZEK0wXgU87/ZyMr57z+/1y3q5W/yUJb+DUCj3dvc0l6be QHZc2wY8caRuqdTt5Nm+IaFgROgciAmAV7OfwRrom6n0waw6qlt8vMjZgrHlTcx3BbO5 Sjl1i6LiKLYr8c7C6OWHSUrpaUlIfrvRzerUSiGnyWvQTJ0ccHWeLKJ2c9QC4nQEfTIP jWtKWFoOClhCJ8FQ1jtzeryQsbMw47ZvtbIhAan/e0PPbkjNnRIBMYz34371oGUXCaDR 5cPR+E8a51RzFWPUU0qM3FjBXe8obM/GtiyVcO6MtByUULPvzBtrVIc1oZdTT5aSRjmX wEYg== X-Gm-Message-State: AC+VfDwDGzzbz8cyoDRRIqXpcjYUCCLXhNGYke7bmAqbK9wcbhY54Gax 3yQAXoBqqxmV26EX1ln3eAOWj/PdYydNirEtbA8RLZGEtLjS/9eVkaCBxruYiEgDh0ewlVcBUcH IRlNtzxsp2Do3QfL+1loXPSljutouWxI= X-Received: by 2002:a5d:4acf:0:b0:30a:e93e:82aa with SMTP id y15-20020a5d4acf000000b0030ae93e82aamr1534750wrs.42.1686920811213; Fri, 16 Jun 2023 06:06:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6iFgTR1UpNapr1lovrFpg/eKBTboYsks3ltENKtjeRwOqRdTmvArC9PU3Rpp7SHCS6jlcsmQ== X-Received: by 2002:a5d:4acf:0:b0:30a:e93e:82aa with SMTP id y15-20020a5d4acf000000b0030ae93e82aamr1534732wrs.42.1686920810759; Fri, 16 Jun 2023 06:06:50 -0700 (PDT) Received: from [192.168.123.67] (ip-084-119-033-219.um24.pools.vodafone-ip.de. [84.119.33.219]) by smtp.gmail.com with ESMTPSA id v16-20020adfe4d0000000b00307a83ea722sm23701591wrm.58.2023.06.16.06.06.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Jun 2023 06:06:50 -0700 (PDT) Message-ID: <82875e92-7476-5665-4546-a0ac1f31b464@canonical.com> Date: Fri, 16 Jun 2023 15:06:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v2 4/4] OvmfPkg/RiscVVirt: Add a readme for build and test To: Sunil V L Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Andrei Warkentin , Dann Frazier , devel@edk2.groups.io References: <20230616101651.1319722-5-sunilvl@ventanamicro.com> From: Heinrich Schuchardt In-Reply-To: <20230616101651.1319722-5-sunilvl@ventanamicro.com> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/16/23 12:16, Sunil V L wrote: > Add a readme file which provides information regarding how > to build and test EDK2 on RISC-V qemu virt platform. > > Signed-off-by: Sunil V L > Cc: Ard Biesheuvel > Cc: Jiewen Yao > Cc: Jordan Justen > Cc: Gerd Hoffmann > Cc: Andrei Warkentin Unfortunately you only sent me the cover letter. Copying from the mailing list may have led to some formatting being lost. > --- > OvmfPkg/RiscVVirt/README.md | 46 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > create mode 100644 OvmfPkg/RiscVVirt/README.md > > diff --git a/OvmfPkg/RiscVVirt/README.md b/OvmfPkg/RiscVVirt/README.md > new file mode 100644 > index 000000000000..b07d5b6d3bf9 > --- /dev/null > +++ b/OvmfPkg/RiscVVirt/README.md > @@ -0,0 +1,46 @@ > +# Support for RISC-V qemu virt platform > + > +## Overview > +RISC-V qemu 'virt' is a generic platform which does not correspond to any real %s/qemu/QEMU/ > +hardware. > + > +EDK2 for RISC-V virt platform is a payload (S-mode) for a previous stage M-mode %s/for/for the/ > +firmware like opensbi. It follows PEI less design. %s/opensbi/OpenSBI/ > + > +The minimum qemu version required is %s/qemu/QEMU/ > +**[8.1](https://wiki.qemu.org/Planning/8.1)** or with commit > +[7efd65423a](https://github.com/qemu/qemu/commit/7efd65423ab22e6f5890ca08ae40c84d6660242f) > +which supports separate pflash devices for EDK2 code and variable storage. > + > +## Build > + export WORKSPACE=`pwd` > + export GCC5_RISCV64_PREFIX=riscv64-linux-gnu- > + export PACKAGES_PATH=$WORKSPACE/edk2 > + export EDK_TOOLS_PATH=$WORKSPACE/edk2/BaseTools > + source edk2/edksetup.sh > + make -C edk2/BaseTools > + source edk2/edksetup.sh BaseTools > + build -a RISCV64 --buildtarget RELEASE -p OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc -t GCC5 > + > +## Test > +1) RISC-V qemu pflash devices should be of of size 32MiB. > + > + `truncate -s 32M Build/RiscVVirtQemu/RELEASE_GCC5/FV/RISCV_VIRT_CODE.fd` > + > + `truncate -s 32M Build/RiscVVirtQemu/RELEASE_GCC5/FV/RISCV_VIRT_VARS.fd` > + > +2) Run qemu %s/qemu/QEMU/ > + > + qemu-system-riscv64 \ > + -accel tcg -m 4096 -smp 2 \ > + -serial mon:stdio \ > + -device virtio-gpu-pci -full-screen \ > + -device qemu-xhci \ > + -device usb-kbd \ > + -blockdev node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \ > + -blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \ > + -M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \ > + -kernel linux/arch/riscv/boot/Image \ > + -initrd buildroot/output/images/rootfs.cpio \ If you use -kernel and -initrd, why would you use EDK II? It is much easier to use the kernel and initrd that is on the drive that you will need anyway. We should provide an example that works on all operating systems no just Linux. Hence, I would prefer an example connecting a disk image: -drive file=riscv64.img,format=raw,if=virtio \ > + -netdev user,id=net0 -device virtio-net-pci,netdev=net0 \ > + -append "root=/dev/ram rw console=ttyS0 earlycon=uart8250,mmio,0x10000000" You should remove this parameter too as it is Linux specific. For testing you could use: https://cdimage.ubuntu.com/releases/22.04.2/release/ubuntu-22.04.2-live-server-riscv64.img.gz The unzipped image provides GRUB as EFI/boot/bootriscv64.efi on the ESP. These are the commands I used: dd if=/dev/zero of=riscv64.img bs=1M count=16384 qemu-system-riscv64 \ -M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \ -m 4096 -smp 2 \ -serial mon:stdio \ -device virtio-gpu-pci -full-screen \ -device qemu-xhci \ -device usb-kbd \ -device virtio-rng-pci \ -blockdev node-name=pflash0,driver=file,read-only=on,filename=RISCV_VIRT_CODE.fd \ -blockdev node-name=pflash1,driver=file,filename=RISCV_VIRT_VARS.fd \ -netdev user,id=net0 \ -device virtio-net-pci,netdev=net0 \ -drive file=riscv64.img,format=raw,if=virtio \ -drive file=ubuntu-22.04.2-live-server-riscv64.img,if=virtio,media=cdrom As EDK II by default has the EFI shell as first boot option just choose the second disk from the boot menu or use the EFI shell to invoke GRUB. To initialize KASLR and provide enough entropy to /dev/random the RNG device is useful. Best regards Heinrich > -- > 2.34.1