riscv64

Artifacts:

└── riscv64
    ├── lmp-factory-image-qemuriscv64.wic.gz
    └── fw_payload.elf

Booting in QEMU

Important

These instructions require QEMU 5.2 or later.

Note

Make sure to set the FIOCTL_FACTORY environment variable:
export FIOCTL_FACTORY=<factory>
  1. List available Targets and decide on which to boot:

    fioctl targets list
    
  2. Make a directory for the artifacts and cd into it:

    mkdir -p lmp-qemu/riscv64
    cd lmp-qemu/riscv64
    
  3. Download the artifacts needed for riscv64, replacing <target_number> with the target you would like to boot:

    # Download and extract the Factory image
    fioctl targets artifacts <target_number> qemuriscv64/lmp-factory-image-qemuriscv64.wic.gz | gunzip > lmp-factory-image-qemuriscv64.wic
    # Download OpenSBI Firmware
    fioctl targets artifacts <target_number> qemuriscv64/fw_payload.elf > fw_payload.elf
    
  4. The directory tree should now look like this:

    lmp-qemu/
    └── riscv64
        ├── lmp-factory-image-qemuriscv64.wic
        └── fw_payload.elf
    
  5. Run the QEMU script below against the artifacts inside of lmp-qemu/. You can save this as run.sh inside the directory for convenience.

Note

The QEMU CLI passes the necessary flags and parameters to the appropriate qemu-system command. This includes path to the image, CPU, network, and other device information. For specifics, consult QEMU’s Documentation.

Booting Graphically

In order to boot QEMU with an OpenGL capable virtual GPU (required for Wayland/Weston), add the following flags to the QEMU CLI:

-display gtk,gl=on -device virtio-gpu-pci

Do not copy the -nographic flag at the end of the QEMU CLI below.

Attention

qemu-system-riscv64 does not currently support connecting to a PCIe host for graphics support

QEMU CLI

qemu-system-riscv64 -machine virt -m 1024 \
    -device virtio-serial-device -chardev null,id=virtcon -device virtconsole,chardev=virtcon \
    -device virtio-net-device,netdev=usernet \
    -netdev user,id=usernet,hostfwd=tcp::22222-:22 \
    -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \
    -bios fw_payload.elf \
    -monitor null \
    -drive file=lmp-factory-image-qemuriscv64.wic,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
    -nographic

Hint

To access QEMU via SSH, append these parameters to the QEMU CLI command above:

-netdev user,id=net0,hostfwd=tcp::2222-:22

Then, run SSH with:

ssh -p 2222 fio@localhost

Demo

Tip

You can register your device following the steps from Register your device.