Skip to content

Running

LekKit edited this page Oct 7, 2024 · 36 revisions

Running RVVM

Demo

CLI Example: Launches a dual-core VM with 2 GiB of RAM, 1280x720 display.

Runs OpenSBI + U-Boot firmware, Arch RISC-V guest. Forwards host 127.0.0.1:2022 into guest SSH port.

rvvm fw_payload.bin -i archriscv.img -m 2G -smp 2 -res 1280x720 -portfwd tcp/127.0.0.1:2022=22

Be aware that default 256M of guest RAM may not be enough for complex guests, like Ubuntu.

Extended help:

Usage: rvvm <firmware> [-m 256M] [-k kernel] [-i drive.img] ...

    <firmware>       Initial M-mode firmware (OpenSBI [+ U-Boot], etc)
    -k, -kernel ...  Optional S-mode kernel payload (Linux, U-Boot, etc)
    -i, -image  ...  Attach preferred storage image (Currently as NVMe)
    -m, -mem 1G      Memory amount, default: 256M
    -s, -smp 4       Cores count, default: 1
    -rv32            Enable 32-bit RISC-V, 64-bit by default
    -cmdline    ...  Override payload kernel command line
    -append     ...  Modify payload kernel command line
    -res 1280x720    Set display(s) resolution
    -poweroff_key    Send HID_KEY_POWER instead of exiting on GUI close
    -portfwd 8080=80 Port forwarding (Extended: tcp/127.0.0.1:8080=80)
    -nvme       ...  Explicitly attach storage image as NVMe device
    -ata        ...  Explicitly attach storage image as ATA (IDE) device
    -nogui           Disable display GUI
    -nonet           Disable networking
    -serial     ...  Add more serial ports (Via pty/pipe path), or null
    -dtb        ...  Pass custom Device Tree Blob to the machine
    -dumpdtb    ...  Dump auto-generated DTB to file
    -v, -verbose     Enable verbose logging
    -h, -help        Show this help message

Testing or debugging features:

    -noisolation                   Disable seccomp/pledge isolation
    -nojit                         Disable RVJIT (For rvvm debug, slow!)
    -rvjit_harvard                 Strict instruction cache flush checks (For guest debug, slow!)
    -rvjit_disable_rwx             Force W^X JIT heap allocation
    -rvjit_force_bmi2 [true/false] Force enable/disable BMI2 x86 extensions
    -jitcache 16M                  Per-core JIT cache size (Scales with guest RAM by default)
    -sv48                          Enable SV48 MMU pagetable scheme
    -sv57                          Enable SV57 MMU pagetable scheme

Recommended guest firmware & images

Running generic distro images via U-Boot

For most generic distro images, EFI firmware is needed. U-Boot works as EFI implementation, and additionally supports extlinux scripts.

U-Boot runs in S-mode, thus it has to be used with an M-mode SBI implementation (OpenSBI, aka fw_jump.bin). The result is often combined into a single firmware file fw_payload.bin.

Latest recommended EFI firmware: fw_payload.bin

rvvm fw_payload.bin -i distro_image.img -m 2G

Running kernel payloads manually

Some users may wish to directly run a static Linux kernel payload via -k argument. It does still require OpenSBI, which may be either taken from their upstream release or downloaded here: fw_jump.bin

rvvm fw_jump.bin -k linux_6.10 -i rootfs.img

Recommended OS images

Arch RISC-V image: archriscv.zip

Debian image (Lacks video drivers): debian.zip

FreeBSD 13.1: FreeBSD-13.3-STABLE-riscv-riscv64.raw.xz

Clone this wiki locally