xref: /openbmc/u-boot/doc/README.qemu-arm (revision d5587fa308c937a598fd10918593458e48040f14)
1*d5587fa3STuomas Tynkkynen#
2*d5587fa3STuomas Tynkkynen# Copyright (C) 2017, Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
3*d5587fa3STuomas Tynkkynen#
4*d5587fa3STuomas Tynkkynen# SPDX-License-Identifier:	GPL-2.0+
5*d5587fa3STuomas Tynkkynen#
6*d5587fa3STuomas Tynkkynen
7*d5587fa3STuomas TynkkynenU-Boot on QEMU's 'virt' machine on ARM
8*d5587fa3STuomas Tynkkynen======================================
9*d5587fa3STuomas Tynkkynen
10*d5587fa3STuomas TynkkynenQEMU for ARM supports a special 'virt' machine designed for emulation and
11*d5587fa3STuomas Tynkkynenvirtualization purposes. This document describes how to run U-Boot under it.
12*d5587fa3STuomas Tynkkynen
13*d5587fa3STuomas TynkkynenThe 'virt' platform provides the following as the basic functionality:
14*d5587fa3STuomas Tynkkynen
15*d5587fa3STuomas Tynkkynen    - A freely configurable amount of CPU cores
16*d5587fa3STuomas Tynkkynen    - U-Boot loaded and executing in the emulated flash at address 0x0
17*d5587fa3STuomas Tynkkynen    - A generated device tree blob placed at the start of RAM
18*d5587fa3STuomas Tynkkynen    - A freely configurable amount of RAM, described by the DTB
19*d5587fa3STuomas Tynkkynen    - A PL011 serial port, discoverable via the DTB
20*d5587fa3STuomas Tynkkynen    - An ARMv7 architected timer
21*d5587fa3STuomas Tynkkynen    - PSCI for rebooting the system
22*d5587fa3STuomas Tynkkynen    - A generic ECAM-based PCI host controller, discoverable via the DTB
23*d5587fa3STuomas Tynkkynen
24*d5587fa3STuomas TynkkynenAdditionally, a number of optional peripherals can be added to the PCI bus.
25*d5587fa3STuomas Tynkkynen
26*d5587fa3STuomas TynkkynenBuilding U-Boot
27*d5587fa3STuomas Tynkkynen---------------
28*d5587fa3STuomas TynkkynenSet the CROSS_COMPILE and ARCH=arm environment variables as usual, and run:
29*d5587fa3STuomas Tynkkynen
30*d5587fa3STuomas Tynkkynen    make qemu_arm_defconfig
31*d5587fa3STuomas Tynkkynen    make
32*d5587fa3STuomas Tynkkynen
33*d5587fa3STuomas TynkkynenRunning U-Boot
34*d5587fa3STuomas Tynkkynen--------------
35*d5587fa3STuomas TynkkynenThe minimal QEMU command line to get U-Boot up and running is:
36*d5587fa3STuomas Tynkkynen
37*d5587fa3STuomas Tynkkynen    qemu-system-arm -machine virt,highmem=off -bios u-boot.bin
38*d5587fa3STuomas Tynkkynen
39*d5587fa3STuomas TynkkynenThe 'highmem=off' parameter to the 'virt' machine is required for PCI to work
40*d5587fa3STuomas Tynkkynenin U-Boot.
41*d5587fa3STuomas Tynkkynen
42*d5587fa3STuomas TynkkynenAdditional peripherals that have been tested to work in both U-Boot and Linux
43*d5587fa3STuomas Tynkkynencan be enabled with the following command line parameters:
44*d5587fa3STuomas Tynkkynen
45*d5587fa3STuomas Tynkkynen- To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.:
46*d5587fa3STuomas Tynkkynen    -drive if=none,file=disk.img,id=mydisk -device ich9-ahci,id=ahci -device ide-drive,drive=mydisk,bus=ahci.0
47*d5587fa3STuomas Tynkkynen- To add an Intel E1000 network adapter, pass e.g.:
48*d5587fa3STuomas Tynkkynen    -netdev user,id=net0 -device e1000,netdev=net0
49*d5587fa3STuomas Tynkkynen- To add an EHCI-compliant USB host controller, pass e.g.:
50*d5587fa3STuomas Tynkkynen    -device usb-ehci,id=ehci
51*d5587fa3STuomas Tynkkynen- To add a NVMe disk, pass e.g.:
52*d5587fa3STuomas Tynkkynen    -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo
53*d5587fa3STuomas Tynkkynen
54*d5587fa3STuomas TynkkynenThese have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well.
55