Bin Meng | f712f2a | 2019-07-18 00:34:16 -0700 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | .. Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 3 | |
Bin Meng | f712f2a | 2019-07-18 00:34:16 -0700 | [diff] [blame] | 4 | QEMU RISC-V |
| 5 | =========== |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 6 | |
| 7 | QEMU for RISC-V supports a special 'virt' machine designed for emulation and |
| 8 | virtualization purposes. This document describes how to run U-Boot under it. |
| 9 | Both 32-bit 64-bit targets are supported. |
| 10 | |
| 11 | The QEMU virt machine models a generic RISC-V virtual machine with support for |
| 12 | the VirtIO standard networking and block storage devices. It has CLINT, PLIC, |
| 13 | 16550A UART devices in addition to VirtIO and it also uses device-tree to pass |
| 14 | configuration information to guest software. It implements RISC-V privileged |
| 15 | architecture spec v1.10. |
| 16 | |
| 17 | Building U-Boot |
| 18 | --------------- |
| 19 | Set the CROSS_COMPILE environment variable as usual, and run: |
| 20 | |
Bin Meng | f712f2a | 2019-07-18 00:34:16 -0700 | [diff] [blame] | 21 | - For 32-bit RISC-V:: |
| 22 | |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 23 | make qemu-riscv32_defconfig |
| 24 | make |
| 25 | |
Bin Meng | f712f2a | 2019-07-18 00:34:16 -0700 | [diff] [blame] | 26 | - For 64-bit RISC-V:: |
| 27 | |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 28 | make qemu-riscv64_defconfig |
| 29 | make |
| 30 | |
| 31 | Running U-Boot |
| 32 | -------------- |
| 33 | The minimal QEMU command line to get U-Boot up and running is: |
| 34 | |
Bin Meng | f712f2a | 2019-07-18 00:34:16 -0700 | [diff] [blame] | 35 | - For 32-bit RISC-V:: |
| 36 | |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 37 | qemu-system-riscv32 -nographic -machine virt -kernel u-boot |
| 38 | |
Bin Meng | f712f2a | 2019-07-18 00:34:16 -0700 | [diff] [blame] | 39 | - For 64-bit RISC-V:: |
| 40 | |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 41 | qemu-system-riscv64 -nographic -machine virt -kernel u-boot |
| 42 | |
| 43 | The commands above create targets with 128MiB memory by default. |
| 44 | A freely configurable amount of RAM can be created via the '-m' |
| 45 | parameter. For example, '-m 2G' creates 2GiB memory for the target, |
| 46 | and the memory node in the embedded DTB created by QEMU reflects |
| 47 | the new setting. |
| 48 | |
| 49 | These have been tested in QEMU 3.0.0. |