QEMU-Sifive_u

How to emulate Sifive_u machine model in qemu?
Is there any particular steps to follow?
Please let us know.

Thank you

Hi Coder,
Here are the steps (overview) or running sifive_u machine model in QEMU:

  1. Install QEMU on your host system.
  2. Create a virtual machine disk image for the SiFive_u machine model. You can use the following command to create a 10 GB disk image:

dd if=/dev/zero of=sifive_u.img bs=1M count=10240

  1. Start QEMU with the following command:

qemu-system-riscv64 -machine sifive_u -nographic -m 8192 -smp 5 -kernel <kernel_image> -initrd <rootfs_image>

Replace <kernel_image> with the path to the Linux kernel image you want to run, and replace <rootfs_image> with the path to the root filesystem image for the SiFive_u machine model.

  1. If you are using a prebuilt U-Boot image, you can start QEMU with the following command instead:

qemu-system-riscv64 -machine sifive_u -nographic -m 8192 -smp 5 -kernel <u-boot_image> -drive file=<rootfs_image>,format=raw,if=none

Replace <u-boot_image> with the path to the prebuilt U-Boot image, and replace <rootfs_image> with the path to the root filesystem image for the SiFive_u machine model.

Please note that the Sifive_u machine model does not support PCI or VirtIO buses. Therefore, you will need to use a root filesystem image that does not rely on these devices.

Regards,
Shree

1 Like