board/qemu/riscv{32, 64}-virt: do not use the default bus implicitly

Qemu 9.1 recently fixed the RISC-V virt target by adding the missing
default type for block devices [1].

But the qemu command line we use for RISC-V virt is slightly incorrect:

  -drive file=rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0

With Qemu 9.1, this command line now rejected since it conflict with
the new default bus:

  qemu-system-riscv64: -drive file=rootfs.ext2,format=raw,id=hd0: Drive 'hd0' is already in use because it has been automatically connected to another device (did you need 'if=none' in the drive options?)

Since we are currently still using Qemu 9.0, apply the suggested change by
adding 'if=none'.

Note: '-drive file=rootfs.ext2,format=raw,id=hd0' can be removed
in a followup patch after the qemu version bump 9.1 is merged.

[1] 4406ba2b5e

[Romain: rework the commit log]
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Waldemar Brodkorb 2024-10-26 13:00:55 +02:00 committed by Thomas Petazzoni
parent 3c2f3c9039
commit e47726a50a
3 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
Run Linux in emulation with: Run Linux in emulation with:
qemu-system-riscv32 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv32_virt_defconfig qemu-system-riscv32 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0,if=none -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv32_virt_defconfig
qemu-system-riscv32 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -nographic -cpu rv32,mmu=off -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 # qemu_riscv32_nommu_virt_defconfig qemu-system-riscv32 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0,if=none -device virtio-blk-device,drive=hd0 -nographic -cpu rv32,mmu=off -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 # qemu_riscv32_nommu_virt_defconfig
The login prompt will appear in the terminal that started Qemu. The login prompt will appear in the terminal that started Qemu.

View File

@ -22,7 +22,7 @@ Run the emulation with:
-blockdev node-name=pflash0,driver=file,read-only=on,filename=output/images/RISCV_VIRT_CODE.fd \ -blockdev node-name=pflash0,driver=file,read-only=on,filename=output/images/RISCV_VIRT_CODE.fd \
-blockdev node-name=pflash1,driver=file,filename=output/images/RISCV_VIRT_VARS.fd \ -blockdev node-name=pflash1,driver=file,filename=output/images/RISCV_VIRT_VARS.fd \
\ \
-drive file=output/images/disk.img,format=raw,id=hd0 \ -drive file=output/images/disk.img,format=raw,id=hd0,if=none \
-device virtio-blk-device,drive=hd0 \ -device virtio-blk-device,drive=hd0 \
\ \
-netdev user,id=net0 \ -netdev user,id=net0 \

View File

@ -1,7 +1,7 @@
Run Linux in emulation with: Run Linux in emulation with:
qemu-system-riscv64 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv64_virt_defconfig qemu-system-riscv64 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0,if=none -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv64_virt_defconfig
qemu-system-riscv64 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -nographic -cpu rv64,mmu=off -netdev user,id=net0 -device virtio-net-device,netdev=net0 # qemu_riscv64_nommu_virt_defconfig qemu-system-riscv64 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0,if=none -device virtio-blk-device,drive=hd0 -nographic -cpu rv64,mmu=off -netdev user,id=net0 -device virtio-net-device,netdev=net0 # qemu_riscv64_nommu_virt_defconfig
The login prompt will appear in the terminal that started Qemu. The login prompt will appear in the terminal that started Qemu.