Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 204 additions & 0 deletions recipes/virtualization/qemu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
inherit: [meson, pkg-config, install, make, patch]

# qemu uses a mix of meson and manual builds, therefore it also has its own not
# autotools compatible configure. Needs a little bit of adjustment to make this
# work.

metaEnvironment:
PKG_VERSION: "10.2.1"
PKG_LICENSE: "GPL-2.0, LGPL-2.1, MIT, BSD-3-Clause, BSD-2-Clause, Others/BSD-1c"

depends:
- libs::glib-dev

- use: []
depends:
- libs::glib-tgt

checkoutSCM:
scm: url
url: https://download.qemu.org/qemu-${PKG_VERSION}.tar.xz
digestSHA1: 53ce67b2b57cccac3655c2ea6c4d88283dbef4f7
stripComponents: 1

checkoutDeterministic: True
checkoutScript: |
patchApplySeries $<@qemu/*.patch@>

buildVars: [CC, CXX, CROSS_COMPILE]
buildToolsWeak: [python3]
buildTools: [host-toolchain, target-toolchain]
buildSetup: |
QEMU_DEFAULT_CONFIGURE_OPTS="\
--prefix=/usr \
--cross-prefix=$CROSS_COMPILE \
--cc=$CC \
--cxx=$CXX \
--host-cc=gcc \
${MESON_CFLAGS[@]/#/--extra-cflags=} \
${MESON_LDFLAGS[@]/#/--extra-ldflags=} \
--disable-containers \
--disable-docs \
--disable-tsan \
--disable-download"

QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS="\
$QEMU_DEFAULT_CONFIGURE_OPTS \
--without-default-features \
--without-default-devices \
--disable-tcg \
--enable-fdt=disabled \
--target-list="

multiPackage:
"":
depends:
- libs::slirp-dev
- devel::dtc-dev
- python::pycotap

- use: []
depends:
- libs::slirp-tgt
- devel::dtc-tgt

# This builds a simple version of qemu. Not a lot of features are
# turned on. Its mainly for building it on the host and use it for
# some local testing.
buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_OPTS \
--target-list='aarch64-softmmu arm-softmmu i386-softmmu x86_64-softmmu'

makeParallel
makeParallel DESTDIR=$BOB_CWD/install install
popd

"img":
buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
--enable-tools

# only build the required tool
makeParallel \
qemu-img
popd

install -D -m 0755 build/qemu-img \
install/usr/bin/qemu-img

"guest-agent":
buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
--enable-guest-agent

# only build the guest agent
makeParallel \
qemu-ga
popd

install -D -m 0755 build/qga/qemu-ga \
install/usr/bin/qemu-ga

"storage-daemon":
buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
--enable-tools \
--enable-vhost-user \
--enable-vhost-user-blk-server

# only build the required tool
makeParallel \
storage-daemon/qemu-storage-daemon
popd

install -D -m 0755 build/storage-daemon/qemu-storage-daemon \
install/usr/bin/qemu-storage-daemon

"vhost-user-input":
buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
--enable-tools \
--enable-vhost-user

# only build the required tool
makeParallel \
contrib/vhost-user-input/vhost-user-input
popd

install -D -m 0755 build/contrib/vhost-user-input/vhost-user-input \
install/usr/bin/vhost-user-input

"vhost-user-blk":
buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
--enable-tools \
--enable-vhost-user

# only build the required tool
makeParallel \
contrib/vhost-user-blk/vhost-user-blk
popd

install -D -m 0755 build/contrib/vhost-user-blk/vhost-user-blk \
install/usr/bin/vhost-user-blk

"vhost-user-gpu":
depends:
- virtual::libs::libegl-dev
- virtual::libs::libgles-dev
- virtual::libs::libdrm-dev
- libs::pixman-dev
- libs::libvirglrenderer-dev

- use: []
depends:
- virtual::libs::libegl-tgt
- virtual::libs::libgles-tgt
- virtual::libs::libdrm-tgt
- libs::pixman-tgt
- libs::libvirglrenderer-tgt

buildScript: |
mkdir -p build install
pushd build
$1/configure \
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
--enable-tools \
--enable-vhost-user \
--enable-pixman \
--enable-virglrenderer \
--enable-opengl

# only build the required tool
makeParallel \
contrib/vhost-user-gpu/vhost-user-gpu
popd

install -D -m 0755 build/contrib/vhost-user-gpu/vhost-user-gpu \
install/usr/bin/vhost-user-gpu

packageScript: |
# /usr/share may contain exec/code which should not be stripped. Ignore it
# in the install step.
installPackageTgt "$1/install/" "!/usr/share"
# Now simply copy the unstripped files.
installCopy "$1/install/" "/usr/" "/usr/share/***" "!*"
provideDeps: [ "*-tgt" ]
42 changes: 42 additions & 0 deletions recipes/virtualization/qemu/0001-Disable-tests-subdir.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From b50754aa4bf3cb0cbb5983b5f8b1d1cf54e8e5c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20P=C3=B6tzsch?=
<[email protected]>
Date: Fri, 6 Sep 2024 10:40:08 +0200
Subject: [PATCH 1/2] Disable tests subdir

They make trouble when configure runs in bob. Simply disable them.
---
meson.build | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index d9293294d8..01eba65123 100644
--- a/meson.build
+++ b/meson.build
@@ -3892,8 +3892,8 @@ subdir('bsd-user')
subdir('linux-user')

# needed for fuzzing binaries
-subdir('tests/qtest/libqos')
-subdir('tests/qtest/fuzz')
+#subdir('tests/qtest/libqos')
+#subdir('tests/qtest/fuzz')

# accel modules
target_modules += { 'accel' : { 'qtest': qtest_module_ss }}
@@ -4589,9 +4589,9 @@ subdir('pc-bios')
subdir('docs')
# Tests are disabled on emscripten because they rely on host features that aren't
# supported by emscripten (e.g. fork and unix socket).
-if host_os != 'emscripten'
- subdir('tests')
-endif
+#if host_os != 'emscripten'
+# subdir('tests')
+#endif
if gtk.found()
subdir('po')
endif
--
2.47.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
From 814aef648a543574cc574a3c26adf196480226ec Mon Sep 17 00:00:00 2001
From: Christian Poetzsch <[email protected]>
Date: Sun, 10 Mar 2024 22:43:16 +0100
Subject: [PATCH 2/2] Add support for abs info in vhost-user-input

Absolute input device did not work, cause VIRTIO_INPUT_CFG_ABS_INFO is
missing. Fetch this info when available and provide it to any virtio
clients.

This is the same code as in hw/input/virtio-input-host.c.
---
contrib/vhost-user-input/main.c | 46 +++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
index f3362d41ac..935e3ccdb7 100644
--- a/contrib/vhost-user-input/main.c
+++ b/contrib/vhost-user-input/main.c
@@ -272,6 +272,32 @@ vi_bits_config(VuInput *vi, int type, int count)
g_array_append_val(vi->config, bits);
}

+static void
+vi_input_abs_config(VuInput *vi, int axis)
+{
+ virtio_input_config config;
+ struct input_absinfo absinfo;
+ int rc;
+
+ rc = ioctl(vi->evdevfd, EVIOCGABS(axis), &absinfo);
+ if (rc < 0) {
+ return;
+ }
+
+ memset(&config, 0, sizeof(config));
+ config.select = VIRTIO_INPUT_CFG_ABS_INFO;
+ config.subsel = axis;
+ config.size = sizeof(struct input_absinfo);
+
+ config.u.abs.min = cpu_to_le32(absinfo.minimum);
+ config.u.abs.max = cpu_to_le32(absinfo.maximum);
+ config.u.abs.fuzz = cpu_to_le32(absinfo.fuzz);
+ config.u.abs.flat = cpu_to_le32(absinfo.flat);
+ config.u.abs.res = cpu_to_le32(absinfo.resolution);
+
+ g_array_append_val(vi->config, config);
+}
+
static char *opt_evdev;
static int opt_fdnum = -1;
static char *opt_socket_path;
@@ -297,11 +323,12 @@ main(int argc, char *argv[])
{
GMainLoop *loop = NULL;
VuInput vi = { 0, };
- int rc, ver, fd;
- virtio_input_config id;
+ int rc, ver, fd, i, axis;
+ virtio_input_config id, *abs;
struct input_id ids;
GError *error = NULL;
GOptionContext *context;
+ uint8_t byte;

context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, entries, NULL);
@@ -375,6 +402,21 @@ main(int argc, char *argv[])
vi_bits_config(&vi, EV_ABS, ABS_CNT);
vi_bits_config(&vi, EV_MSC, MSC_CNT);
vi_bits_config(&vi, EV_SW, SW_CNT);
+
+ abs = vi_find_config(&vi, VIRTIO_INPUT_CFG_EV_BITS, EV_ABS);
+ if (abs) {
+ for (i = 0; i < abs->size; i++) {
+ byte = abs->u.bitmap[i];
+ axis = 8 * i;
+ while (byte) {
+ if (byte & 1) {
+ vi_input_abs_config(&vi, axis);
+ }
+ axis++;
+ byte >>= 1;
+ }
+ }
+ }
g_debug("config length: %u", vi.config->len);

if (opt_socket_path) {
--
2.47.3