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