Building QEMU with virtio-gpu
and rutabaga_gfx
Date: on 2023-11-22 | Updated: on 2024-01-04
virtio-gpu-rutabaga
device is available in QEMU 8.2 release candidates and later versions.
...
Code Block | ||
---|---|---|
| ||
apt install -y {libpulse,libdrm,libglm,libstb,libegl,libgles,libvulkan,vulkan-validationlayers}-dev |
In Debian trixie, vulkan-validation-layers-dev
has been renamed to vulkan-utility-libraries-dev
.
2. Build qemu
Code Block | ||
---|---|---|
| ||
git clone https://gitlab.com/qemu-project/qemu.git |
Checkout master
or a 8.2 tagged release.
2.1 (maybe optional) Build libvirglrenderer
Depending on the system version you have you might need a newer libvirglrender
Code Block |
---|
export PREFIX="$(pwd)"/prefix
git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git
cd virglrenderer
meson setup -Dprefix=$PREFIX -Dlibdir=lib build
cd build
ninja install |
2.2 Build rutabaga
/gfxstream
dependencies
You will need to build gfxstream
and rutabaga_gfx
dependencies for QEMU.
...
The following rutabaga_gfx
build instructions were taken from https://crosvm.dev/book/appendix/rutabaga_gfx.html
2.
...
2.1 - Build aemu
HEAD
revision:
Code Block | ||
---|---|---|
| ||
qemu/deps/aemu % git log -1 c22a4b0caf5a07 (HEAD -> main, origin/master, origin/main, origin/HEAD) Simplify reland:formatter multidisplay:interface addto isPixelFold methoduse std::string |
Code Block | ||
---|---|---|
| ||
# from <https://crosvm.dev/book/appendix/rutabaga_gfx.html#build-aemu-base> git clone https://android.googlesource.com/platform/hardware/google/aemu cd aemu/ cmake -DAEMU_COMMON_GEN_PKGCONFIG=ON \ -DAEMU_COMMON_BUILD_CONFIG=gfxstream \ -DENABLE_VKCEREAL_TESTS=OFF \ --install-prefix "${PREFIX}" \ -B build cmake --build build -j cmake --install build --prefix "${CMAKE_INSTALL_PREFIX}" |
2.
...
2.2 Build gfxstream
HEAD
revision:
Code Block | ||
---|---|---|
| ||
qemu/deps/gfxstream % git log -1 b5ce9bbd3e45436a (HEAD -> main, origin/master, origin/main, origin/HEAD) AndroidWorkPool.cpp:248:5: error: control reaches end of non-void functionMerge "Fix crash on exit" into main |
Code Block | ||
---|---|---|
| ||
# from <https://crosvm.dev/book/appendix/rutabaga_gfx.html#build-gfxstream> git clone https://android.googlesource.com/platform/hardware/google/gfxstream cd gfxstream/ meson setup -Ddefault_library=static --prefix "${PREFIX}" build/ meson install -C build |
2.
...
2.3 Build rutabaga
FFI
Code Block | ||
---|---|---|
| ||
git clone git@githubhttps://github.com:/google/crosvm.git |
You will also need rust/cargo.
...
Code Block | ||
---|---|---|
| ||
crosvm % git log -1 1eca601eacd04b6198 (HEAD -> main, origin/main, origin/HEAD) RollUpgrade recipegdbstub dependencies (trivial)and gdbstub_arch. |
Code Block | ||
---|---|---|
| ||
# crosvm HEAD revision: 1eca601ea
export RUSTFLAGS='-Clink-arg=-L='"${PREFIX}"/lib/x86_64-linux-gnu/
cd crosvm/rutabaga_gfx/ffi
make
make prefix="${PREFIX}" install |
Important: if the Makefile
did not find gfxstream with pkg-config
, the library is built without the gfxstream feature. Make sure this step has worked.
2.
...
2.4 Build qemu
binary
After all that, go back to qemu/build
and build QEMU:
...