Re: qemu-system-riscv64 freezes
On Sun, Aug 30, 2020 at 07:55:05PM +0200, Elie-Laurent Benaroya wrote:
> I am trying to build a Linux virtual machine for RISC V on Debian 10.
> I use a tutorial from "GNU LINUX Magazine France" (in French, no 230).
> Actually I have got a problem at the last step when "qemu-system-riscv64"
> is launched.
> I set up the cross-compilation toolchain, used debootstrap for the root
> change and cross-compiled the Linux kernel from the git repository (version
> The pk was compiled with the --with-payload=../../linux/vmlinux option and
> a 10G disk image was created. Finally I launch the command:
> qemu-system-riscv64 -nographic -machine virt -m 1.9G -kernel
> 2/riscv-pk/build/bbl -object rng-random,filename=/dev/urandom,id=rng0
> -device virtio-rng-device,rng=rng0 -append "console=ttyS0 rw root=/dev/vda"
> -device virtio-blk-device,drive=hd0 -drive file=rootfs.
> img,format=raw,id=hd0 -device virtio-net-device,netdev=usernet -netdev
> But the program freezes after the following lines:
I unfortunately don't know the exact reason for this particular
freeze, but the following points might be worth a thought:
- At the time when Debian 10 ("Buster") was released, the RISC-V
support in upstream qemu was still rather new and later qemu
versions have introduced changes that have fixed a number of
issues that have led to crashes or freezes in qemu 3.1 (the
version that was current when Buster was frozen and that is
therefore included in Buster). I would therefore recommend
using qemu 5.0 or newer, even if you have to build it manually.
I have run a number of tests and I cannot get a current kernel
(5.7) and a current OpenSBI (0.8) to work properly in qemu
3.1 while they work fine in a (manually-built) qemu 5.0.
- Is there a particular reason why you use BBL instead of
OpenSBI? OpenSBI is nowadays the de-facto standard SBI
implementation and probably gets a lot more testing than
- If your aim is setting up a Debian/riscv64 VM, I would like to
recommend following the steps described at
This works out-of-the-box in Debian/unstable; for doing it in
Buster you need to install the opensbi and u-boot-qemu packages
from unstable first (they are arch-all and can be installed on
a Buster system without problems) and you need to install at
least qemu 5.0. Once you have done that, you can just
copy-and-paste the instructions from the aforementioned wiki
page and get a working system (I've just successfully tried
that on a freshly setup Buster system).
If you have further questions, feel free to ask.
Ich widerspreche hiermit ausdrücklich der Nutzung sowie der
Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung
sowie der Markt- oder Meinungsforschung.