Search code examples
xv6

make qemu on xv6-riscv gets stucked at qemu-system-riscv64 ... command


On Ubuntu 20.04, I installed the xv6 project using the page Tools Used in 6.828

$ sudo apt-get install git build-essential gdb-multiarch qemu-system-misc gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu

The file version that they checked on the web page are

$ riscv64-unknown-elf-gcc --version 
riscv64-unknown-elf-gcc () 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ qemu-system-riscv64 --version
QEMU emulator version 5.2.50 (v5.2.0-2349-g51db2d7cf2)
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers

On xv6-riscv

$ make qemu
# ... lots of output ...
qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 -nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0

The program get stuck there. The vm is not booted and no prompt is shown.

Any ideas on how to fix this are welcomed.


Solution

  • This has been mentioned in Tools Used in 6.S081

    At this moment in time, it seems that the package qemu-system-misc has received an update that breaks its compatibility with our kernel. If you run make qemu and the script appears to hang after

    qemu-system-riscv64 -machine virt -bios none -kernel kernel/kernel -m 128M -smp 3 
    nographic -drive file=fs.img,if=none,format=raw,id=x0 -device virtio-blk
    device,drive=x0,bus=virtio-mmio-bus.0
    

    you'll need to uninstall that package and install an older version:

    $ sudo apt-get remove qemu-system-misc
    $ sudo apt-get install qemu-system-misc=1:4.2-3ubuntu6