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