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