Skip to content

Commit ba973f3

Browse files
committed
Add virtualization::qemu v10.2.1
This is mainly to be able to build some tools provided by qemu. There is a full qemu build possible, however, not a lot of features are turned on. However, it can be used to build a host version for some local testing.
1 parent f8e1584 commit ba973f3

File tree

3 files changed

+337
-0
lines changed

3 files changed

+337
-0
lines changed

recipes/virtualization/qemu.yaml

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
inherit: [meson, pkg-config, install, make, patch]
2+
3+
# qemu uses a mix of meson and manual builds, therefore it also has its own not
4+
# autotools compatible configure. Needs a little bit of adjustment to make this
5+
# work.
6+
7+
metaEnvironment:
8+
PKG_VERSION: "10.2.1"
9+
PKG_LICENSE: "GPL-2.0, LGPL-2.1, MIT, BSD-3-Clause, BSD-2-Clause, Others/BSD-1c"
10+
11+
depends:
12+
- libs::glib-dev
13+
14+
- use: []
15+
depends:
16+
- libs::glib-tgt
17+
18+
checkoutSCM:
19+
scm: url
20+
url: https://download.qemu.org/qemu-${PKG_VERSION}.tar.xz
21+
digestSHA1: 53ce67b2b57cccac3655c2ea6c4d88283dbef4f7
22+
stripComponents: 1
23+
24+
checkoutDeterministic: True
25+
checkoutScript: |
26+
patchApplySeries $<@qemu/*.patch@>
27+
28+
buildVars: [CC, CXX, CROSS_COMPILE]
29+
buildToolsWeak: [python3]
30+
buildTools: [host-toolchain, target-toolchain]
31+
buildSetup: |
32+
QEMU_DEFAULT_CONFIGURE_OPTS="\
33+
--prefix=/usr \
34+
--cross-prefix=$CROSS_COMPILE \
35+
--cc=$CC \
36+
--cxx=$CXX \
37+
--host-cc=gcc \
38+
${MESON_CFLAGS[@]/#/--extra-cflags=} \
39+
${MESON_LDFLAGS[@]/#/--extra-ldflags=} \
40+
--disable-containers \
41+
--disable-docs \
42+
--disable-tsan \
43+
--disable-download"
44+
45+
QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS="\
46+
$QEMU_DEFAULT_CONFIGURE_OPTS \
47+
--without-default-features \
48+
--without-default-devices \
49+
--disable-tcg \
50+
--enable-fdt=disabled \
51+
--target-list="
52+
53+
multiPackage:
54+
"":
55+
depends:
56+
- libs::slirp-dev
57+
- devel::dtc-dev
58+
- python::pycotap
59+
60+
- use: []
61+
depends:
62+
- libs::slirp-tgt
63+
- devel::dtc-tgt
64+
65+
# This builds a simple version of qemu. Not a lot of features are
66+
# turned on. Its mainly for building it on the host and use it for
67+
# some local testing.
68+
buildScript: |
69+
mkdir -p build install
70+
pushd build
71+
$1/configure \
72+
$QEMU_DEFAULT_CONFIGURE_OPTS \
73+
--target-list='aarch64-softmmu arm-softmmu i386-softmmu x86_64-softmmu'
74+
75+
makeParallel
76+
makeParallel DESTDIR=$BOB_CWD/install install
77+
popd
78+
79+
"img":
80+
buildScript: |
81+
mkdir -p build install
82+
pushd build
83+
$1/configure \
84+
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
85+
--enable-tools
86+
87+
# only build the required tool
88+
makeParallel \
89+
qemu-img
90+
popd
91+
92+
install -D -m 0755 build/qemu-img \
93+
install/usr/bin/qemu-img
94+
95+
"guest-agent":
96+
buildScript: |
97+
mkdir -p build install
98+
pushd build
99+
$1/configure \
100+
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
101+
--enable-guest-agent
102+
103+
# only build the guest agent
104+
makeParallel \
105+
qemu-ga
106+
popd
107+
108+
install -D -m 0755 build/qga/qemu-ga \
109+
install/usr/bin/qemu-ga
110+
111+
"storage-daemon":
112+
buildScript: |
113+
mkdir -p build install
114+
pushd build
115+
$1/configure \
116+
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
117+
--enable-tools \
118+
--enable-vhost-user \
119+
--enable-vhost-user-blk-server
120+
121+
# only build the required tool
122+
makeParallel \
123+
storage-daemon/qemu-storage-daemon
124+
popd
125+
126+
install -D -m 0755 build/storage-daemon/qemu-storage-daemon \
127+
install/usr/bin/qemu-storage-daemon
128+
129+
"vhost-user-input":
130+
buildScript: |
131+
mkdir -p build install
132+
pushd build
133+
$1/configure \
134+
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
135+
--enable-tools \
136+
--enable-vhost-user
137+
138+
# only build the required tool
139+
makeParallel \
140+
contrib/vhost-user-input/vhost-user-input
141+
popd
142+
143+
install -D -m 0755 build/contrib/vhost-user-input/vhost-user-input \
144+
install/usr/bin/vhost-user-input
145+
146+
"vhost-user-blk":
147+
buildScript: |
148+
mkdir -p build install
149+
pushd build
150+
$1/configure \
151+
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
152+
--enable-tools \
153+
--enable-vhost-user
154+
155+
# only build the required tool
156+
makeParallel \
157+
contrib/vhost-user-blk/vhost-user-blk
158+
popd
159+
160+
install -D -m 0755 build/contrib/vhost-user-blk/vhost-user-blk \
161+
install/usr/bin/vhost-user-blk
162+
163+
"vhost-user-gpu":
164+
depends:
165+
- virtual::libs::libegl-dev
166+
- virtual::libs::libgles-dev
167+
- virtual::libs::libdrm-dev
168+
- libs::pixman-dev
169+
- libs::libvirglrenderer-dev
170+
171+
- use: []
172+
depends:
173+
- virtual::libs::libegl-tgt
174+
- virtual::libs::libgles-tgt
175+
- virtual::libs::libdrm-tgt
176+
- libs::pixman-tgt
177+
- libs::libvirglrenderer-tgt
178+
179+
buildScript: |
180+
mkdir -p build install
181+
pushd build
182+
$1/configure \
183+
$QEMU_DEFAULT_CONFIGURE_TOOLS_OPTS \
184+
--enable-tools \
185+
--enable-vhost-user \
186+
--enable-pixman \
187+
--enable-virglrenderer \
188+
--enable-opengl
189+
190+
# only build the required tool
191+
makeParallel \
192+
contrib/vhost-user-gpu/vhost-user-gpu
193+
popd
194+
195+
install -D -m 0755 build/contrib/vhost-user-gpu/vhost-user-gpu \
196+
install/usr/bin/vhost-user-gpu
197+
198+
packageScript: |
199+
# /usr/share may contain exec/code which should not be stripped. Ignore it
200+
# in the install step.
201+
installPackageTgt "$1/install/" "!/usr/share"
202+
# Now simply copy the unstripped files.
203+
installCopy "$1/install/" "/usr/" "/usr/share/***" "!*"
204+
provideDeps: [ "*-tgt" ]
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From b50754aa4bf3cb0cbb5983b5f8b1d1cf54e8e5c9 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Christian=20P=C3=B6tzsch?=
3+
<christian.poetzsch@kernkonzept.com>
4+
Date: Fri, 6 Sep 2024 10:40:08 +0200
5+
Subject: [PATCH 1/2] Disable tests subdir
6+
7+
They make trouble when configure runs in bob. Simply disable them.
8+
---
9+
meson.build | 10 +++++-----
10+
1 file changed, 5 insertions(+), 5 deletions(-)
11+
12+
diff --git a/meson.build b/meson.build
13+
index d9293294d8..01eba65123 100644
14+
--- a/meson.build
15+
+++ b/meson.build
16+
@@ -3892,8 +3892,8 @@ subdir('bsd-user')
17+
subdir('linux-user')
18+
19+
# needed for fuzzing binaries
20+
-subdir('tests/qtest/libqos')
21+
-subdir('tests/qtest/fuzz')
22+
+#subdir('tests/qtest/libqos')
23+
+#subdir('tests/qtest/fuzz')
24+
25+
# accel modules
26+
target_modules += { 'accel' : { 'qtest': qtest_module_ss }}
27+
@@ -4589,9 +4589,9 @@ subdir('pc-bios')
28+
subdir('docs')
29+
# Tests are disabled on emscripten because they rely on host features that aren't
30+
# supported by emscripten (e.g. fork and unix socket).
31+
-if host_os != 'emscripten'
32+
- subdir('tests')
33+
-endif
34+
+#if host_os != 'emscripten'
35+
+# subdir('tests')
36+
+#endif
37+
if gtk.found()
38+
subdir('po')
39+
endif
40+
--
41+
2.47.3
42+
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
From 814aef648a543574cc574a3c26adf196480226ec Mon Sep 17 00:00:00 2001
2+
From: Christian Poetzsch <christian.poetzsch@kernkonzept.com>
3+
Date: Sun, 10 Mar 2024 22:43:16 +0100
4+
Subject: [PATCH 2/2] Add support for abs info in vhost-user-input
5+
6+
Absolute input device did not work, cause VIRTIO_INPUT_CFG_ABS_INFO is
7+
missing. Fetch this info when available and provide it to any virtio
8+
clients.
9+
10+
This is the same code as in hw/input/virtio-input-host.c.
11+
---
12+
contrib/vhost-user-input/main.c | 46 +++++++++++++++++++++++++++++++--
13+
1 file changed, 44 insertions(+), 2 deletions(-)
14+
15+
diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
16+
index f3362d41ac..935e3ccdb7 100644
17+
--- a/contrib/vhost-user-input/main.c
18+
+++ b/contrib/vhost-user-input/main.c
19+
@@ -272,6 +272,32 @@ vi_bits_config(VuInput *vi, int type, int count)
20+
g_array_append_val(vi->config, bits);
21+
}
22+
23+
+static void
24+
+vi_input_abs_config(VuInput *vi, int axis)
25+
+{
26+
+ virtio_input_config config;
27+
+ struct input_absinfo absinfo;
28+
+ int rc;
29+
+
30+
+ rc = ioctl(vi->evdevfd, EVIOCGABS(axis), &absinfo);
31+
+ if (rc < 0) {
32+
+ return;
33+
+ }
34+
+
35+
+ memset(&config, 0, sizeof(config));
36+
+ config.select = VIRTIO_INPUT_CFG_ABS_INFO;
37+
+ config.subsel = axis;
38+
+ config.size = sizeof(struct input_absinfo);
39+
+
40+
+ config.u.abs.min = cpu_to_le32(absinfo.minimum);
41+
+ config.u.abs.max = cpu_to_le32(absinfo.maximum);
42+
+ config.u.abs.fuzz = cpu_to_le32(absinfo.fuzz);
43+
+ config.u.abs.flat = cpu_to_le32(absinfo.flat);
44+
+ config.u.abs.res = cpu_to_le32(absinfo.resolution);
45+
+
46+
+ g_array_append_val(vi->config, config);
47+
+}
48+
+
49+
static char *opt_evdev;
50+
static int opt_fdnum = -1;
51+
static char *opt_socket_path;
52+
@@ -297,11 +323,12 @@ main(int argc, char *argv[])
53+
{
54+
GMainLoop *loop = NULL;
55+
VuInput vi = { 0, };
56+
- int rc, ver, fd;
57+
- virtio_input_config id;
58+
+ int rc, ver, fd, i, axis;
59+
+ virtio_input_config id, *abs;
60+
struct input_id ids;
61+
GError *error = NULL;
62+
GOptionContext *context;
63+
+ uint8_t byte;
64+
65+
context = g_option_context_new(NULL);
66+
g_option_context_add_main_entries(context, entries, NULL);
67+
@@ -375,6 +402,21 @@ main(int argc, char *argv[])
68+
vi_bits_config(&vi, EV_ABS, ABS_CNT);
69+
vi_bits_config(&vi, EV_MSC, MSC_CNT);
70+
vi_bits_config(&vi, EV_SW, SW_CNT);
71+
+
72+
+ abs = vi_find_config(&vi, VIRTIO_INPUT_CFG_EV_BITS, EV_ABS);
73+
+ if (abs) {
74+
+ for (i = 0; i < abs->size; i++) {
75+
+ byte = abs->u.bitmap[i];
76+
+ axis = 8 * i;
77+
+ while (byte) {
78+
+ if (byte & 1) {
79+
+ vi_input_abs_config(&vi, axis);
80+
+ }
81+
+ axis++;
82+
+ byte >>= 1;
83+
+ }
84+
+ }
85+
+ }
86+
g_debug("config length: %u", vi.config->len);
87+
88+
if (opt_socket_path) {
89+
--
90+
2.47.3
91+

0 commit comments

Comments
 (0)