2019-01-24 00:56:44 +09:00
|
|
|
QEMU RISC-V Virt Machine Platform
|
|
|
|
=================================
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-04-14 20:47:17 +02:00
|
|
|
The **QEMU RISC-V Virt Machine** is a virtual platform created for RISC-V
|
|
|
|
software development and testing. It is also referred to as
|
2019-01-24 00:56:44 +09:00
|
|
|
*QEMU RISC-V VirtIO machine* because it uses VirtIO devices for network,
|
|
|
|
storage, and other types of IO.
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-04-14 20:47:17 +02:00
|
|
|
To build the platform-specific library and firmware images, provide the
|
2019-01-24 00:56:44 +09:00
|
|
|
*PLATFORM=qemu/virt* parameter to the top level `make` command.
|
2018-12-28 14:21:57 +05:30
|
|
|
|
|
|
|
Platform Options
|
|
|
|
----------------
|
|
|
|
|
2019-04-14 20:47:17 +02:00
|
|
|
The *QEMU RISC-V Virt Machine* platform does not have any platform-specific
|
2019-01-24 00:56:44 +09:00
|
|
|
options.
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-07-23 21:29:59 -07:00
|
|
|
Execution on QEMU RISC-V 64-bit
|
|
|
|
-------------------------------
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-01-24 00:56:44 +09:00
|
|
|
**No Payload Case**
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-01-24 00:56:44 +09:00
|
|
|
Build:
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-01-24 00:56:44 +09:00
|
|
|
make PLATFORM=qemu/virt
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-01-24 00:56:44 +09:00
|
|
|
|
|
|
|
Run:
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-04-14 20:47:17 +02:00
|
|
|
qemu-system-riscv64 -M virt -m 256M -nographic \
|
2019-01-24 00:56:44 +09:00
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_payload.elf
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
|
|
|
|
|
|
|
**U-Boot Payload**
|
|
|
|
|
2019-01-24 00:56:44 +09:00
|
|
|
Note: the command line examples here assume that U-Boot was compiled using
|
|
|
|
the `qemu-riscv64_smode_defconfig` configuration.
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-01-24 00:56:44 +09:00
|
|
|
Build:
|
|
|
|
```
|
|
|
|
make PLATFORM=qemu/virt FW_PAYLOAD_PATH=<uboot_build_directory>/u-boot.bin
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-01-24 00:56:44 +09:00
|
|
|
|
|
|
|
Run:
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-04-14 20:47:17 +02:00
|
|
|
qemu-system-riscv64 -M virt -m 256M -nographic \
|
2019-01-24 00:56:44 +09:00
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_payload.elf
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-01-24 00:56:44 +09:00
|
|
|
or
|
|
|
|
```
|
2019-04-14 20:47:17 +02:00
|
|
|
qemu-system-riscv64 -M virt -m 256M -nographic \
|
2019-01-24 00:56:44 +09:00
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_jump.elf \
|
2019-04-14 20:47:17 +02:00
|
|
|
-device loader,file=<uboot_build_directory>/u-boot.bin,addr=0x80200000
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
|
|
|
|
2019-01-24 00:56:44 +09:00
|
|
|
**Linux Kernel Payload**
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-04-14 20:47:17 +02:00
|
|
|
Note: We assume that the Linux kernel is compiled using
|
2019-01-24 00:56:44 +09:00
|
|
|
*arch/riscv/configs/defconfig*.
|
2018-12-28 14:21:57 +05:30
|
|
|
|
2019-01-24 00:56:44 +09:00
|
|
|
Build:
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-01-24 00:56:44 +09:00
|
|
|
make PLATFORM=qemu/virt FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Image
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-01-24 00:56:44 +09:00
|
|
|
|
|
|
|
Run:
|
2018-12-28 14:21:57 +05:30
|
|
|
```
|
2019-04-14 20:47:17 +02:00
|
|
|
qemu-system-riscv64 -M virt -m 256M -nographic \
|
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_payload.elf \
|
|
|
|
-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
|
|
|
|
-device virtio-blk-device,drive=hd0 \
|
|
|
|
-append "root=/dev/vda rw console=ttyS0"
|
|
|
|
```
|
|
|
|
or
|
|
|
|
```
|
|
|
|
qemu-system-riscv64 -M virt -m 256M -nographic \
|
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_jump.elf \
|
|
|
|
-device loader,file=<linux_build_directory>/arch/riscv/boot/Image,addr=0x80200000 \
|
|
|
|
-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
|
|
|
|
-device virtio-blk-device,drive=hd0 \
|
|
|
|
-append "root=/dev/vda rw console=ttyS0"
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2019-07-23 21:29:59 -07:00
|
|
|
Execution on QEMU RISC-V 32-bit
|
|
|
|
-------------------------------
|
2019-04-14 20:47:17 +02:00
|
|
|
|
|
|
|
**No Payload Case**
|
|
|
|
|
|
|
|
Build:
|
|
|
|
```
|
|
|
|
make PLATFORM=qemu/virt
|
|
|
|
```
|
|
|
|
|
|
|
|
Run:
|
|
|
|
```
|
|
|
|
qemu-system-riscv32 -M virt -m 256M -nographic \
|
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_payload.elf
|
|
|
|
```
|
|
|
|
|
|
|
|
**U-Boot Payload**
|
|
|
|
|
|
|
|
Note: the command line examples here assume that U-Boot was compiled using
|
|
|
|
the `qemu-riscv32_smode_defconfig` configuration.
|
|
|
|
|
|
|
|
Build:
|
|
|
|
```
|
|
|
|
make PLATFORM=qemu/virt FW_PAYLOAD_PATH=<uboot_build_directory>/u-boot.bin
|
|
|
|
```
|
|
|
|
|
|
|
|
Run:
|
|
|
|
```
|
|
|
|
qemu-system-riscv32 -M virt -m 256M -nographic \
|
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_payload.elf
|
|
|
|
```
|
|
|
|
or
|
|
|
|
```
|
|
|
|
qemu-system-riscv32 -M virt -m 256M -nographic \
|
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_jump.elf \
|
|
|
|
-device loader,file=<uboot_build_directory>/u-boot.bin,addr=0x80400000
|
|
|
|
```
|
|
|
|
|
|
|
|
**Linux Kernel Payload**
|
|
|
|
|
|
|
|
Note: We assume that the Linux kernel is compiled using
|
|
|
|
*arch/riscv/configs/rv32_defconfig* (kernel 5.1 and newer)
|
|
|
|
respectively using *arch/riscv/configs/defconfig* plus setting
|
|
|
|
CONFIG_ARCH_RV32I=y (kernel 5.0 and older).
|
|
|
|
|
|
|
|
Build:
|
|
|
|
```
|
|
|
|
make PLATFORM=qemu/virt FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Image
|
|
|
|
```
|
|
|
|
|
|
|
|
Run:
|
|
|
|
```
|
|
|
|
qemu-system-riscv32 -M virt -m 256M -nographic \
|
2019-01-24 00:56:44 +09:00
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_payload.elf \
|
|
|
|
-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
|
|
|
|
-device virtio-blk-device,drive=hd0 \
|
|
|
|
-append "root=/dev/vda rw console=ttyS0"
|
|
|
|
```
|
|
|
|
or
|
|
|
|
```
|
2019-04-14 20:47:17 +02:00
|
|
|
qemu-system-riscv32 -M virt -m 256M -nographic \
|
2019-01-24 00:56:44 +09:00
|
|
|
-kernel build/platform/qemu/virt/firmware/fw_jump.elf \
|
2019-01-29 09:59:31 -08:00
|
|
|
-device loader,file=<linux_build_directory>/arch/riscv/boot/Image,addr=0x80400000 \
|
2019-01-24 00:56:44 +09:00
|
|
|
-drive file=<path_to_linux_rootfs>,format=raw,id=hd0 \
|
|
|
|
-device virtio-blk-device,drive=hd0 \
|
|
|
|
-append "root=/dev/vda rw console=ttyS0"
|
|
|
|
```
|