Building QEMU - foss-for-synopsys-dwc-arc-processors/documentation GitHub Wiki
Useful Resources
- https://github.com/foss-for-synopsys-dwc-arc-processors/qemu/wiki/Building-QEMU-for-ARC
- https://github.com/foss-for-synopsys-dwc-arc-processors/qemu/wiki/QEMU-and-Zephyr
- https://github.com/foss-for-synopsys-dwc-arc-processors/qemu/wiki/QEMU-traces
- https://github.com/foss-for-synopsys-dwc-arc-processors/qemu/wiki/Tips-and-Tricks-for-Troubleshooting
Prerequisites
âšī¸ Refer to the official documentation for details.
Install necessary packages for Arch:
sudo pacman -S git cmake ninja gperf ccache dfu-util dtc wget \
python-pip python-setuptools python-wheel xz file make
Install necessary packages for 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
Install necessary packages for 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
Install necessary packages for Void:
sudo xbps-install git cmake ninja gperf ccache dfu-util dtc wget \
python3-pip python3-setuptools python3-wheel xz \
file make
Building QEMU
Then prepare sources and a build directory:
git clone https://github.com/foss-for-synopsys-dwc-arc-processors/qemu
mkdir -p qemu/build
cd qemu/build
Configure QEMU inside of the build directory (use your own --prefix value for installation path):
../configure --target-list=arc-softmmu,arc64-softmmu,arc-linux-user,arc64-linux-user \
--prefix=/tools/qemu --enable-debug --enable-debug-tcg --enable-trace-backends=simple \
--disable-plugins --skip-meson --disable-werror --disable-pie
What options are responsible for what:
--target-list=arc-softmmu,arc64-softmmu,arc-linux-user,arc64-linux-userâ build QEMU both for these targets:qemu-system-arcâ system emulation for ARC HS3x/4x/5x processors family;qemu-system-arc64â system emulation for ARC HS6x processors family;qemu-arcâ user space Linux emulation for ARC HS3x/4x/5x processors family;qemu-arc64â user space Linux emulation for ARC HS6x processors family.
--prefix=/tools/qemuâ an installation path.--enable-debug --enable-debug-tcg --enable-trace-backends=simple --disable-pluginsâ options for development needs.--enable-trace-backends=simpleâ for tracing (described in Profiling with QEMU).--skip-mesonâ do not run Meson on every build.--disable-werrorâ in case QEMU emits unexpected warnings.--disable-pieâ needed for older GCC (like in CentOS 7).
Build and install:
make
make install
Configure your environment:
export QEMU_HOME="/tools/qemu"
export PATH="${QEMU_HOME}/bin:$PATH"
Running TCG Tests
TCG is the internal language that powers QEMU. There are some assembly tests that validate the basic function of several instructions in QEMU.
Firstly, make sure that QEMU if configured with --cross-cc-arc=arc-elf32-gcc and --cross-cc-arc64=arc64-elf-gcc options.
Then after building QEMU use these commands to run TCG tests:
make clean-tcg
make build-tcg
make check-tcg