1 |
commit: 7e9e099c436cc0934ca4e092856e5b08909622d6 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 29 05:37:56 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 29 05:37:56 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e9e099c |
7 |
|
8 |
app-emulation/qemu: add glibc-2.35 patch |
9 |
|
10 |
Closes: https://bugs.gentoo.org/836300 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
...u-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch | 61 ++ |
14 |
app-emulation/qemu/qemu-6.2.0-r4.ebuild | 925 +++++++++++++++++++++ |
15 |
2 files changed, 986 insertions(+) |
16 |
|
17 |
diff --git a/app-emulation/qemu/files/qemu-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch b/app-emulation/qemu/files/qemu-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..156d94b0f57e |
20 |
--- /dev/null |
21 |
+++ b/app-emulation/qemu/files/qemu-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch |
22 |
@@ -0,0 +1,61 @@ |
23 |
+https://gitlab.com/qemu/qemu/-/commit/7b223e38603de3a75602e14914d26f9d4baf52eb.patch |
24 |
+https://bugs.gentoo.org/836300 |
25 |
+ |
26 |
+From 7b223e38603de3a75602e14914d26f9d4baf52eb Mon Sep 17 00:00:00 2001 |
27 |
+From: Christian Ehrhardt <christian.ehrhardt@×××××××××.com> |
28 |
+Date: Wed, 9 Feb 2022 12:14:56 +0100 |
29 |
+Subject: [PATCH] tools/virtiofsd: Add rseq syscall to the seccomp allowlist |
30 |
+ |
31 |
+The virtiofsd currently crashes when used with glibc 2.35. |
32 |
+That is due to the rseq system call being added to every thread |
33 |
+creation [1][2]. |
34 |
+ |
35 |
+[1]: https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/ |
36 |
+[2]: https://sourceware.org/pipermail/libc-alpha/2022-February/136040.html |
37 |
+ |
38 |
+This happens not at daemon start, but when a guest connects |
39 |
+ |
40 |
+ /usr/lib/qemu/virtiofsd -f --socket-path=/tmp/testvfsd -o sandbox=chroot \ |
41 |
+ -o source=/var/guests/j-virtiofs --socket-group=kvm |
42 |
+ virtio_session_mount: Waiting for vhost-user socket connection... |
43 |
+ # start ok, now guest will connect |
44 |
+ virtio_session_mount: Received vhost-user socket connection |
45 |
+ virtio_loop: Entry |
46 |
+ fv_queue_set_started: qidx=0 started=1 |
47 |
+ fv_queue_set_started: qidx=1 started=1 |
48 |
+ Bad system call (core dumped) |
49 |
+ |
50 |
+We have to put rseq on the seccomp allowlist to avoid that the daemon |
51 |
+is crashing in this case. |
52 |
+ |
53 |
+Reported-by: Michael Hudson-Doyle <michael.hudson@×××××××××.com> |
54 |
+Signed-off-by: Christian Ehrhardt <christian.ehrhardt@×××××××××.com> |
55 |
+Reviewed-by: Dr. David Alan Gilbert <dgilbert@××××××.com> |
56 |
+Message-id: 20220209111456.3328420-1-christian.ehrhardt@×××××××××.com |
57 |
+ |
58 |
+[Moved rseq to its alphabetically ordered position in the seccomp |
59 |
+allowlist. |
60 |
+--Stefan] |
61 |
+Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com> |
62 |
+--- |
63 |
+ tools/virtiofsd/passthrough_seccomp.c | 3 +++ |
64 |
+ 1 file changed, 3 insertions(+) |
65 |
+ |
66 |
+diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c |
67 |
+index a3ce9f898d..2bc0127b69 100644 |
68 |
+--- a/tools/virtiofsd/passthrough_seccomp.c |
69 |
++++ b/tools/virtiofsd/passthrough_seccomp.c |
70 |
+@@ -91,6 +91,9 @@ static const int syscall_allowlist[] = { |
71 |
+ SCMP_SYS(renameat2), |
72 |
+ SCMP_SYS(removexattr), |
73 |
+ SCMP_SYS(restart_syscall), |
74 |
++#ifdef __NR_rseq |
75 |
++ SCMP_SYS(rseq), /* required since glibc 2.35 */ |
76 |
++#endif |
77 |
+ SCMP_SYS(rt_sigaction), |
78 |
+ SCMP_SYS(rt_sigprocmask), |
79 |
+ SCMP_SYS(rt_sigreturn), |
80 |
+-- |
81 |
+GitLab |
82 |
+ |
83 |
+ |
84 |
|
85 |
diff --git a/app-emulation/qemu/qemu-6.2.0-r4.ebuild b/app-emulation/qemu/qemu-6.2.0-r4.ebuild |
86 |
new file mode 100644 |
87 |
index 000000000000..e981bb09adc5 |
88 |
--- /dev/null |
89 |
+++ b/app-emulation/qemu/qemu-6.2.0-r4.ebuild |
90 |
@@ -0,0 +1,925 @@ |
91 |
+# Copyright 1999-2022 Gentoo Authors |
92 |
+# Distributed under the terms of the GNU General Public License v2 |
93 |
+ |
94 |
+EAPI=8 |
95 |
+ |
96 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
97 |
+PYTHON_REQ_USE="ncurses,readline" |
98 |
+ |
99 |
+FIRMWARE_ABI_VERSION="6.2.0" |
100 |
+ |
101 |
+inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \ |
102 |
+ pax-utils xdg-utils |
103 |
+ |
104 |
+if [[ ${PV} = *9999* ]]; then |
105 |
+ EGIT_REPO_URI="https://git.qemu.org/git/qemu.git" |
106 |
+ EGIT_SUBMODULES=( |
107 |
+ meson |
108 |
+ tests/fp/berkeley-softfloat-3 |
109 |
+ tests/fp/berkeley-testfloat-3 |
110 |
+ ui/keycodemapdb |
111 |
+ ) |
112 |
+ inherit git-r3 |
113 |
+ SRC_URI="" |
114 |
+else |
115 |
+ SRC_URI="https://download.qemu.org/${P}.tar.xz" |
116 |
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" |
117 |
+fi |
118 |
+ |
119 |
+DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools" |
120 |
+HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org" |
121 |
+ |
122 |
+LICENSE="GPL-2 LGPL-2 BSD-2" |
123 |
+SLOT="0" |
124 |
+ |
125 |
+IUSE="accessibility +aio alsa bpf bzip2 capstone +caps +curl debug +doc |
126 |
+ +fdt fuse glusterfs +gnutls gtk infiniband iscsi io-uring |
127 |
+ jack jemalloc +jpeg |
128 |
+ lzo multipath |
129 |
+ ncurses nfs nls numa opengl +oss pam +pin-upstream-blobs |
130 |
+ plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux |
131 |
+ +slirp |
132 |
+ smartcard snappy spice ssh static static-user systemtap test udev usb |
133 |
+ usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen |
134 |
+ xfs zstd" |
135 |
+ |
136 |
+COMMON_TARGETS=" |
137 |
+ aarch64 |
138 |
+ alpha |
139 |
+ arm |
140 |
+ cris |
141 |
+ hppa |
142 |
+ i386 |
143 |
+ m68k |
144 |
+ microblaze |
145 |
+ microblazeel |
146 |
+ mips |
147 |
+ mips64 |
148 |
+ mips64el |
149 |
+ mipsel |
150 |
+ nios2 |
151 |
+ or1k |
152 |
+ ppc |
153 |
+ ppc64 |
154 |
+ riscv32 |
155 |
+ riscv64 |
156 |
+ s390x |
157 |
+ sh4 |
158 |
+ sh4eb |
159 |
+ sparc |
160 |
+ sparc64 |
161 |
+ x86_64 |
162 |
+ xtensa |
163 |
+ xtensaeb |
164 |
+" |
165 |
+IUSE_SOFTMMU_TARGETS=" |
166 |
+ ${COMMON_TARGETS} |
167 |
+ avr |
168 |
+ rx |
169 |
+ tricore |
170 |
+" |
171 |
+IUSE_USER_TARGETS=" |
172 |
+ ${COMMON_TARGETS} |
173 |
+ aarch64_be |
174 |
+ armeb |
175 |
+ hexagon |
176 |
+ mipsn32 |
177 |
+ mipsn32el |
178 |
+ ppc64abi32 |
179 |
+ ppc64le |
180 |
+ sparc32plus |
181 |
+" |
182 |
+ |
183 |
+use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS}) |
184 |
+use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS}) |
185 |
+IUSE+=" ${use_softmmu_targets} ${use_user_targets}" |
186 |
+ |
187 |
+RESTRICT="!test? ( test )" |
188 |
+# Allow no targets to be built so that people can get a tools-only build. |
189 |
+# Block USE flag configurations known to not work. |
190 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
191 |
+ qemu_softmmu_targets_arm? ( fdt ) |
192 |
+ qemu_softmmu_targets_microblaze? ( fdt ) |
193 |
+ qemu_softmmu_targets_mips64el? ( fdt ) |
194 |
+ qemu_softmmu_targets_ppc64? ( fdt ) |
195 |
+ qemu_softmmu_targets_ppc? ( fdt ) |
196 |
+ qemu_softmmu_targets_riscv32? ( fdt ) |
197 |
+ qemu_softmmu_targets_riscv64? ( fdt ) |
198 |
+ qemu_softmmu_targets_x86_64? ( fdt ) |
199 |
+ sdl-image? ( sdl ) |
200 |
+ static? ( static-user !alsa !gtk !jack !opengl !pam !pulseaudio !plugins !rbd !snappy !udev ) |
201 |
+ static-user? ( !plugins ) |
202 |
+ vhost-user-fs? ( caps seccomp ) |
203 |
+ virgl? ( opengl ) |
204 |
+ virtfs? ( caps xattr ) |
205 |
+ vnc? ( gnutls ) |
206 |
+ vte? ( gtk ) |
207 |
+ multipath? ( udev ) |
208 |
+ plugins? ( !static !static-user ) |
209 |
+" |
210 |
+ |
211 |
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...) |
212 |
+# and user/softmmu targets (qemu-*, qemu-system-*). |
213 |
+# |
214 |
+# Yep, you need both libcap and libcap-ng since virtfs only uses libcap. |
215 |
+# |
216 |
+# The attr lib isn't always linked in (although the USE flag is always |
217 |
+# respected). This is because qemu supports using the C library's API |
218 |
+# when available rather than always using the external library. |
219 |
+ALL_DEPEND=" |
220 |
+ >=dev-libs/glib-2.0[static-libs(+)] |
221 |
+ sys-libs/zlib[static-libs(+)] |
222 |
+ python? ( ${PYTHON_DEPS} ) |
223 |
+ systemtap? ( dev-util/systemtap ) |
224 |
+ xattr? ( sys-apps/attr[static-libs(+)] )" |
225 |
+ |
226 |
+# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...) |
227 |
+# softmmu targets (qemu-system-*). |
228 |
+SOFTMMU_TOOLS_DEPEND=" |
229 |
+ dev-libs/libxml2[static-libs(+)] |
230 |
+ >=x11-libs/pixman-0.28.0[static-libs(+)] |
231 |
+ accessibility? ( |
232 |
+ app-accessibility/brltty[api] |
233 |
+ app-accessibility/brltty[static-libs(+)] |
234 |
+ ) |
235 |
+ aio? ( dev-libs/libaio[static-libs(+)] ) |
236 |
+ alsa? ( >=media-libs/alsa-lib-1.0.13 ) |
237 |
+ bpf? ( dev-libs/libbpf:= ) |
238 |
+ bzip2? ( app-arch/bzip2[static-libs(+)] ) |
239 |
+ capstone? ( dev-libs/capstone:= ) |
240 |
+ caps? ( sys-libs/libcap-ng[static-libs(+)] ) |
241 |
+ curl? ( >=net-misc/curl-7.15.4[static-libs(+)] ) |
242 |
+ fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] ) |
243 |
+ fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] ) |
244 |
+ glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] ) |
245 |
+ gnutls? ( |
246 |
+ dev-libs/nettle:=[static-libs(+)] |
247 |
+ >=net-libs/gnutls-3.0:=[static-libs(+)] |
248 |
+ ) |
249 |
+ gtk? ( |
250 |
+ x11-libs/gtk+:3 |
251 |
+ vte? ( x11-libs/vte:2.91 ) |
252 |
+ ) |
253 |
+ infiniband? ( sys-cluster/rdma-core[static-libs(+)] ) |
254 |
+ iscsi? ( net-libs/libiscsi ) |
255 |
+ io-uring? ( sys-libs/liburing:=[static-libs(+)] ) |
256 |
+ jack? ( virtual/jack ) |
257 |
+ jemalloc? ( dev-libs/jemalloc ) |
258 |
+ jpeg? ( virtual/jpeg:0=[static-libs(+)] ) |
259 |
+ lzo? ( dev-libs/lzo:2[static-libs(+)] ) |
260 |
+ multipath? ( sys-fs/multipath-tools ) |
261 |
+ ncurses? ( |
262 |
+ sys-libs/ncurses:=[unicode(+)] |
263 |
+ sys-libs/ncurses:=[static-libs(+)] |
264 |
+ ) |
265 |
+ nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] ) |
266 |
+ numa? ( sys-process/numactl[static-libs(+)] ) |
267 |
+ opengl? ( |
268 |
+ virtual/opengl |
269 |
+ media-libs/libepoxy[static-libs(+)] |
270 |
+ media-libs/mesa[static-libs(+)] |
271 |
+ media-libs/mesa[egl(+),gbm(+)] |
272 |
+ ) |
273 |
+ pam? ( sys-libs/pam ) |
274 |
+ png? ( media-libs/libpng:0=[static-libs(+)] ) |
275 |
+ pulseaudio? ( media-sound/pulseaudio ) |
276 |
+ rbd? ( sys-cluster/ceph ) |
277 |
+ sasl? ( dev-libs/cyrus-sasl[static-libs(+)] ) |
278 |
+ sdl? ( |
279 |
+ media-libs/libsdl2[video] |
280 |
+ media-libs/libsdl2[static-libs(+)] |
281 |
+ ) |
282 |
+ sdl-image? ( media-libs/sdl2-image[static-libs(+)] ) |
283 |
+ seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] ) |
284 |
+ slirp? ( net-libs/libslirp[static-libs(+)] ) |
285 |
+ smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] ) |
286 |
+ snappy? ( app-arch/snappy:= ) |
287 |
+ spice? ( |
288 |
+ >=app-emulation/spice-protocol-0.12.3 |
289 |
+ >=app-emulation/spice-0.12.0[static-libs(+)] |
290 |
+ ) |
291 |
+ ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] ) |
292 |
+ udev? ( virtual/libudev:= ) |
293 |
+ usb? ( >=virtual/libusb-1-r2[static-libs(+)] ) |
294 |
+ usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] ) |
295 |
+ vde? ( net-misc/vde[static-libs(+)] ) |
296 |
+ virgl? ( media-libs/virglrenderer[static-libs(+)] ) |
297 |
+ virtfs? ( sys-libs/libcap ) |
298 |
+ xen? ( app-emulation/xen-tools:= ) |
299 |
+ xfs? ( sys-fs/xfsprogs[static-libs(+)] ) |
300 |
+ zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] ) |
301 |
+" |
302 |
+ |
303 |
+EDK2_OVMF_VERSION="202105" |
304 |
+SEABIOS_VERSION="1.14.0" |
305 |
+ |
306 |
+X86_FIRMWARE_DEPEND=" |
307 |
+ pin-upstream-blobs? ( |
308 |
+ ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary] |
309 |
+ ~sys-firmware/ipxe-1.21.1[binary,qemu] |
310 |
+ ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios] |
311 |
+ ~sys-firmware/sgabios-0.1_pre10[binary] |
312 |
+ ) |
313 |
+ !pin-upstream-blobs? ( |
314 |
+ >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION} |
315 |
+ sys-firmware/ipxe[qemu] |
316 |
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios] |
317 |
+ sys-firmware/sgabios |
318 |
+ )" |
319 |
+PPC_FIRMWARE_DEPEND=" |
320 |
+ pin-upstream-blobs? ( |
321 |
+ ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios] |
322 |
+ ) |
323 |
+ !pin-upstream-blobs? ( |
324 |
+ >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios] |
325 |
+ ) |
326 |
+" |
327 |
+ |
328 |
+BDEPEND=" |
329 |
+ $(python_gen_impl_dep) |
330 |
+ dev-lang/perl |
331 |
+ sys-apps/texinfo |
332 |
+ virtual/pkgconfig |
333 |
+ doc? ( |
334 |
+ dev-python/sphinx[${PYTHON_USEDEP}] |
335 |
+ dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}] |
336 |
+ ) |
337 |
+ gtk? ( nls? ( sys-devel/gettext ) ) |
338 |
+ test? ( |
339 |
+ dev-libs/glib[utils] |
340 |
+ sys-devel/bc |
341 |
+ ) |
342 |
+" |
343 |
+CDEPEND=" |
344 |
+ !static? ( |
345 |
+ ${ALL_DEPEND//\[static-libs(+)]} |
346 |
+ ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]} |
347 |
+ ) |
348 |
+ qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} ) |
349 |
+ qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} ) |
350 |
+ qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} ) |
351 |
+ qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} ) |
352 |
+" |
353 |
+DEPEND="${CDEPEND} |
354 |
+ kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 ) |
355 |
+ static? ( |
356 |
+ ${ALL_DEPEND} |
357 |
+ ${SOFTMMU_TOOLS_DEPEND} |
358 |
+ ) |
359 |
+ static-user? ( ${ALL_DEPEND} )" |
360 |
+RDEPEND="${CDEPEND} |
361 |
+ acct-group/kvm |
362 |
+ selinux? ( |
363 |
+ sec-policy/selinux-qemu |
364 |
+ sys-libs/libselinux |
365 |
+ )" |
366 |
+ |
367 |
+PATCHES=( |
368 |
+ "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch |
369 |
+ "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch |
370 |
+ "${FILESDIR}"/${PN}-6.0.0-make.patch |
371 |
+ "${FILESDIR}"/${PN}-6.1.0-strings.patch |
372 |
+ "${FILESDIR}"/${PN}-6.2.0-user-SLIC-crash.patch |
373 |
+ "${FILESDIR}"/${PN}-6.2.0-also-build-virtfs-proxy-helper.patch |
374 |
+ "${FILESDIR}"/${PN}-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch |
375 |
+) |
376 |
+ |
377 |
+QA_PREBUILT=" |
378 |
+ usr/share/qemu/hppa-firmware.img |
379 |
+ usr/share/qemu/openbios-ppc |
380 |
+ usr/share/qemu/openbios-sparc64 |
381 |
+ usr/share/qemu/openbios-sparc32 |
382 |
+ usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf |
383 |
+ usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf |
384 |
+ usr/share/qemu/palcode-clipper |
385 |
+ usr/share/qemu/s390-ccw.img |
386 |
+ usr/share/qemu/s390-netboot.img |
387 |
+ usr/share/qemu/u-boot.e500 |
388 |
+" |
389 |
+ |
390 |
+QA_WX_LOAD="usr/bin/qemu-i386 |
391 |
+ usr/bin/qemu-x86_64 |
392 |
+ usr/bin/qemu-alpha |
393 |
+ usr/bin/qemu-arm |
394 |
+ usr/bin/qemu-cris |
395 |
+ usr/bin/qemu-m68k |
396 |
+ usr/bin/qemu-microblaze |
397 |
+ usr/bin/qemu-microblazeel |
398 |
+ usr/bin/qemu-mips |
399 |
+ usr/bin/qemu-mipsel |
400 |
+ usr/bin/qemu-or1k |
401 |
+ usr/bin/qemu-ppc |
402 |
+ usr/bin/qemu-ppc64 |
403 |
+ usr/bin/qemu-ppc64abi32 |
404 |
+ usr/bin/qemu-sh4 |
405 |
+ usr/bin/qemu-sh4eb |
406 |
+ usr/bin/qemu-sparc |
407 |
+ usr/bin/qemu-sparc64 |
408 |
+ usr/bin/qemu-armeb |
409 |
+ usr/bin/qemu-sparc32plus |
410 |
+ usr/bin/qemu-s390x |
411 |
+ usr/bin/qemu-unicore32 |
412 |
+" |
413 |
+ |
414 |
+DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the |
415 |
+kernel module loaded before running kvm. The easiest way to ensure that the |
416 |
+kernel module is loaded is to load it on boot. |
417 |
+ For AMD CPUs the module is called 'kvm-amd'. |
418 |
+ For Intel CPUs the module is called 'kvm-intel'. |
419 |
+Please review /etc/conf.d/modules for how to load these. |
420 |
+ |
421 |
+Make sure your user is in the 'kvm' group. Just run |
422 |
+ $ gpasswd -a <USER> kvm |
423 |
+then have <USER> re-login. |
424 |
+ |
425 |
+For brand new installs, the default permissions on /dev/kvm might not let |
426 |
+you access it. You can tell udev to reset ownership/perms: |
427 |
+ $ udevadm trigger -c add /dev/kvm |
428 |
+ |
429 |
+If you want to register binfmt handlers for qemu user targets: |
430 |
+For openrc: |
431 |
+ # rc-update add qemu-binfmt |
432 |
+For systemd: |
433 |
+ # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf" |
434 |
+ |
435 |
+pkg_pretend() { |
436 |
+ if use kernel_linux && kernel_is lt 2 6 25; then |
437 |
+ eerror "This version of KVM requires a host kernel of 2.6.25 or higher." |
438 |
+ elif use kernel_linux; then |
439 |
+ if ! linux_config_exists; then |
440 |
+ eerror "Unable to check your kernel for KVM support" |
441 |
+ else |
442 |
+ CONFIG_CHECK="~KVM ~TUN ~BRIDGE" |
443 |
+ ERROR_KVM="You must enable KVM in your kernel to continue" |
444 |
+ ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in" |
445 |
+ ERROR_KVM_AMD+=" your kernel configuration." |
446 |
+ ERROR_KVM_INTEL="If you have an Intel CPU, you must enable" |
447 |
+ ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration." |
448 |
+ ERROR_TUN="You will need the Universal TUN/TAP driver compiled" |
449 |
+ ERROR_TUN+=" into your kernel or loaded as a module to use the" |
450 |
+ ERROR_TUN+=" virtual network device if using -net tap." |
451 |
+ ERROR_BRIDGE="You will also need support for 802.1d" |
452 |
+ ERROR_BRIDGE+=" Ethernet Bridging for some network configurations." |
453 |
+ use vhost-net && CONFIG_CHECK+=" ~VHOST_NET" |
454 |
+ ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net" |
455 |
+ ERROR_VHOST_NET+=" support" |
456 |
+ |
457 |
+ if use amd64 || use x86 || use amd64-linux || use x86-linux; then |
458 |
+ if grep -q AuthenticAMD /proc/cpuinfo; then |
459 |
+ CONFIG_CHECK+=" ~KVM_AMD" |
460 |
+ elif grep -q GenuineIntel /proc/cpuinfo; then |
461 |
+ CONFIG_CHECK+=" ~KVM_INTEL" |
462 |
+ fi |
463 |
+ fi |
464 |
+ |
465 |
+ use python && CONFIG_CHECK+=" ~DEBUG_FS" |
466 |
+ ERROR_DEBUG_FS="debugFS support required for kvm_stat" |
467 |
+ |
468 |
+ # Now do the actual checks setup above |
469 |
+ check_extra_config |
470 |
+ fi |
471 |
+ fi |
472 |
+ |
473 |
+ if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then |
474 |
+ eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt" |
475 |
+ eerror "instances are still pointing to it. Please update your" |
476 |
+ eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag" |
477 |
+ eerror "and the right system binary (e.g. qemu-system-x86_64)." |
478 |
+ die "update your virt configs to not use qemu-kvm" |
479 |
+ fi |
480 |
+} |
481 |
+ |
482 |
+# Sanity check to make sure target lists are kept up-to-date. |
483 |
+check_targets() { |
484 |
+ local var=$1 mak=$2 |
485 |
+ local detected sorted |
486 |
+ |
487 |
+ pushd "${S}"/configs/targets/ >/dev/null || die |
488 |
+ |
489 |
+ # Force C locale until glibc is updated. #564936 |
490 |
+ detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u)) |
491 |
+ sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u)) |
492 |
+ if [[ ${sorted} != "${detected}" ]] ; then |
493 |
+ eerror "The ebuild needs to be kept in sync." |
494 |
+ eerror "${var}: ${sorted}" |
495 |
+ eerror "$(printf '%-*s' ${#var} configure): ${detected}" |
496 |
+ die "sync ${var} to the list of targets" |
497 |
+ fi |
498 |
+ |
499 |
+ popd >/dev/null |
500 |
+} |
501 |
+ |
502 |
+src_prepare() { |
503 |
+ check_targets IUSE_SOFTMMU_TARGETS softmmu |
504 |
+ check_targets IUSE_USER_TARGETS linux-user |
505 |
+ |
506 |
+ default |
507 |
+ |
508 |
+ # Use correct toolchain to fix cross-compiling |
509 |
+ tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS |
510 |
+ export WINDRES=${CHOST}-windres |
511 |
+ |
512 |
+ # Verbose builds |
513 |
+ MAKEOPTS+=" V=1" |
514 |
+ |
515 |
+ # Remove bundled copy of libfdt |
516 |
+ rm -r dtc || die |
517 |
+} |
518 |
+ |
519 |
+## |
520 |
+# configures qemu based on the build directory and the build type |
521 |
+# we are using. |
522 |
+# |
523 |
+qemu_src_configure() { |
524 |
+ debug-print-function ${FUNCNAME} "$@" |
525 |
+ |
526 |
+ local buildtype=$1 |
527 |
+ local builddir="${S}/${buildtype}-build" |
528 |
+ |
529 |
+ mkdir "${builddir}" |
530 |
+ |
531 |
+ local conf_opts=( |
532 |
+ --prefix=/usr |
533 |
+ --sysconfdir=/etc |
534 |
+ --bindir=/usr/bin |
535 |
+ --libdir=/usr/$(get_libdir) |
536 |
+ --datadir=/usr/share |
537 |
+ --docdir=/usr/share/doc/${PF}/html |
538 |
+ --mandir=/usr/share/man |
539 |
+ --localstatedir=/var |
540 |
+ --disable-bsd-user |
541 |
+ --disable-containers # bug #732972 |
542 |
+ --disable-guest-agent |
543 |
+ --disable-strip |
544 |
+ --with-git-submodules=ignore |
545 |
+ |
546 |
+ # bug #746752: TCG interpreter has a few limitations: |
547 |
+ # - it does not support FPU |
548 |
+ # - it's generally slower on non-self-modifying code |
549 |
+ # It's advantage is support for host architectures |
550 |
+ # where native codegeneration is not implemented. |
551 |
+ # Gentoo has qemu keyworded only on targets with |
552 |
+ # native code generation available. Avoid the interpreter. |
553 |
+ --disable-tcg-interpreter |
554 |
+ |
555 |
+ --disable-werror |
556 |
+ # We support gnutls/nettle for crypto operations. It is possible |
557 |
+ # to use gcrypt when gnutls/nettle are disabled (but not when they |
558 |
+ # are enabled), but it's not really worth the hassle. Disable it |
559 |
+ # all the time to avoid automatically detecting it. #568856 |
560 |
+ --disable-gcrypt |
561 |
+ --python="${PYTHON}" |
562 |
+ --cc="$(tc-getCC)" |
563 |
+ --cxx="$(tc-getCXX)" |
564 |
+ --host-cc="$(tc-getBUILD_CC)" |
565 |
+ $(use_enable alsa) |
566 |
+ $(use_enable debug debug-info) |
567 |
+ $(use_enable debug debug-tcg) |
568 |
+ $(use_enable jack) |
569 |
+ $(use_enable nls gettext) |
570 |
+ $(use_enable oss) |
571 |
+ $(use_enable plugins) |
572 |
+ $(use_enable pulseaudio pa) |
573 |
+ $(use_enable selinux) |
574 |
+ $(use_enable xattr attr) |
575 |
+ ) |
576 |
+ |
577 |
+ # Disable options not used by user targets. This simplifies building |
578 |
+ # static user targets (USE=static-user) considerably. |
579 |
+ conf_notuser() { |
580 |
+ if [[ ${buildtype} == "user" ]] ; then |
581 |
+ echo "--disable-${2:-$1}" |
582 |
+ else |
583 |
+ use_enable "$@" |
584 |
+ fi |
585 |
+ } |
586 |
+ # Enable option only for softmmu build, but not 'user' or 'tools' |
587 |
+ conf_softmmu() { |
588 |
+ if [[ ${buildtype} == "softmmu" ]] ; then |
589 |
+ use_enable "$@" |
590 |
+ else |
591 |
+ echo "--disable-${2:-$1}" |
592 |
+ fi |
593 |
+ } |
594 |
+ # Enable option only for tools build, but not 'user' or 'softmmu' |
595 |
+ conf_tools() { |
596 |
+ if [[ ${buildtype} == "tools" ]] ; then |
597 |
+ use_enable "$@" |
598 |
+ else |
599 |
+ echo "--disable-${2:-$1}" |
600 |
+ fi |
601 |
+ } |
602 |
+ # Special case for the malloc flag, because the --disable flag does |
603 |
+ # not exist and trying like above will break configuring. |
604 |
+ conf_malloc() { |
605 |
+ if [[ ! ${buildtype} == "user" ]] ; then |
606 |
+ usex "${1}" "--enable-malloc=${1}" "" |
607 |
+ fi |
608 |
+ } |
609 |
+ conf_opts+=( |
610 |
+ $(conf_notuser accessibility brlapi) |
611 |
+ $(conf_notuser aio linux-aio) |
612 |
+ $(conf_softmmu bpf) |
613 |
+ $(conf_notuser bzip2) |
614 |
+ $(conf_notuser capstone) |
615 |
+ $(conf_notuser caps cap-ng) |
616 |
+ $(conf_notuser curl) |
617 |
+ $(conf_tools doc docs) |
618 |
+ $(conf_notuser fdt) |
619 |
+ $(conf_notuser fuse) |
620 |
+ $(conf_notuser glusterfs) |
621 |
+ $(conf_notuser gnutls) |
622 |
+ $(conf_notuser gnutls nettle) |
623 |
+ $(conf_notuser gtk) |
624 |
+ $(conf_notuser infiniband rdma) |
625 |
+ $(conf_notuser iscsi libiscsi) |
626 |
+ $(conf_notuser io-uring linux-io-uring) |
627 |
+ $(conf_malloc jemalloc) |
628 |
+ $(conf_notuser jpeg vnc-jpeg) |
629 |
+ $(conf_notuser kernel_linux kvm) |
630 |
+ $(conf_notuser lzo) |
631 |
+ $(conf_notuser multipath mpath) |
632 |
+ $(conf_notuser ncurses curses) |
633 |
+ $(conf_notuser nfs libnfs) |
634 |
+ $(conf_notuser numa) |
635 |
+ $(conf_notuser opengl) |
636 |
+ $(conf_notuser pam auth-pam) |
637 |
+ $(conf_notuser png vnc-png) |
638 |
+ $(conf_notuser rbd) |
639 |
+ $(conf_notuser sasl vnc-sasl) |
640 |
+ $(conf_notuser sdl) |
641 |
+ $(conf_softmmu sdl-image) |
642 |
+ $(conf_notuser seccomp) |
643 |
+ $(conf_notuser slirp slirp system) |
644 |
+ $(conf_notuser smartcard) |
645 |
+ $(conf_notuser snappy) |
646 |
+ $(conf_notuser spice) |
647 |
+ $(conf_notuser ssh libssh) |
648 |
+ $(conf_notuser udev libudev) |
649 |
+ $(conf_notuser usb libusb) |
650 |
+ $(conf_notuser usbredir usb-redir) |
651 |
+ $(conf_notuser vde) |
652 |
+ $(conf_notuser vhost-net) |
653 |
+ $(conf_notuser vhost-user-fs) |
654 |
+ $(conf_tools vhost-user-fs virtiofsd) |
655 |
+ $(conf_notuser virgl virglrenderer) |
656 |
+ $(conf_softmmu virtfs) |
657 |
+ $(conf_notuser vnc) |
658 |
+ $(conf_notuser vte) |
659 |
+ $(conf_notuser xen) |
660 |
+ $(conf_notuser xen xen-pci-passthrough) |
661 |
+ $(conf_notuser xfs xfsctl) |
662 |
+ # use prebuilt keymaps, bug #759604 |
663 |
+ --disable-xkbcommon |
664 |
+ $(conf_notuser zstd) |
665 |
+ ) |
666 |
+ |
667 |
+ if [[ ${buildtype} == "user" ]] ; then |
668 |
+ conf_opts+=( --disable-libxml2 ) |
669 |
+ else |
670 |
+ conf_opts+=( --enable-libxml2 ) |
671 |
+ fi |
672 |
+ |
673 |
+ if [[ ! ${buildtype} == "user" ]] ; then |
674 |
+ # audio options |
675 |
+ local audio_opts=( |
676 |
+ # Note: backend order matters here: #716202 |
677 |
+ # We iterate from higher-level to lower level. |
678 |
+ $(usex pulseaudio pa "") |
679 |
+ $(usev jack) |
680 |
+ $(usev sdl) |
681 |
+ $(usev alsa) |
682 |
+ $(usev oss) |
683 |
+ ) |
684 |
+ conf_opts+=( |
685 |
+ --audio-drv-list=$(IFS=,; echo "${audio_opts[*]}") |
686 |
+ ) |
687 |
+ fi |
688 |
+ |
689 |
+ case ${buildtype} in |
690 |
+ user) |
691 |
+ conf_opts+=( |
692 |
+ --enable-linux-user |
693 |
+ --disable-system |
694 |
+ --disable-blobs |
695 |
+ --disable-tools |
696 |
+ ) |
697 |
+ local static_flag="static-user" |
698 |
+ ;; |
699 |
+ softmmu) |
700 |
+ conf_opts+=( |
701 |
+ --disable-linux-user |
702 |
+ --enable-system |
703 |
+ --disable-tools |
704 |
+ ) |
705 |
+ local static_flag="static" |
706 |
+ ;; |
707 |
+ tools) |
708 |
+ conf_opts+=( |
709 |
+ --disable-linux-user |
710 |
+ --disable-system |
711 |
+ --disable-blobs |
712 |
+ --enable-tools |
713 |
+ ) |
714 |
+ local static_flag="static" |
715 |
+ ;; |
716 |
+ esac |
717 |
+ |
718 |
+ local targets="${buildtype}_targets" |
719 |
+ [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" ) |
720 |
+ |
721 |
+ # Add support for SystemTAP |
722 |
+ use systemtap && conf_opts+=( --enable-trace-backend=dtrace ) |
723 |
+ |
724 |
+ # We always want to attempt to build with PIE support as it results |
725 |
+ # in a more secure binary. But it doesn't work with static or if |
726 |
+ # the current GCC doesn't have PIE support. |
727 |
+ if use ${static_flag}; then |
728 |
+ conf_opts+=( --static --disable-pie ) |
729 |
+ else |
730 |
+ tc-enables-pie && conf_opts+=( --enable-pie ) |
731 |
+ fi |
732 |
+ |
733 |
+ # Meson will not use a cross-file unless cross_prefix is set. |
734 |
+ tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" ) |
735 |
+ |
736 |
+ # Plumb through equivalent of EXTRA_ECONF to allow experiments |
737 |
+ # like bug #747928. |
738 |
+ conf_opts+=( ${EXTRA_CONF_QEMU} ) |
739 |
+ |
740 |
+ echo "../configure ${conf_opts[*]}" |
741 |
+ cd "${builddir}" |
742 |
+ ../configure "${conf_opts[@]}" || die "configure failed" |
743 |
+} |
744 |
+ |
745 |
+src_configure() { |
746 |
+ local target |
747 |
+ |
748 |
+ python_setup |
749 |
+ |
750 |
+ softmmu_targets= softmmu_bins=() |
751 |
+ user_targets= user_bins=() |
752 |
+ |
753 |
+ for target in ${IUSE_SOFTMMU_TARGETS} ; do |
754 |
+ if use "qemu_softmmu_targets_${target}"; then |
755 |
+ softmmu_targets+=",${target}-softmmu" |
756 |
+ softmmu_bins+=( "qemu-system-${target}" ) |
757 |
+ fi |
758 |
+ done |
759 |
+ |
760 |
+ for target in ${IUSE_USER_TARGETS} ; do |
761 |
+ if use "qemu_user_targets_${target}"; then |
762 |
+ user_targets+=",${target}-linux-user" |
763 |
+ user_bins+=( "qemu-${target}" ) |
764 |
+ fi |
765 |
+ done |
766 |
+ |
767 |
+ softmmu_targets=${softmmu_targets#,} |
768 |
+ user_targets=${user_targets#,} |
769 |
+ |
770 |
+ [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu" |
771 |
+ [[ -n ${user_targets} ]] && qemu_src_configure "user" |
772 |
+ qemu_src_configure "tools" |
773 |
+} |
774 |
+ |
775 |
+src_compile() { |
776 |
+ if [[ -n ${user_targets} ]]; then |
777 |
+ cd "${S}/user-build" |
778 |
+ default |
779 |
+ fi |
780 |
+ |
781 |
+ if [[ -n ${softmmu_targets} ]]; then |
782 |
+ cd "${S}/softmmu-build" |
783 |
+ default |
784 |
+ fi |
785 |
+ |
786 |
+ cd "${S}/tools-build" |
787 |
+ default |
788 |
+} |
789 |
+ |
790 |
+src_test() { |
791 |
+ if [[ -n ${softmmu_targets} ]]; then |
792 |
+ cd "${S}/softmmu-build" |
793 |
+ pax-mark m */qemu-system-* #515550 |
794 |
+ emake check |
795 |
+ fi |
796 |
+} |
797 |
+ |
798 |
+qemu_python_install() { |
799 |
+ python_domodule "${S}/python/qemu" |
800 |
+ |
801 |
+ python_doscript "${S}/scripts/kvm/vmxcap" |
802 |
+ python_doscript "${S}/scripts/qmp/qmp-shell" |
803 |
+ python_doscript "${S}/scripts/qmp/qemu-ga-client" |
804 |
+} |
805 |
+ |
806 |
+# Generate binfmt support files. |
807 |
+# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc) |
808 |
+# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt) |
809 |
+generate_initd() { |
810 |
+ local out="${T}/qemu-binfmt" |
811 |
+ local out_systemd="${T}/qemu.conf" |
812 |
+ local d="${T}/binfmt.d" |
813 |
+ |
814 |
+ einfo "Generating qemu binfmt scripts and configuration files" |
815 |
+ |
816 |
+ # Generate the debian fragments first. |
817 |
+ mkdir -p "${d}" |
818 |
+ "${S}"/scripts/qemu-binfmt-conf.sh \ |
819 |
+ --debian \ |
820 |
+ --exportdir "${d}" \ |
821 |
+ --qemu-path "${EPREFIX}/usr/bin" \ |
822 |
+ || die |
823 |
+ # Then turn the fragments into a shell script we can source. |
824 |
+ sed -E -i \ |
825 |
+ -e 's:^([^ ]+) (.*)$:\1="\2":' \ |
826 |
+ "${d}"/* || die |
827 |
+ |
828 |
+ # Generate the init.d script by assembling the fragments from above. |
829 |
+ local f qcpu package interpreter magic mask |
830 |
+ cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die |
831 |
+ for f in "${d}"/qemu-* ; do |
832 |
+ source "${f}" |
833 |
+ |
834 |
+ # Normalize the cpu logic like we do in the init.d for the native cpu. |
835 |
+ qcpu=${package#qemu-} |
836 |
+ case ${qcpu} in |
837 |
+ arm*) qcpu="arm";; |
838 |
+ mips*) qcpu="mips";; |
839 |
+ ppc*) qcpu="ppc";; |
840 |
+ s390*) qcpu="s390";; |
841 |
+ sh*) qcpu="sh";; |
842 |
+ sparc*) qcpu="sparc";; |
843 |
+ esac |
844 |
+ |
845 |
+ # we use 'printf' here to be portable across 'sh' |
846 |
+ # implementations: #679168 |
847 |
+ cat <<EOF >>"${out}" |
848 |
+ if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then |
849 |
+ printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register |
850 |
+ fi |
851 |
+EOF |
852 |
+ |
853 |
+ echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}" |
854 |
+ |
855 |
+ done |
856 |
+ cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die |
857 |
+} |
858 |
+ |
859 |
+src_install() { |
860 |
+ if [[ -n ${user_targets} ]]; then |
861 |
+ cd "${S}/user-build" |
862 |
+ emake DESTDIR="${ED}" install |
863 |
+ |
864 |
+ # Install binfmt handler init script for user targets. |
865 |
+ generate_initd |
866 |
+ doinitd "${T}/qemu-binfmt" |
867 |
+ |
868 |
+ # Install binfmt/qemu.conf. |
869 |
+ insinto "/usr/share/qemu/binfmt.d" |
870 |
+ doins "${T}/qemu.conf" |
871 |
+ fi |
872 |
+ |
873 |
+ if [[ -n ${softmmu_targets} ]]; then |
874 |
+ cd "${S}/softmmu-build" |
875 |
+ emake DESTDIR="${ED}" install |
876 |
+ |
877 |
+ # This might not exist if the test failed. #512010 |
878 |
+ [[ -e check-report.html ]] && dodoc check-report.html |
879 |
+ |
880 |
+ if use kernel_linux; then |
881 |
+ udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules |
882 |
+ fi |
883 |
+ |
884 |
+ if use python; then |
885 |
+ python_foreach_impl qemu_python_install |
886 |
+ fi |
887 |
+ fi |
888 |
+ |
889 |
+ cd "${S}/tools-build" |
890 |
+ emake DESTDIR="${ED}" install |
891 |
+ |
892 |
+ # Disable mprotect on the qemu binaries as they use JITs to be fast #459348 |
893 |
+ pushd "${ED}"/usr/bin >/dev/null |
894 |
+ pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594 |
895 |
+ popd >/dev/null |
896 |
+ |
897 |
+ # Install config file example for qemu-bridge-helper |
898 |
+ insinto "/etc/qemu" |
899 |
+ doins "${FILESDIR}/bridge.conf" |
900 |
+ |
901 |
+ cd "${S}" |
902 |
+ dodoc MAINTAINERS docs/specs/pci-ids.txt |
903 |
+ newdoc pc-bios/README README.pc-bios |
904 |
+ |
905 |
+ # Disallow stripping of prebuilt firmware files. |
906 |
+ dostrip -x ${QA_PREBUILT} |
907 |
+ |
908 |
+ if [[ -n ${softmmu_targets} ]]; then |
909 |
+ # Remove SeaBIOS since we're using the SeaBIOS packaged one |
910 |
+ rm "${ED}/usr/share/qemu/bios.bin" |
911 |
+ rm "${ED}/usr/share/qemu/bios-256k.bin" |
912 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
913 |
+ dosym ../seabios/bios.bin /usr/share/qemu/bios.bin |
914 |
+ dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin |
915 |
+ fi |
916 |
+ |
917 |
+ # Remove vgabios since we're using the seavgabios packaged one |
918 |
+ rm "${ED}/usr/share/qemu/vgabios.bin" |
919 |
+ rm "${ED}/usr/share/qemu/vgabios-cirrus.bin" |
920 |
+ rm "${ED}/usr/share/qemu/vgabios-qxl.bin" |
921 |
+ rm "${ED}/usr/share/qemu/vgabios-stdvga.bin" |
922 |
+ rm "${ED}/usr/share/qemu/vgabios-virtio.bin" |
923 |
+ rm "${ED}/usr/share/qemu/vgabios-vmware.bin" |
924 |
+ # PPC/PPC64 loads vgabios-stdvga |
925 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then |
926 |
+ dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin |
927 |
+ dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin |
928 |
+ dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin |
929 |
+ dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin |
930 |
+ dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin |
931 |
+ dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin |
932 |
+ fi |
933 |
+ |
934 |
+ # Remove sgabios since we're using the sgabios packaged one |
935 |
+ rm "${ED}/usr/share/qemu/sgabios.bin" |
936 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
937 |
+ dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin |
938 |
+ fi |
939 |
+ |
940 |
+ # Remove iPXE since we're using the iPXE packaged one |
941 |
+ rm "${ED}"/usr/share/qemu/pxe-*.rom |
942 |
+ if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then |
943 |
+ dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom |
944 |
+ dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom |
945 |
+ dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom |
946 |
+ dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom |
947 |
+ dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom |
948 |
+ dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom |
949 |
+ fi |
950 |
+ fi |
951 |
+ |
952 |
+ DISABLE_AUTOFORMATTING=true |
953 |
+ readme.gentoo_create_doc |
954 |
+} |
955 |
+ |
956 |
+firmware_abi_change() { |
957 |
+ local pv |
958 |
+ for pv in ${REPLACING_VERSIONS}; do |
959 |
+ if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then |
960 |
+ return 0 |
961 |
+ fi |
962 |
+ done |
963 |
+ return 1 |
964 |
+} |
965 |
+ |
966 |
+pkg_postinst() { |
967 |
+ if [[ -n ${softmmu_targets} ]] && use kernel_linux; then |
968 |
+ udev_reload |
969 |
+ fi |
970 |
+ |
971 |
+ xdg_icon_cache_update |
972 |
+ |
973 |
+ [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \ |
974 |
+ fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper |
975 |
+ |
976 |
+ DISABLE_AUTOFORMATTING=true |
977 |
+ readme.gentoo_print_elog |
978 |
+ |
979 |
+ if use pin-upstream-blobs && firmware_abi_change; then |
980 |
+ ewarn "This version of qemu pins new versions of firmware blobs:" |
981 |
+ ewarn " $(best_version sys-firmware/edk2-ovmf)" |
982 |
+ ewarn " $(best_version sys-firmware/ipxe)" |
983 |
+ ewarn " $(best_version sys-firmware/seabios)" |
984 |
+ ewarn " $(best_version sys-firmware/sgabios)" |
985 |
+ ewarn "This might break resume of hibernated guests (started with a different" |
986 |
+ ewarn "firmware version) and live migration to/from qemu versions with different" |
987 |
+ ewarn "firmware. Please (cold) restart all running guests. For functional" |
988 |
+ ewarn "guest migration ensure that all" |
989 |
+ ewarn "hosts run at least" |
990 |
+ ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}." |
991 |
+ fi |
992 |
+} |
993 |
+ |
994 |
+pkg_info() { |
995 |
+ echo "Using:" |
996 |
+ echo " $(best_version app-emulation/spice-protocol)" |
997 |
+ echo " $(best_version sys-firmware/edk2-ovmf)" |
998 |
+ if has_version 'sys-firmware/edk2-ovmf[binary]'; then |
999 |
+ echo " USE=binary" |
1000 |
+ else |
1001 |
+ echo " USE=''" |
1002 |
+ fi |
1003 |
+ echo " $(best_version sys-firmware/ipxe)" |
1004 |
+ echo " $(best_version sys-firmware/seabios)" |
1005 |
+ if has_version 'sys-firmware/seabios[binary]'; then |
1006 |
+ echo " USE=binary" |
1007 |
+ else |
1008 |
+ echo " USE=''" |
1009 |
+ fi |
1010 |
+ echo " $(best_version sys-firmware/sgabios)" |
1011 |
+} |
1012 |
+ |
1013 |
+pkg_postrm() { |
1014 |
+ xdg_icon_cache_update |
1015 |
+} |