Install QEMU and its plugins
Install qemu
Clone repo
git clone git@gitlab.com:qemu-project/qemu.git
cd qemu-plugin
Install dependecies (this examples are for Ubuntu)
#strict dependencies
sudo apt install -y git build-essential python3 python3-venv ninja-build libglib2.0-dev
#to build documentation
sudo apt install -y python3-pip python3-sphinx python3-sphinx-rtd-theme
#to build with extra features capstone it's the most necessary for our purposes
#to build with extra libraries
sudo apt install libcapstone-dev
sudo apt install git-email
sudo apt install libaio-dev libbluetooth-dev libbrlapi-dev libbz2-dev
sudo apt install libcap-ng-dev libcurl4-gnutls-dev libgtk-3-dev
sudo apt install libibverbs-dev libjpeg8-dev libncurses5-dev libnuma-dev
sudo apt install librbd-dev librdmacm-dev
sudo apt install libsasl2-dev libsdl2-dev libseccomp-dev libsnappy-dev libssh-dev
sudo apt install libvde-dev libvdeplug-dev libvte-2.91-dev libxen-dev liblzo2-dev
sudo apt install valgrind xfslibs-dev
sudo apt install libnfs-dev libiscsi-dev
./configure --target-list=<targets> --enable-debug --enable-plugins --prefix=<qemu_install_dir> --disable-werror
make -j$(nproc)
make install
-
change the prefix directory to where you want to install. All parts with
<>
should be replaced. -
on target-list you should only put the necessary targets for faster compile times. The ones ending with
linux-user
are the ones for user mode andsoftmmu
are the full system ones.To get a complete list you can execute./configure --help
. For example, the ones I'm interested in it'sriscv64-linux-user,riscv64-softmmu
. -
you will possibly need to debug QEMU so you should keep the
--enable-debug
flag, but if you want more performance you should recompile without this flag.
To execute
<qemu_install_dir>/bin/qemu-riscv64 -plugin <qemu_source_dir>/contrib/plugins/lib<the_name_of_your_plugin>.so,<plugin_options> -D <plugin_output_filename> -d plugin <binary>
-plugin
is for enabling a plugin-D
is for choosing a file to put all the debugging information-d plugin
is for only output the logs from the plugins
you can find more information about QEMU in it's documentation and more info of the TCG plugins in here.
I obtained the QEMU dependencies from the test/docker/dockerfile
directory in the QEMU source.
Therese more documentation in here!