Skip to content

Building QEMU

BrunoASMauricio edited this page Jul 12, 2023 · 13 revisions

(From https://github.com/foss-for-synopsys-dwc-arc-processors/qemu/wiki/Building-QEMU-for-ARC and https://github.com/foss-for-synopsys-dwc-arc-processors/qemu/wiki/QEMU-and-Zephyr)

Host environment

On different GNU/Linux distributions, some packages are needed. I list them here, but for a recent one consult the original prerequisite packages page.

Arch

sudo pacman -S git cmake ninja gperf ccache dfu-util dtc wget            \
               python-pip python-setuptools python-wheel xz file make

Fedora

sudo dnf group install "Development Tools" "C Development Tools and Libraries"
dnf install git cmake ninja-build gperf ccache dfu-util dtc wget         \
            python3-pip xz file glibc-devel.i686 libstdc++-devel.i686

Ubuntu

sudo apt-get install --no-install-recommends git cmake ninja-build gperf \
                     ccache dfu-util device-tree-compiler wget           \
                     python3-pip python3-setuptools python3-wheel        \
                     xz-utils file make gcc gcc-multilib

Void

sudo xbps-install git cmake ninja gperf ccache dfu-util dtc wget  \
                  python3-pip python3-setuptools python3-wheel xz \
                  file make

Setup

Clone the repo into your source folder with git clone https://github.com/foss-for-synopsys-dwc-arc-processors/qemu.git

In a separate build folder, configure QEMU. A common configuration follows:

./configure --target-list=arc-softmmu,arc64-softmmu,arc-linux-user,arc64-linux-user \ # QEMU ARC targets
            --prefix=/PATH/TO/INSTALL/QEMU           \ # where you want it installed
            --enable-debug                           \ # for developers
            --enable-debug-tcg                       \ # for developers
            --enable-trace-backends=simple           \ # for developers
            --disable-plugins                        \ # for developers
            --disable-werror                         \ # in case QEMU emits unexpected warnings
            --disable-pie                              # needed for older GCCs (like CentOS 7)

To enable TCG testing, the arc-elf32-gcc and arc64-elf-gcc compilers must be available during configuration, and the following two arguments added to the command above

--cross-cc-arc=arc-elf32-gcc --cross-cc-arc64=arc64-elf-gcc

Build and install

make
make install

Run TCG tests

make clean-tcg
make build-tcg
make check-tcg
Clone this wiki locally