xref: /qemu/docs/system/target-openrisc.rst (revision b2a3cbb8)
1.. _OpenRISC-System-emulator:
2
3OpenRISC System emulator
4~~~~~~~~~~~~~~~~~~~~~~~~
5
6QEMU can emulate 32-bit OpenRISC CPUs using the ``qemu-system-or1k`` executable.
7
8OpenRISC CPUs are generally built into "system-on-chip" (SoC) designs that run
9on FPGAs.  These SoCs are based on the same core architecture as the or1ksim
10(the original OpenRISC instruction level simulator) which QEMU supports. For
11this reason QEMU does not need to support many different boards to support the
12OpenRISC hardware ecosystem.
13
14The OpenRISC CPU supported by QEMU is the ``or1200``, it supports an MMU and can
15run linux.
16
17Choosing a board model
18======================
19
20For QEMU's OpenRISC system emulation, you must specify which board model you
21want to use with the ``-M`` or ``--machine`` option; the default machine is
22``or1k-sim``.
23
24If you intend to boot Linux, it is possible to have a single kernel image that
25will boot on any of the QEMU machines. To do this one would compile all required
26drivers into the kernel. This is possible because QEMU will create a device tree
27structure that describes the QEMU machine and pass a pointer to the structure to
28the kernel.  The kernel can then use this to configure itself for the machine.
29
30However, typically users will have specific firmware images for a specific machine.
31
32If you already have a system image or a kernel that works on hardware and you
33want to boot with QEMU, check whether QEMU lists that machine in its ``-machine
34help`` output. If it is listed, then you can probably use that board model. If
35it is not listed, then unfortunately your image will almost certainly not boot
36on QEMU. (You might be able to extract the filesystem and use that with a
37different kernel which boots on a system that QEMU does emulate.)
38
39If you don't care about reproducing the idiosyncrasies of a particular
40bit of hardware, such as small amount of RAM, no PCI or other hard disk, etc.,
41and just want to run Linux, the best option is to use the ``virt`` board. This
42is a platform which doesn't correspond to any real hardware and is designed for
43use in virtual machines. You'll need to compile Linux with a suitable
44configuration for running on the ``virt`` board. ``virt`` supports PCI, virtio
45and large amounts of RAM.
46
47Board-specific documentation
48============================
49
50..
51   This table of contents should be kept sorted alphabetically
52   by the title text of each file, which isn't the same ordering
53   as an alphabetical sort by filename.
54
55.. toctree::
56   :maxdepth: 1
57
58   openrisc/or1k-sim
59   openrisc/virt
60
61Emulated CPU architecture support
62=================================
63
64.. toctree::
65   openrisc/emulation
66
67OpenRISC CPU features
68=====================
69
70.. toctree::
71   openrisc/cpu-features
72