summaryrefslogtreecommitdiff
path: root/app-emulation/qemu
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/qemu')
-rw-r--r--app-emulation/qemu/Manifest18
-rw-r--r--app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch34
-rw-r--r--app-emulation/qemu/files/qemu-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch61
-rw-r--r--app-emulation/qemu/files/qemu-6.2.0-user-SLIC-crash.patch173
-rw-r--r--app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch94
-rw-r--r--app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch182
-rw-r--r--app-emulation/qemu/metadata.xml2
-rw-r--r--app-emulation/qemu/qemu-6.2.0-r3.ebuild924
-rw-r--r--app-emulation/qemu/qemu-6.2.0-r4.ebuild925
-rw-r--r--app-emulation/qemu/qemu-6.2.0.ebuild913
-rw-r--r--app-emulation/qemu/qemu-7.0.0-r1.ebuild4
-rw-r--r--app-emulation/qemu/qemu-7.0.0-r2.ebuild (renamed from app-emulation/qemu/qemu-7.0.0_rc4.ebuild)38
-rw-r--r--app-emulation/qemu/qemu-9999.ebuild40
13 files changed, 331 insertions, 3077 deletions
diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
index c689e6253a1b..74383dcbd983 100644
--- a/app-emulation/qemu/Manifest
+++ b/app-emulation/qemu/Manifest
@@ -4,19 +4,13 @@ AUX qemu-2.11.1-capstone_include_path.patch 264 BLAKE2B 955b498c0ea2657ee4c9d005
AUX qemu-5.2.0-disable-keymap.patch 884 BLAKE2B dbbe245a52615f8894cbac1c94ce3fee2051b1c54def32ec6ad43dedfe8190d02937c28ce93d93eeb13fe82f2ac2df52bec375501e83af53624d8292f8208fe3 SHA512 f84c6f37ce742201b63b308bef5fdaf1dc50e77e0dcf164e85284e338ed7bd861fc0e147fb88668b056ab0f15b4e6cbefbfb2cd2bafeb002c281ae88d08f9703
AUX qemu-6.0.0-make.patch 306 BLAKE2B 701c6d929dc7544a2e155243a2545dc488765cf8b733fca29c4f4cb06cad732d72f64c330d95fbcdcf12b174b92b7fa5b713bf833065e5014f8aed1eec22c0a1 SHA512 5d22c6c4085dd0bf58752e21af9addd6a1a670a60f172b488d1ccfb1b9356ce9808a3b9337dd1bd2aa9e06735a3c7a465bc11ae3871cc4294ec609729b2e09c7
AUX qemu-6.1.0-strings.patch 882 BLAKE2B 9c35aca28371c15e037af5e9deaa90edcad769b5346f7c90cbb7768ce5639b1d1d1204933024241b7349573cc94ebca7a85ebaf051a9fb9dab8ea7d87d843ef9 SHA512 fcbf02a38401dbc7612130bb993dbec72468c926f729cd32e822b39fefe446ed8fd0906d6ffd4557181df753a84d77182fa713a5939300f193008532be88ada4
-AUX qemu-6.2.0-also-build-virtfs-proxy-helper.patch 1052 BLAKE2B 737442df84f3f852be356dc32748b20da6a548d2ff51871c24fe32ab7589e8b69d5d767514db5d1087b59a45719808ed30479d9ef1c7ba52901305d2a87ad8e2 SHA512 095dcfa37d0b4c461ab5a6358a4e2c6fd9d44b2ea1977ce0aa9eed88bc8d4cbe213f7261b1724ce1dc0896782f2815bfb12a420a338ec3409fdf554b10516f34
-AUX qemu-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch 2297 BLAKE2B 3e47e93e3dd1cf0c34a93c7d9b6da0ef0b7053742b467fc790e485c0557cf01638933d7a3e4c869bbd6984545b91a0088519a8d8e495795b75f740610e5700a2 SHA512 a215b17501bb4251f6255b7222d0ed5af4dd5dfb65ca0c46673493e389e5ab4de1a93ec797933b42b00e36e4f2cb75f4e1cca12d3f501b536fa2fb39956f0c25
-AUX qemu-6.2.0-user-SLIC-crash.patch 6998 BLAKE2B ae8bcd4d729f9a60e9c2680f7c04fe6dc9d644f8f17d4b63628c59d52b0ca2ba8ac31aa49efc57c28259bb368e796faeb37928ef69d5255b889a4c9149506736 SHA512 1ce190cd3cd56f1a1567e26ecd785fa8d66c15bbc3e091d5fbf200ced7b074f8e5cd8fd8e19a2b35a1f6c5f9617bba131ee2b197f44cc5d6551247e9ae252716
AUX qemu-7.0.0-also-build-virtfs-proxy-helper.patch 1168 BLAKE2B c85204a90c5af17675c1d2d09ce884acddd0cabb6816d10baafc299a924f86c94fb66b9c58160fe0e4b5d56c049f249c01390d45bebca42aaf941bdc6f04fe81 SHA512 b5a884545bbc82fe2318f18f4de103e61db6d22fce433f4ed4e175310f329fe110627640c6127df0dd2312dcba05bce342ff08166feb565b9adbea23086f1677
+AUX qemu-7.0.0-pci-overflow-fortify-source-3.patch 3939 BLAKE2B 02909d525e2ff2bc79a763117ccad7fd46eb23ba731ca37d6d6b6d2edcc9aaf02f37d2e13996f1648e9befd13fa50cb14c0d04565196d9ead2ceadcba2610b8b SHA512 0ca086aa4781066133a9a2d0307d6843e0062b17443abffca87af8291569ac2c44ab29408cce5e7a9d05e75ff277f1778347f9ce155e91ea7c6d0eb1d8a2388d
+AUX qemu-7.0.0-virtio-scsi-fixes.patch 7117 BLAKE2B 47f2c2a2783579bccdf0aa509051324a2c269eb9bdad1cad489e40724035cad6958559b46533c9601ffb7bfd2f9fde16117097fd470a3a6fe9b9cf5a0a9f95a8 SHA512 e15418a83b43e9313199d2198ba0434c7130b4c0561a57a244ae783803c8505defdb68ec680e03acaaa0feba3e778d7e6efd4ccec58fa2c49208e4095efe6c31
AUX qemu-binfmt.initd.head 1442 BLAKE2B 23aa5338914aa7c47f9b1cc1d28291abd0ea037a33cca81f990decfafac2907c86c042350c9dd45591d16330846d4e11d2c8a2a409a68ad81656d9c2c51964c0 SHA512 3fec8946a37bfbd2089f5d95089ed5987a198fc0139ee7482d4bb38c2ffa0e165667a7853afcf2b458bc3e2a6540f172c929ca5a334a00db47e2d0f881382c0e
AUX qemu-binfmt.initd.tail 245 BLAKE2B dd59f2944c6e3f0c4d282b94b687a9b5c51dd77c5103fb9889bd9ce56874495397676ae6c8375d9e9e23094828477240778d9e0f361e68cdd63fdad574851561 SHA512 bcca16805f8380d52cc591ea3d65a8f6e5de456730618f6aee301510edb75d235a22d4d7aeed224882210392840adb403eb53234b6cb76a4cb24533852a8b737
-DIST qemu-6.2.0.tar.xz 115667324 BLAKE2B 3f2f02e5c36113df6231a9474c6d5db774e541312173813c28f578d669a51f391695d364dc806f5906d9e3c2796bb20b2606fcd46a247eb751ea517de9d7ce15 SHA512 e9f8231c9e1cfcc41cb47f10a55d63f6b8aee307af00cf6acf64acb7aa4f49fa7e9d6330703a2abea15d8b7bbaba7d3cb08c83edd98d82642367b527df730817
-DIST qemu-7.0.0-rc4.tar.xz 125126604 BLAKE2B e1614daf71ff2625cdd8307812d6dfc4103c7c8a981b49fdda7409b8b4749e2d8354d3f8e903791100e966744485148c9b70ff046c0f8c2b1259a4997a245248 SHA512 ca0e8f5f1608b36f8ad8d9e6aeeb00e07af23e59ffecbda84c4c34bbe686a53c481e26bcedd13165363057cab063dcda7e5191dd5aff2798fde5be711c6dd2ff
DIST qemu-7.0.0.tar.xz 125117636 BLAKE2B ceda6d9f1a585298bd49fed61e8bb35f0064ad8388a9f979c8bd68a38bfe1a47c5bb055e5f74f970c2c440957042b9de4a861524120040c56e4cd8b56c5cfb68 SHA512 44ecd10c018a3763e1bc87d1d35b98890d0d5636acd69fe9b5cadf5024d5af6a31684d60cbe1c3370e02986434c1fb0ad99224e0e6f6fe7eda169992508157b1
-EBUILD qemu-6.2.0-r3.ebuild 26085 BLAKE2B e08fd3d25ef6d00dd194c07af9bf6fcf8f76d18aa7727751275bae12debc17ce1bb95990f5dce731696996f4b4f45a0f2b59cc272a4ee73a7e6dd12d0bf28a45 SHA512 755f89d6f88c31cd259db2c2647c5e8db5d8f0d654d6546bbb12bc0d0dc8b3a153d94847d9c66e40b7580893af4ab7ae4ed3ee348694135d69c1959dde85bdca
-EBUILD qemu-6.2.0-r4.ebuild 26152 BLAKE2B a8c84fc856d6dda0d19666da6f164309cd140747f83e9a3776176d57e0031ec3a7e792eba7fabb31697835fcc649d0784f66e4f1a5690354b2e4945393b91c13 SHA512 2000feaf7dcf342edd132f435f24cbed73449bb651731066301c7a2b2086a3844d8cf96eae84aa2f541e22f5633181a89300348a1f92a622b2ffd2142010cfab
-EBUILD qemu-6.2.0.ebuild 25711 BLAKE2B d34b811efa9d11425e9eb39285c9f0b257faf5e8cce3ed769afe9b62718e6f769c7654ec389e153a58d09cd12cfc64d594a57d64b670f48fe72a6c8700266fb7 SHA512 39950dfc69cf04f5b663db7cfa029d5cd4ee0a1632366bbb406ba5eb7a7ac2b84ed4dbac96a5fd9101f956e6e5c0cb34d7a0b5878f03a0728bbdaacefcff816d
-EBUILD qemu-7.0.0-r1.ebuild 25830 BLAKE2B 626bfce5f4897b54a59dac41be8c93605954d1a16e6bd17b020e6f9eda8ec14fa6cb9361a161b24aefb4491551ee08000f59b9ba769f161907c9f5aa52813349 SHA512 5734afb589e4f8bcf258690414fe59cf241a0e80d2ab260ed9f95a30c0267fc049d0fc43c51410243c4639c870b219f1718ae1853e99958f0d7993be04a913b7
-EBUILD qemu-7.0.0_rc4.ebuild 25822 BLAKE2B e67f354e82bec31294392f5d4a3416f7b2ff0f840adb5b4d4d29df830c7a49d4f0b7169322150bccdb8285fc2f8c1a356560f1076542048ff4774a6a1d9e0b11 SHA512 01a9fa17504d739cc9af93c537b2220b77f0553c0af957dead977715e4acd37775df8849025f934b21da4636c587f0fe6be65f02af517720c73bc1be5206e8c9
-EBUILD qemu-9999.ebuild 25778 BLAKE2B 138f56af8d53947799028996fd6efcd973c74f319ad95ff5e5cba661b553f03f9cd9a9cef97a066998959895e2adb7b130754e40701a76fbc1f26ef32a943dab SHA512 47377cb61dbf4a53ab97a0a14524e0b0ca00a96539b39c801a9592201a05c4dd71a6d27704c20e053befdeb9608713a09ffbf9011791cd1c9811e47472ee8e67
-MISC metadata.xml 4690 BLAKE2B 6c117f311395333d94d0cd1253044c5037aae599d704fe1e63ed77ed0741b87f5f7e8ea57c2948f46b415fb844fc6e9fef92161fe30c6cb1e1fd9fefff889973 SHA512 0dd2f7e71d0be686d7c28a613464a11720d6f31d1a6b6efd3d96f1ac9cceeea2d450df860a414ee719906c90cda4291355993eec5e6a7f8e26a14297252728e0
+EBUILD qemu-7.0.0-r1.ebuild 25838 BLAKE2B 875e737a2d9c56343df88972d479ca661d9cef981d44c8b176e9aa6cee06d578cbf57aa4bd8e5b6396134a91b56de5f6a1f29b6a1903d4ce90f4426b438d8a6b SHA512 f52a03cf93d1faae0fd6363f5797ada9c63138c4adaea5245ccb15d86a997aba1707107c2cda97e4f36b22733bfeb0fe46767b7886c2ec81b275755c95dd1b3a
+EBUILD qemu-7.0.0-r2.ebuild 26304 BLAKE2B 478452308df45bf5f466e644cb732b592e10d9c0d66500b64bf8dd33e3471a3663b774824be2169fa65c4c50dbbd721940753d2fe1c4b65afd413231bc73ff24 SHA512 e7400db9efa895d59b5ecb9df59627439dd9a949c893aaf4d28abb6b69247b79115172f377319cca054b5f068fc1ace20d6666b78a14f786e6dcf444568df16d
+EBUILD qemu-9999.ebuild 26204 BLAKE2B 16dffb0cd5a4b1d29e0dd15d2ec98c37428af53eaef2b5f48e0c225765ea7ea0531f320bf004a2f581e2bac7457d6d60bd51202f5574d34af29bd56415910a8b SHA512 a8131ca6a6c5ba90f61ae1991c02e831704fc87dbaafc202095e64ed9b677f4925281c96500be13880bf8f5fd9dffa9ce628b5b20c9799ca7c5430f23cf35e40
+MISC metadata.xml 4590 BLAKE2B c1216d0bb21573782c9c438a6e9429bb4395aff086c86f1ebc4048bde4e27198d8c975275088c1e1f9c20c22a3cf28c51c3ee4c6bf4c7444b075e8646ef6d88a SHA512 86e0fd933a720ef5559dcfe400fcf32a495b89867b8d018c5a2cba431c2f0ed1ddad3e4e79814e733386f3221b46b811246a6533833986aa1890f2fa33a76420
diff --git a/app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch b/app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch
deleted file mode 100644
index af220802069c..000000000000
--- a/app-emulation/qemu/files/qemu-6.2.0-also-build-virtfs-proxy-helper.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 42e53a0aadb76dfa7c11cd3b14eb4a41efba9bbe Mon Sep 17 00:00:00 2001
-From: Matthias Maier <tamiko@43-1.org>
-Date: Tue, 11 Jan 2022 07:20:31 -0600
-Subject: [PATCH] also build virtfs-proxy-helper
-
-The Gentoo ebuild splits the qemu build into a softmmu, user and tool
-phase in order to be able to build and link some of the qemu emulators
-statically. This unfortunately has the consequence that we never
-configure with "have_virtfs" and "have_tools" at the same time.
-
-As a workaround, simply build the virtfs userland unconditionally. After
-all, it is a tiny executable
----
- meson.build | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/meson.build b/meson.build
-index fbe856700..d6918b04c 100644
---- a/meson.build
-+++ b/meson.build
-@@ -1390,7 +1390,7 @@ have_virtfs = (targetos == 'linux' and
- libattr.found() and
- libcap_ng.found())
-
--have_virtfs_proxy_helper = have_virtfs and have_tools
-+have_virtfs_proxy_helper = have_tools and libcap_ng.found()
-
-
-
- if get_option('virtfs').enabled()
- if not have_virtfs
---
-2.34.1
-
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
deleted file mode 100644
index 156d94b0f57e..000000000000
--- a/app-emulation/qemu/files/qemu-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-https://gitlab.com/qemu/qemu/-/commit/7b223e38603de3a75602e14914d26f9d4baf52eb.patch
-https://bugs.gentoo.org/836300
-
-From 7b223e38603de3a75602e14914d26f9d4baf52eb Mon Sep 17 00:00:00 2001
-From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
-Date: Wed, 9 Feb 2022 12:14:56 +0100
-Subject: [PATCH] tools/virtiofsd: Add rseq syscall to the seccomp allowlist
-
-The virtiofsd currently crashes when used with glibc 2.35.
-That is due to the rseq system call being added to every thread
-creation [1][2].
-
-[1]: https://www.efficios.com/blog/2019/02/08/linux-restartable-sequences/
-[2]: https://sourceware.org/pipermail/libc-alpha/2022-February/136040.html
-
-This happens not at daemon start, but when a guest connects
-
- /usr/lib/qemu/virtiofsd -f --socket-path=/tmp/testvfsd -o sandbox=chroot \
- -o source=/var/guests/j-virtiofs --socket-group=kvm
- virtio_session_mount: Waiting for vhost-user socket connection...
- # start ok, now guest will connect
- virtio_session_mount: Received vhost-user socket connection
- virtio_loop: Entry
- fv_queue_set_started: qidx=0 started=1
- fv_queue_set_started: qidx=1 started=1
- Bad system call (core dumped)
-
-We have to put rseq on the seccomp allowlist to avoid that the daemon
-is crashing in this case.
-
-Reported-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
-Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
-Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-Message-id: 20220209111456.3328420-1-christian.ehrhardt@canonical.com
-
-[Moved rseq to its alphabetically ordered position in the seccomp
-allowlist.
---Stefan]
-Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
----
- tools/virtiofsd/passthrough_seccomp.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/tools/virtiofsd/passthrough_seccomp.c b/tools/virtiofsd/passthrough_seccomp.c
-index a3ce9f898d..2bc0127b69 100644
---- a/tools/virtiofsd/passthrough_seccomp.c
-+++ b/tools/virtiofsd/passthrough_seccomp.c
-@@ -91,6 +91,9 @@ static const int syscall_allowlist[] = {
- SCMP_SYS(renameat2),
- SCMP_SYS(removexattr),
- SCMP_SYS(restart_syscall),
-+#ifdef __NR_rseq
-+ SCMP_SYS(rseq), /* required since glibc 2.35 */
-+#endif
- SCMP_SYS(rt_sigaction),
- SCMP_SYS(rt_sigprocmask),
- SCMP_SYS(rt_sigreturn),
---
-GitLab
-
-
diff --git a/app-emulation/qemu/files/qemu-6.2.0-user-SLIC-crash.patch b/app-emulation/qemu/files/qemu-6.2.0-user-SLIC-crash.patch
deleted file mode 100644
index 76809782b5f7..000000000000
--- a/app-emulation/qemu/files/qemu-6.2.0-user-SLIC-crash.patch
+++ /dev/null
@@ -1,173 +0,0 @@
-Gentoo bug: https://bugs.gentoo.org/830170
-Upstream bug: https://gitlab.com/qemu-project/qemu/-/issues/786
-Patches taken from
-https://lore.kernel.org/qemu-devel/20211227193120.1084176-1-imammedo@redhat.com/
-
-commit dce6c86f54eab61028e110497c222e73381379df
-Author: Igor Mammedov <imammedo@redhat.com>
-Date: Mon Dec 27 14:31:17 2021 -0500
-
- acpi: fix QEMU crash when started with SLIC table
-
- if QEMU is started with used provided SLIC table blob,
-
- -acpitable sig=SLIC,oem_id='CRASH ',oem_table_id="ME",oem_rev=00002210,asl_compiler_id="",asl_compiler_rev=00000000,data=/dev/null
- it will assert with:
-
- hw/acpi/aml-build.c:61:build_append_padded_str: assertion failed: (len <= maxlen)
-
- and following backtrace:
-
- ...
- build_append_padded_str (array=0x555556afe320, str=0x555556afdb2e "CRASH ME", maxlen=0x6, pad=0x20) at hw/acpi/aml-build.c:61
- acpi_table_begin (desc=0x7fffffffd1b0, array=0x555556afe320) at hw/acpi/aml-build.c:1727
- build_fadt (tbl=0x555556afe320, linker=0x555557ca3830, f=0x7fffffffd318, oem_id=0x555556afdb2e "CRASH ME", oem_table_id=0x555556afdb34 "ME") at hw/acpi/aml-build.c:2064
- ...
-
- which happens due to acpi_table_begin() expecting NULL terminated
- oem_id and oem_table_id strings, which is normally the case, but
- in case of user provided SLIC table, oem_id points to table's blob
- directly and as result oem_id became longer than expected.
-
- Fix issue by handling oem_id consistently and make acpi_get_slic_oem()
- return NULL terminated strings.
-
- PS:
- After [1] refactoring, oem_id semantics became inconsistent, where
- NULL terminated string was coming from machine and old way pointer
- into byte array coming from -acpitable option. That used to work
- since build_header() wasn't expecting NULL terminated string and
- blindly copied the 1st 6 bytes only.
-
- However commit [2] broke that by replacing build_header() with
- acpi_table_begin(), which was expecting NULL terminated string
- and was checking oem_id size.
-
- 1) 602b45820 ("acpi: Permit OEM ID and OEM table ID fields to be changed")
- 2)
- Fixes: 4b56e1e4eb08 ("acpi: build_fadt: use acpi_table_begin()/acpi_table_end() instead of build_header()")
- Resolves: https://gitlab.com/qemu-project/qemu/-/issues/786
- Signed-off-by: Igor Mammedov <imammedo@redhat.com>
-
-diff --git a/hw/acpi/core.c b/hw/acpi/core.c
-index 1e004d0078..3e811bf03c 100644
---- a/hw/acpi/core.c
-+++ b/hw/acpi/core.c
-@@ -345,8 +345,8 @@ int acpi_get_slic_oem(AcpiSlicOem *oem)
- struct acpi_table_header *hdr = (void *)(u - sizeof(hdr->_length));
-
- if (memcmp(hdr->sig, "SLIC", 4) == 0) {
-- oem->id = hdr->oem_id;
-- oem->table_id = hdr->oem_table_id;
-+ oem->id = g_strndup(hdr->oem_id, 6);
-+ oem->table_id = g_strndup(hdr->oem_table_id, 8);
- return 0;
- }
- }
-diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
-index a99c6e4fe3..570f82997b 100644
---- a/hw/i386/acpi-build.c
-+++ b/hw/i386/acpi-build.c
-@@ -2721,6 +2721,8 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
-
- /* Cleanup memory that's no longer used. */
- g_array_free(table_offsets, true);
-+ g_free(slic_oem.id);
-+ g_free(slic_oem.table_id);
- }
-
- static void acpi_ram_update(MemoryRegion *mr, GArray *data)
-
-commit a22de122ad03ea40953ad0328b2c3e31002d8052
-Author: Igor Mammedov <imammedo@redhat.com>
-Date: Mon Dec 27 14:31:18 2021 -0500
-
- tests: acpi: whitelist expected blobs before changing them
-
- Signed-off-by: Igor Mammedov <imammedo@redhat.com>
-
-diff --git a/tests/data/acpi/q35/FACP.slic b/tests/data/acpi/q35/FACP.slic
-new file mode 100644
-index 0000000000..f6a864cc86
-Binary files /dev/null and b/tests/data/acpi/q35/FACP.slic differ
-diff --git a/tests/data/acpi/q35/SLIC.slic b/tests/data/acpi/q35/SLIC.slic
-new file mode 100644
-index 0000000000..e69de29bb2
-diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
-index dfb8523c8b..49dbf8fa3e 100644
---- a/tests/qtest/bios-tables-test-allowed-diff.h
-+++ b/tests/qtest/bios-tables-test-allowed-diff.h
-@@ -1 +1,3 @@
- /* List of comma-separated changed AML files to ignore */
-+"tests/data/acpi/q35/FACP.slic",
-+"tests/data/acpi/q35/SLIC.slic",
-
-commit cb913395d76f8fdfd7f1d0c8ea77d4710821bbd3
-Author: Igor Mammedov <imammedo@redhat.com>
-Date: Mon Dec 27 14:31:19 2021 -0500
-
- tests: acpi: add SLIC table test
-
- When user uses '-acpitable' to add SLIC table, some ACPI
- tables (FADT) will change its 'Oem ID'/'Oem Table ID' fields to
- match that of SLIC. Test makes sure thati QEMU handles
- those fields correctly when SLIC table is added with
- '-acpitable' option.
-
- Signed-off-by: Igor Mammedov <imammedo@redhat.com>
-
-diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
-index 258874167e..ae7ef13ec7 100644
---- a/tests/qtest/bios-tables-test.c
-+++ b/tests/qtest/bios-tables-test.c
-@@ -1567,6 +1567,19 @@ static void test_acpi_oem_fields_virt(void)
- g_free(args);
- }
-
-+static void test_acpi_q35_slic(void)
-+{
-+ test_data data = {
-+ .machine = MACHINE_Q35,
-+ .variant = ".slic",
-+ };
-+
-+ test_acpi_one("-acpitable sig=SLIC,oem_id='CRASH ',oem_table_id='ME',"
-+ "oem_rev=00002210,asl_compiler_id='qemu',"
-+ "asl_compiler_rev=00000000,data=/dev/null",
-+ &data);
-+ free_test_data(&data);
-+}
-
- int main(int argc, char *argv[])
- {
-@@ -1639,6 +1652,7 @@ int main(int argc, char *argv[])
- qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
- qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
- }
-+ qtest_add_func("acpi/q35/slic", test_acpi_q35_slic);
- } else if (strcmp(arch, "aarch64") == 0) {
- if (has_tcg) {
- qtest_add_func("acpi/virt", test_acpi_virt_tcg);
-
-commit ffba261306370e0ad8506401b104be5fa4749ade
-Author: Igor Mammedov <imammedo@redhat.com>
-Date: Mon Dec 27 14:31:20 2021 -0500
-
- tests: acpi: SLIC: update expected blobs
-
- Signed-off-by: Igor Mammedov <imammedo@redhat.com>
-
-diff --git a/tests/data/acpi/q35/FACP.slic b/tests/data/acpi/q35/FACP.slic
-index f6a864cc86..891fd4b784 100644
-Binary files a/tests/data/acpi/q35/FACP.slic and b/tests/data/acpi/q35/FACP.slic differ
-diff --git a/tests/data/acpi/q35/SLIC.slic b/tests/data/acpi/q35/SLIC.slic
-index e69de29bb2..fd26592e24 100644
-Binary files a/tests/data/acpi/q35/SLIC.slic and b/tests/data/acpi/q35/SLIC.slic differ
-diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
-index 49dbf8fa3e..dfb8523c8b 100644
---- a/tests/qtest/bios-tables-test-allowed-diff.h
-+++ b/tests/qtest/bios-tables-test-allowed-diff.h
-@@ -1,3 +1 @@
- /* List of comma-separated changed AML files to ignore */
--"tests/data/acpi/q35/FACP.slic",
--"tests/data/acpi/q35/SLIC.slic",
diff --git a/app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch b/app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch
new file mode 100644
index 000000000000..767f66243fcc
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.0.0-pci-overflow-fortify-source-3.patch
@@ -0,0 +1,94 @@
+https://bugs.gentoo.org/849587
+https://bugzilla.opensuse.org/show_bug.cgi?id=1199924
+https://lists.gnu.org/archive/html/qemu-devel/2022-05/msg06183.html
+
+From qemu-devel Tue May 31 11:47:07 2022
+From: Claudio Fontana <cfontana () suse ! de>
+Date: Tue, 31 May 2022 11:47:07 +0000
+To: qemu-devel
+Subject: [PATCH] pci: fix overflow in snprintf string formatting
+Message-Id: <20220531114707.18830-1-cfontana () suse ! de>
+X-MARC-Message: https://marc.info/?l=qemu-devel&m=165399772310578
+
+the code in pcibus_get_fw_dev_path contained the potential for a
+stack buffer overflow of 1 byte, potentially writing to the stack an
+extra NUL byte.
+
+This overflow could happen if the PCI slot is >= 0x10000000,
+and the PCI function is >= 0x10000000, due to the size parameter
+of snprintf being incorrectly calculated in the call:
+
+ if (PCI_FUNC(d->devfn))
+ snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn));
+
+since the off obtained from a previous call to snprintf is added
+instead of subtracted from the total available size of the buffer.
+
+Without the accurate size guard from snprintf, we end up writing in the
+worst case:
+
+name (32) + "@" (1) + SLOT (8) + "," (1) + FUNC (8) + term NUL (1) = 51 bytes
+
+In order to provide something more robust, replace all of the code in
+pcibus_get_fw_dev_path with a single call to g_strdup_printf,
+so there is no need to rely on manual calculations.
+
+Found by compiling QEMU with FORTIFY_SOURCE=3 as the error:
+
+*** buffer overflow detected ***: terminated
+
+Thread 1 "qemu-system-x86" received signal SIGABRT, Aborted.
+[Switching to Thread 0x7ffff642c380 (LWP 121307)]
+0x00007ffff71ff55c in __pthread_kill_implementation () from /lib64/libc.so.6
+(gdb) bt
+ #0 0x00007ffff71ff55c in __pthread_kill_implementation () at /lib64/libc.so.6
+ #1 0x00007ffff71ac6f6 in raise () at /lib64/libc.so.6
+ #2 0x00007ffff7195814 in abort () at /lib64/libc.so.6
+ #3 0x00007ffff71f279e in __libc_message () at /lib64/libc.so.6
+ #4 0x00007ffff729767a in __fortify_fail () at /lib64/libc.so.6
+ #5 0x00007ffff7295c36 in () at /lib64/libc.so.6
+ #6 0x00007ffff72957f5 in __snprintf_chk () at /lib64/libc.so.6
+ #7 0x0000555555b1c1fd in pcibus_get_fw_dev_path ()
+ #8 0x0000555555f2bde4 in qdev_get_fw_dev_path_helper.constprop ()
+ #9 0x0000555555f2bd86 in qdev_get_fw_dev_path_helper.constprop ()
+ #10 0x00005555559a6e5d in get_boot_device_path ()
+ #11 0x00005555559a712c in get_boot_devices_list ()
+ #12 0x0000555555b1a3d0 in fw_cfg_machine_reset ()
+ #13 0x0000555555bf4c2d in pc_machine_reset ()
+ #14 0x0000555555c66988 in qemu_system_reset ()
+ #15 0x0000555555a6dff6 in qdev_machine_creation_done ()
+ #16 0x0000555555c79186 in qmp_x_exit_preconfig.part ()
+ #17 0x0000555555c7b459 in qemu_init ()
+ #18 0x0000555555960a29 in main ()
+
+Found-by: Dario Faggioli <Dario Faggioli <dfaggioli@suse.com>
+Found-by: Martin Liška <martin.liska@suse.com>
+Cc: qemu-stable@nongnu.org
+Signed-off-by: Claudio Fontana <cfontana@suse.de>
+--- a/hw/pci/pci.c
++++ b/hw/pci/pci.c
+@@ -2640,15 +2640,15 @@ static char *pci_dev_fw_name(DeviceState *dev, char *buf, int len)
+ static char *pcibus_get_fw_dev_path(DeviceState *dev)
+ {
+ PCIDevice *d = (PCIDevice *)dev;
+- char path[50], name[33];
+- int off;
+-
+- off = snprintf(path, sizeof(path), "%s@%x",
+- pci_dev_fw_name(dev, name, sizeof name),
+- PCI_SLOT(d->devfn));
+- if (PCI_FUNC(d->devfn))
+- snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn));
+- return g_strdup(path);
++ char name[33];
++ int has_func = !!PCI_FUNC(d->devfn);
++
++ return g_strdup_printf("%s@%x%s%.*x",
++ pci_dev_fw_name(dev, name, sizeof(name)),
++ PCI_SLOT(d->devfn),
++ has_func ? "," : "",
++ has_func,
++ PCI_FUNC(d->devfn));
+ }
+
+ static char *pcibus_get_dev_path(DeviceState *dev)
diff --git a/app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch b/app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch
new file mode 100644
index 000000000000..9ec6ede80896
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-7.0.0-virtio-scsi-fixes.patch
@@ -0,0 +1,182 @@
+https://bugs.gentoo.org/849500
+https://gitlab.com/qemu-project/qemu/-/commit/2f743ef6366c2df4ef51ef3ae318138cdc0125ab.patch
+https://gitlab.com/qemu-project/qemu/-/commit/38738f7dbbda90fbc161757b7f4be35b52205552.patch
+
+From: Stefan Hajnoczi <stefanha@redhat.com>
+Date: Wed, 27 Apr 2022 15:35:36 +0100
+Subject: [PATCH] virtio-scsi: fix ctrl and event handler functions in
+ dataplane mode
+
+Commit f34e8d8b8d48d73f36a67b6d5e492ef9784b5012 ("virtio-scsi: prepare
+virtio_scsi_handle_cmd for dataplane") prepared the virtio-scsi cmd
+virtqueue handler function to be used in both the dataplane and
+non-datpalane code paths.
+
+It failed to convert the ctrl and event virtqueue handler functions,
+which are not designed to be called from the dataplane code path but
+will be since the ioeventfd is set up for those virtqueues when
+dataplane starts.
+
+Convert the ctrl and event virtqueue handler functions now so they
+operate correctly when called from the dataplane code path. Avoid code
+duplication by extracting this code into a helper function.
+
+Fixes: f34e8d8b8d48d73f36a67b6d5e492ef9784b5012 ("virtio-scsi: prepare virtio_scsi_handle_cmd for dataplane")
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
+Message-id: 20220427143541.119567-2-stefanha@redhat.com
+[Fixed s/by used/be used/ typo pointed out by Michael Tokarev
+<mjt@tls.msk.ru>.
+--Stefan]
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+--- a/hw/scsi/virtio-scsi.c
++++ b/hw/scsi/virtio-scsi.c
+@@ -472,16 +472,32 @@ bool virtio_scsi_handle_ctrl_vq(VirtIOSCSI *s, VirtQueue *vq)
+ return progress;
+ }
+
++/*
++ * If dataplane is configured but not yet started, do so now and return true on
++ * success.
++ *
++ * Dataplane is started by the core virtio code but virtqueue handler functions
++ * can also be invoked when a guest kicks before DRIVER_OK, so this helper
++ * function helps us deal with manually starting ioeventfd in that case.
++ */
++static bool virtio_scsi_defer_to_dataplane(VirtIOSCSI *s)
++{
++ if (!s->ctx || s->dataplane_started) {
++ return false;
++ }
++
++ virtio_device_start_ioeventfd(&s->parent_obj.parent_obj);
++ return !s->dataplane_fenced;
++}
++
+ static void virtio_scsi_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
+ {
+ VirtIOSCSI *s = (VirtIOSCSI *)vdev;
+
+- if (s->ctx) {
+- virtio_device_start_ioeventfd(vdev);
+- if (!s->dataplane_fenced) {
+- return;
+- }
++ if (virtio_scsi_defer_to_dataplane(s)) {
++ return;
+ }
++
+ virtio_scsi_acquire(s);
+ virtio_scsi_handle_ctrl_vq(s, vq);
+ virtio_scsi_release(s);
+@@ -720,12 +736,10 @@ static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq)
+ /* use non-QOM casts in the data path */
+ VirtIOSCSI *s = (VirtIOSCSI *)vdev;
+
+- if (s->ctx && !s->dataplane_started) {
+- virtio_device_start_ioeventfd(vdev);
+- if (!s->dataplane_fenced) {
+- return;
+- }
++ if (virtio_scsi_defer_to_dataplane(s)) {
++ return;
+ }
++
+ virtio_scsi_acquire(s);
+ virtio_scsi_handle_cmd_vq(s, vq);
+ virtio_scsi_release(s);
+@@ -855,12 +869,10 @@ static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)
+ {
+ VirtIOSCSI *s = VIRTIO_SCSI(vdev);
+
+- if (s->ctx) {
+- virtio_device_start_ioeventfd(vdev);
+- if (!s->dataplane_fenced) {
+- return;
+- }
++ if (virtio_scsi_defer_to_dataplane(s)) {
++ return;
+ }
++
+ virtio_scsi_acquire(s);
+ virtio_scsi_handle_event_vq(s, vq);
+ virtio_scsi_release(s);
+GitLab
+
+From: Stefan Hajnoczi <stefanha@redhat.com>
+Date: Wed, 27 Apr 2022 15:35:37 +0100
+Subject: [PATCH] virtio-scsi: don't waste CPU polling the event virtqueue
+
+The virtio-scsi event virtqueue is not emptied by its handler function.
+This is typical for rx virtqueues where the device uses buffers when
+some event occurs (e.g. a packet is received, an error condition
+happens, etc).
+
+Polling non-empty virtqueues wastes CPU cycles. We are not waiting for
+new buffers to become available, we are waiting for an event to occur,
+so it's a misuse of CPU resources to poll for buffers.
+
+Introduce the new virtio_queue_aio_attach_host_notifier_no_poll() API,
+which is identical to virtio_queue_aio_attach_host_notifier() except
+that it does not poll the virtqueue.
+
+Before this patch the following command-line consumed 100% CPU in the
+IOThread polling and calling virtio_scsi_handle_event():
+
+ $ qemu-system-x86_64 -M accel=kvm -m 1G -cpu host \
+ --object iothread,id=iothread0 \
+ --device virtio-scsi-pci,iothread=iothread0 \
+ --blockdev file,filename=test.img,aio=native,cache.direct=on,node-name=drive0 \
+ --device scsi-hd,drive=drive0
+
+After this patch CPU is no longer wasted.
+
+Reported-by: Nir Soffer <nsoffer@redhat.com>
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+Tested-by: Nir Soffer <nsoffer@redhat.com>
+Message-id: 20220427143541.119567-3-stefanha@redhat.com
+Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
+--- a/hw/scsi/virtio-scsi-dataplane.c
++++ b/hw/scsi/virtio-scsi-dataplane.c
+@@ -138,7 +138,7 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev)
+
+ aio_context_acquire(s->ctx);
+ virtio_queue_aio_attach_host_notifier(vs->ctrl_vq, s->ctx);
+- virtio_queue_aio_attach_host_notifier(vs->event_vq, s->ctx);
++ virtio_queue_aio_attach_host_notifier_no_poll(vs->event_vq, s->ctx);
+
+ for (i = 0; i < vs->conf.num_queues; i++) {
+ virtio_queue_aio_attach_host_notifier(vs->cmd_vqs[i], s->ctx);
+--- a/hw/virtio/virtio.c
++++ b/hw/virtio/virtio.c
+@@ -3534,6 +3534,19 @@ void virtio_queue_aio_attach_host_notifier(VirtQueue *vq, AioContext *ctx)
+ virtio_queue_host_notifier_aio_poll_end);
+ }
+
++/*
++ * Same as virtio_queue_aio_attach_host_notifier() but without polling. Use
++ * this for rx virtqueues and similar cases where the virtqueue handler
++ * function does not pop all elements. When the virtqueue is left non-empty
++ * polling consumes CPU cycles and should not be used.
++ */
++void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioContext *ctx)
++{
++ aio_set_event_notifier(ctx, &vq->host_notifier, true,
++ virtio_queue_host_notifier_read,
++ NULL, NULL);
++}
++
+ void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx)
+ {
+ aio_set_event_notifier(ctx, &vq->host_notifier, true, NULL, NULL, NULL);
+--- a/include/hw/virtio/virtio.h
++++ b/include/hw/virtio/virtio.h
+@@ -317,6 +317,7 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq);
+ void virtio_queue_set_host_notifier_enabled(VirtQueue *vq, bool enabled);
+ void virtio_queue_host_notifier_read(EventNotifier *n);
+ void virtio_queue_aio_attach_host_notifier(VirtQueue *vq, AioContext *ctx);
++void virtio_queue_aio_attach_host_notifier_no_poll(VirtQueue *vq, AioContext *ctx);
+ void virtio_queue_aio_detach_host_notifier(VirtQueue *vq, AioContext *ctx);
+ VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector);
+ VirtQueue *virtio_vector_next_queue(VirtQueue *vq);
+GitLab
diff --git a/app-emulation/qemu/metadata.xml b/app-emulation/qemu/metadata.xml
index 380994d16817..5fbcd7706e9c 100644
--- a/app-emulation/qemu/metadata.xml
+++ b/app-emulation/qemu/metadata.xml
@@ -72,7 +72,5 @@
<flag name="xattr">Add support for getting and setting POSIX extended attributes, through
<pkg>sys-apps/attr</pkg>. Requisite for the virtfs backend.</flag>
<flag name="xen">Enables support for Xen backends</flag>
- <flag name="xfs">Support xfsctl() notification and syncing for XFS backed
- virtual disks.</flag>
</use>
</pkgmetadata>
diff --git a/app-emulation/qemu/qemu-6.2.0-r3.ebuild b/app-emulation/qemu/qemu-6.2.0-r3.ebuild
deleted file mode 100644
index db762f299003..000000000000
--- a/app-emulation/qemu/qemu-6.2.0-r3.ebuild
+++ /dev/null
@@ -1,924 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{8,9,10} )
-PYTHON_REQ_USE="ncurses,readline"
-
-FIRMWARE_ABI_VERSION="6.2.0"
-
-inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
- pax-utils xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- meson
- tests/fp/berkeley-softfloat-3
- tests/fp/berkeley-testfloat-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bpf bzip2 capstone +caps +curl debug +doc
- +fdt fuse glusterfs +gnutls gtk infiniband iscsi io-uring
- jack jemalloc +jpeg
- lzo multipath
- ncurses nfs nls numa opengl +oss pam +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- +slirp
- smartcard snappy spice ssh static static-user systemtap test udev usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs zstd"
-
-COMMON_TARGETS="
- aarch64
- alpha
- arm
- cris
- hppa
- i386
- m68k
- microblaze
- microblazeel
- mips
- mips64
- mips64el
- mipsel
- nios2
- or1k
- ppc
- ppc64
- riscv32
- riscv64
- s390x
- sh4
- sh4eb
- sparc
- sparc64
- x86_64
- xtensa
- xtensaeb
-"
-IUSE_SOFTMMU_TARGETS="
- ${COMMON_TARGETS}
- avr
- rx
- tricore
-"
-IUSE_USER_TARGETS="
- ${COMMON_TARGETS}
- aarch64_be
- armeb
- hexagon
- mipsn32
- mipsn32el
- ppc64abi32
- ppc64le
- sparc32plus
-"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- qemu_softmmu_targets_x86_64? ( fdt )
- sdl-image? ( sdl )
- static? ( static-user !alsa !gtk !jack !opengl !pam !pulseaudio !plugins !rbd !snappy !udev )
- static-user? ( !plugins )
- vhost-user-fs? ( caps seccomp )
- virgl? ( opengl )
- virtfs? ( caps xattr )
- vnc? ( gnutls )
- vte? ( gtk )
- multipath? ( udev )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bpf? ( dev-libs/libbpf:= )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? ( sys-cluster/rdma-core[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- io-uring? ( sys-libs/liburing:=[static-libs(+)] )
- jack? ( virtual/jack )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- multipath? ( sys-fs/multipath-tools )
- ncurses? (
- sys-libs/ncurses:=[unicode(+)]
- sys-libs/ncurses:=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl(+),gbm(+)]
- )
- pam? ( sys-libs/pam )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[video]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- slirp? ( net-libs/libslirp[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )
- zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
-"
-
-EDK2_OVMF_VERSION="202105"
-SEABIOS_VERSION="1.14.0"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary]
- ~sys-firmware/ipxe-1.21.1[binary,qemu]
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre10[binary]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
- sys-firmware/ipxe[qemu]
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- sys-firmware/sgabios
- )"
-PPC_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? (
- dev-python/sphinx[${PYTHON_USEDEP}]
- dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
- )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? (
- sec-policy/selinux-qemu
- sys-libs/libselinux
- )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
- "${FILESDIR}"/${PN}-6.1.0-strings.patch
- "${FILESDIR}"/${PN}-6.2.0-user-SLIC-crash.patch
- "${FILESDIR}"/${PN}-6.2.0-also-build-virtfs-proxy-helper.patch
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
- usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32
-"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/configs/targets/ >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --localstatedir=/var
- --disable-bsd-user
- --disable-containers # bug #732972
- --disable-guest-agent
- --disable-strip
- --with-git-submodules=ignore
-
- # bug #746752: TCG interpreter has a few limitations:
- # - it does not support FPU
- # - it's generally slower on non-self-modifying code
- # It's advantage is support for host architectures
- # where native codegeneration is not implemented.
- # Gentoo has qemu keyworded only on targets with
- # native code generation available. Avoid the interpreter.
- --disable-tcg-interpreter
-
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable alsa)
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable jack)
- $(use_enable nls gettext)
- $(use_enable oss)
- $(use_enable plugins)
- $(use_enable pulseaudio pa)
- $(use_enable selinux)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- # Enable option only for softmmu build, but not 'user' or 'tools'
- conf_softmmu() {
- if [[ ${buildtype} == "softmmu" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Enable option only for tools build, but not 'user' or 'softmmu'
- conf_tools() {
- if [[ ${buildtype} == "tools" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Special case for the malloc flag, because the --disable flag does
- # not exist and trying like above will break configuring.
- conf_malloc() {
- if [[ ! ${buildtype} == "user" ]] ; then
- usex "${1}" "--enable-malloc=${1}" ""
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_softmmu bpf)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_tools doc docs)
- $(conf_notuser fdt)
- $(conf_notuser fuse)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser io-uring linux-io-uring)
- $(conf_malloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser multipath mpath)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser pam auth-pam)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_softmmu sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser slirp slirp system)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser udev libudev)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_tools vhost-user-fs virtiofsd)
- $(conf_notuser virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- # use prebuilt keymaps, bug #759604
- --disable-xkbcommon
- $(conf_notuser zstd)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- # Note: backend order matters here: #716202
- # We iterate from higher-level to lower level.
- $(usex pulseaudio pa "")
- $(usev jack)
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list=$(IFS=,; echo "${audio_opts[*]}")
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- # Meson will not use a cross-file unless cross_prefix is set.
- tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
-
- # Plumb through equivalent of EXTRA_ECONF to allow experiments
- # like bug #747928.
- conf_opts+=( ${EXTRA_CONF_QEMU} )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC/PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
diff --git a/app-emulation/qemu/qemu-6.2.0-r4.ebuild b/app-emulation/qemu/qemu-6.2.0-r4.ebuild
deleted file mode 100644
index e981bb09adc5..000000000000
--- a/app-emulation/qemu/qemu-6.2.0-r4.ebuild
+++ /dev/null
@@ -1,925 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-PYTHON_COMPAT=( python3_{8,9,10} )
-PYTHON_REQ_USE="ncurses,readline"
-
-FIRMWARE_ABI_VERSION="6.2.0"
-
-inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
- pax-utils xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- meson
- tests/fp/berkeley-softfloat-3
- tests/fp/berkeley-testfloat-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bpf bzip2 capstone +caps +curl debug +doc
- +fdt fuse glusterfs +gnutls gtk infiniband iscsi io-uring
- jack jemalloc +jpeg
- lzo multipath
- ncurses nfs nls numa opengl +oss pam +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- +slirp
- smartcard snappy spice ssh static static-user systemtap test udev usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs zstd"
-
-COMMON_TARGETS="
- aarch64
- alpha
- arm
- cris
- hppa
- i386
- m68k
- microblaze
- microblazeel
- mips
- mips64
- mips64el
- mipsel
- nios2
- or1k
- ppc
- ppc64
- riscv32
- riscv64
- s390x
- sh4
- sh4eb
- sparc
- sparc64
- x86_64
- xtensa
- xtensaeb
-"
-IUSE_SOFTMMU_TARGETS="
- ${COMMON_TARGETS}
- avr
- rx
- tricore
-"
-IUSE_USER_TARGETS="
- ${COMMON_TARGETS}
- aarch64_be
- armeb
- hexagon
- mipsn32
- mipsn32el
- ppc64abi32
- ppc64le
- sparc32plus
-"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- qemu_softmmu_targets_x86_64? ( fdt )
- sdl-image? ( sdl )
- static? ( static-user !alsa !gtk !jack !opengl !pam !pulseaudio !plugins !rbd !snappy !udev )
- static-user? ( !plugins )
- vhost-user-fs? ( caps seccomp )
- virgl? ( opengl )
- virtfs? ( caps xattr )
- vnc? ( gnutls )
- vte? ( gtk )
- multipath? ( udev )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bpf? ( dev-libs/libbpf:= )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? ( sys-cluster/rdma-core[static-libs(+)] )
- iscsi? ( net-libs/libiscsi )
- io-uring? ( sys-libs/liburing:=[static-libs(+)] )
- jack? ( virtual/jack )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- multipath? ( sys-fs/multipath-tools )
- ncurses? (
- sys-libs/ncurses:=[unicode(+)]
- sys-libs/ncurses:=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl(+),gbm(+)]
- )
- pam? ( sys-libs/pam )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[video]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- slirp? ( net-libs/libslirp[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )
- zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
-"
-
-EDK2_OVMF_VERSION="202105"
-SEABIOS_VERSION="1.14.0"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary]
- ~sys-firmware/ipxe-1.21.1[binary,qemu]
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre10[binary]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
- sys-firmware/ipxe[qemu]
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- sys-firmware/sgabios
- )"
-PPC_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? (
- dev-python/sphinx[${PYTHON_USEDEP}]
- dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
- )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? (
- sec-policy/selinux-qemu
- sys-libs/libselinux
- )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
- "${FILESDIR}"/${PN}-6.1.0-strings.patch
- "${FILESDIR}"/${PN}-6.2.0-user-SLIC-crash.patch
- "${FILESDIR}"/${PN}-6.2.0-also-build-virtfs-proxy-helper.patch
- "${FILESDIR}"/${PN}-6.2.0-glibc-2.35-rseq-seccomp-virtiofsd.patch
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
- usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32
-"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/configs/targets/ >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --localstatedir=/var
- --disable-bsd-user
- --disable-containers # bug #732972
- --disable-guest-agent
- --disable-strip
- --with-git-submodules=ignore
-
- # bug #746752: TCG interpreter has a few limitations:
- # - it does not support FPU
- # - it's generally slower on non-self-modifying code
- # It's advantage is support for host architectures
- # where native codegeneration is not implemented.
- # Gentoo has qemu keyworded only on targets with
- # native code generation available. Avoid the interpreter.
- --disable-tcg-interpreter
-
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable alsa)
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable jack)
- $(use_enable nls gettext)
- $(use_enable oss)
- $(use_enable plugins)
- $(use_enable pulseaudio pa)
- $(use_enable selinux)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- # Enable option only for softmmu build, but not 'user' or 'tools'
- conf_softmmu() {
- if [[ ${buildtype} == "softmmu" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Enable option only for tools build, but not 'user' or 'softmmu'
- conf_tools() {
- if [[ ${buildtype} == "tools" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Special case for the malloc flag, because the --disable flag does
- # not exist and trying like above will break configuring.
- conf_malloc() {
- if [[ ! ${buildtype} == "user" ]] ; then
- usex "${1}" "--enable-malloc=${1}" ""
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_softmmu bpf)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_tools doc docs)
- $(conf_notuser fdt)
- $(conf_notuser fuse)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser io-uring linux-io-uring)
- $(conf_malloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser multipath mpath)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser pam auth-pam)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_softmmu sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser slirp slirp system)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser udev libudev)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_tools vhost-user-fs virtiofsd)
- $(conf_notuser virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- # use prebuilt keymaps, bug #759604
- --disable-xkbcommon
- $(conf_notuser zstd)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- # Note: backend order matters here: #716202
- # We iterate from higher-level to lower level.
- $(usex pulseaudio pa "")
- $(usev jack)
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list=$(IFS=,; echo "${audio_opts[*]}")
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- # Meson will not use a cross-file unless cross_prefix is set.
- tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
-
- # Plumb through equivalent of EXTRA_ECONF to allow experiments
- # like bug #747928.
- conf_opts+=( ${EXTRA_CONF_QEMU} )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC/PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
diff --git a/app-emulation/qemu/qemu-6.2.0.ebuild b/app-emulation/qemu/qemu-6.2.0.ebuild
deleted file mode 100644
index 6706d55c77fc..000000000000
--- a/app-emulation/qemu/qemu-6.2.0.ebuild
+++ /dev/null
@@ -1,913 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{8,9,10} )
-PYTHON_REQ_USE="ncurses,readline"
-
-FIRMWARE_ABI_VERSION="6.2.0"
-
-inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
- pax-utils xdg-utils
-
-if [[ ${PV} = *9999* ]]; then
- EGIT_REPO_URI="https://git.qemu.org/git/qemu.git"
- EGIT_SUBMODULES=(
- meson
- tests/fp/berkeley-softfloat-3
- tests/fp/berkeley-testfloat-3
- ui/keycodemapdb
- )
- inherit git-r3
- SRC_URI=""
-else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="amd64 arm64 ~ppc ppc64 x86"
-fi
-
-DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-HOMEPAGE="https://www.qemu.org https://www.linux-kvm.org"
-
-LICENSE="GPL-2 LGPL-2 BSD-2"
-SLOT="0"
-
-IUSE="accessibility +aio alsa bpf bzip2 capstone +caps +curl debug +doc
- +fdt fuse glusterfs +gnutls gtk infiniband iscsi io-uring
- jack jemalloc +jpeg
- lzo multipath
- ncurses nfs nls numa opengl +oss +pin-upstream-blobs
- plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
- +slirp
- smartcard snappy spice ssh static static-user systemtap test udev usb
- usbredir vde +vhost-net vhost-user-fs virgl virtfs +vnc vte xattr xen
- xfs zstd"
-
-COMMON_TARGETS="
- aarch64
- alpha
- arm
- cris
- hppa
- i386
- m68k
- microblaze
- microblazeel
- mips
- mips64
- mips64el
- mipsel
- nios2
- or1k
- ppc
- ppc64
- riscv32
- riscv64
- s390x
- sh4
- sh4eb
- sparc
- sparc64
- x86_64
- xtensa
- xtensaeb
-"
-IUSE_SOFTMMU_TARGETS="
- ${COMMON_TARGETS}
- avr
- rx
- tricore
-"
-IUSE_USER_TARGETS="
- ${COMMON_TARGETS}
- aarch64_be
- armeb
- hexagon
- mipsn32
- mipsn32el
- ppc64abi32
- ppc64le
- sparc32plus
-"
-
-use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
-use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
-IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
-
-RESTRICT="!test? ( test )"
-# Allow no targets to be built so that people can get a tools-only build.
-# Block USE flag configurations known to not work.
-REQUIRED_USE="${PYTHON_REQUIRED_USE}
- qemu_softmmu_targets_arm? ( fdt )
- qemu_softmmu_targets_microblaze? ( fdt )
- qemu_softmmu_targets_mips64el? ( fdt )
- qemu_softmmu_targets_ppc64? ( fdt )
- qemu_softmmu_targets_ppc? ( fdt )
- qemu_softmmu_targets_riscv32? ( fdt )
- qemu_softmmu_targets_riscv64? ( fdt )
- qemu_softmmu_targets_x86_64? ( fdt )
- sdl-image? ( sdl )
- static? ( static-user !alsa !gtk !jack !opengl !pulseaudio !plugins !rbd !snappy !udev )
- static-user? ( !plugins )
- vhost-user-fs? ( caps seccomp )
- virgl? ( opengl )
- virtfs? ( caps xattr )
- vnc? ( gnutls )
- vte? ( gtk )
- multipath? ( udev )
- plugins? ( !static !static-user )
-"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# and user/softmmu targets (qemu-*, qemu-system-*).
-#
-# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
-#
-# The attr lib isn't always linked in (although the USE flag is always
-# respected). This is because qemu supports using the C library's API
-# when available rather than always using the external library.
-ALL_DEPEND="
- >=dev-libs/glib-2.0[static-libs(+)]
- sys-libs/zlib[static-libs(+)]
- python? ( ${PYTHON_DEPS} )
- systemtap? ( dev-util/systemtap )
- xattr? ( sys-apps/attr[static-libs(+)] )"
-
-# Dependencies required for qemu tools (qemu-nbd, qemu-img, qemu-io, ...)
-# softmmu targets (qemu-system-*).
-SOFTMMU_TOOLS_DEPEND="
- dev-libs/libxml2[static-libs(+)]
- >=x11-libs/pixman-0.28.0[static-libs(+)]
- accessibility? (
- app-accessibility/brltty[api]
- app-accessibility/brltty[static-libs(+)]
- )
- aio? ( dev-libs/libaio[static-libs(+)] )
- alsa? ( >=media-libs/alsa-lib-1.0.13 )
- bpf? ( dev-libs/libbpf:= )
- bzip2? ( app-arch/bzip2[static-libs(+)] )
- capstone? ( dev-libs/capstone:= )
- caps? ( sys-libs/libcap-ng[static-libs(+)] )
- curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
- fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
- glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
- gnutls? (
- dev-libs/nettle:=[static-libs(+)]
- >=net-libs/gnutls-3.0:=[static-libs(+)]
- )
- gtk? (
- x11-libs/gtk+:3
- vte? ( x11-libs/vte:2.91 )
- )
- infiniband? (
- sys-cluster/rdma-core[static-libs(+)]
- )
- iscsi? ( net-libs/libiscsi )
- io-uring? ( sys-libs/liburing:=[static-libs(+)] )
- jack? ( virtual/jack )
- jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
- lzo? ( dev-libs/lzo:2[static-libs(+)] )
- multipath? ( sys-fs/multipath-tools )
- ncurses? (
- sys-libs/ncurses:=[unicode(+)]
- sys-libs/ncurses:=[static-libs(+)]
- )
- nfs? ( >=net-fs/libnfs-1.9.3:=[static-libs(+)] )
- numa? ( sys-process/numactl[static-libs(+)] )
- opengl? (
- virtual/opengl
- media-libs/libepoxy[static-libs(+)]
- media-libs/mesa[static-libs(+)]
- media-libs/mesa[egl(+),gbm(+)]
- )
- png? ( media-libs/libpng:0=[static-libs(+)] )
- pulseaudio? ( media-sound/pulseaudio )
- rbd? ( sys-cluster/ceph )
- sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
- sdl? (
- media-libs/libsdl2[video]
- media-libs/libsdl2[static-libs(+)]
- )
- sdl-image? ( media-libs/sdl2-image[static-libs(+)] )
- seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
- slirp? ( net-libs/libslirp[static-libs(+)] )
- smartcard? ( >=app-emulation/libcacard-2.5.0[static-libs(+)] )
- snappy? ( app-arch/snappy:= )
- spice? (
- >=app-emulation/spice-protocol-0.12.3
- >=app-emulation/spice-0.12.0[static-libs(+)]
- )
- ssh? ( >=net-libs/libssh-0.8.6[static-libs(+)] )
- udev? ( virtual/libudev:= )
- usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
- usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
- vde? ( net-misc/vde[static-libs(+)] )
- virgl? ( media-libs/virglrenderer[static-libs(+)] )
- virtfs? ( sys-libs/libcap )
- xen? ( app-emulation/xen-tools:= )
- xfs? ( sys-fs/xfsprogs[static-libs(+)] )
- zstd? ( >=app-arch/zstd-1.4.0[static-libs(+)] )
-"
-
-EDK2_OVMF_VERSION="202105"
-SEABIOS_VERSION="1.14.0"
-
-X86_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}[binary]
- ~sys-firmware/ipxe-1.21.1[binary,qemu]
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- ~sys-firmware/sgabios-0.1_pre10[binary]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/edk2-ovmf-${EDK2_OVMF_VERSION}
- sys-firmware/ipxe[qemu]
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- sys-firmware/sgabios
- )"
-PPC_FIRMWARE_DEPEND="
- pin-upstream-blobs? (
- ~sys-firmware/seabios-${SEABIOS_VERSION}[binary,seavgabios]
- )
- !pin-upstream-blobs? (
- >=sys-firmware/seabios-${SEABIOS_VERSION}[seavgabios]
- )
-"
-
-BDEPEND="
- $(python_gen_impl_dep)
- dev-lang/perl
- sys-apps/texinfo
- virtual/pkgconfig
- doc? (
- dev-python/sphinx[${PYTHON_USEDEP}]
- dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
- )
- gtk? ( nls? ( sys-devel/gettext ) )
- test? (
- dev-libs/glib[utils]
- sys-devel/bc
- )
-"
-CDEPEND="
- !static? (
- ${ALL_DEPEND//\[static-libs(+)]}
- ${SOFTMMU_TOOLS_DEPEND//\[static-libs(+)]}
- )
- qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc? ( ${PPC_FIRMWARE_DEPEND} )
- qemu_softmmu_targets_ppc64? ( ${PPC_FIRMWARE_DEPEND} )
-"
-DEPEND="${CDEPEND}
- kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
- static? (
- ${ALL_DEPEND}
- ${SOFTMMU_TOOLS_DEPEND}
- )
- static-user? ( ${ALL_DEPEND} )"
-RDEPEND="${CDEPEND}
- acct-group/kvm
- selinux? ( sec-policy/selinux-qemu )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-2.11.1-capstone_include_path.patch
- "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
- "${FILESDIR}"/${PN}-6.0.0-make.patch
- "${FILESDIR}"/${PN}-6.1.0-strings.patch
-)
-
-QA_PREBUILT="
- usr/share/qemu/hppa-firmware.img
- usr/share/qemu/openbios-ppc
- usr/share/qemu/openbios-sparc64
- usr/share/qemu/openbios-sparc32
- usr/share/qemu/opensbi-riscv64-generic-fw_dynamic.elf
- usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.elf
- usr/share/qemu/palcode-clipper
- usr/share/qemu/s390-ccw.img
- usr/share/qemu/s390-netboot.img
- usr/share/qemu/u-boot.e500
-"
-
-QA_WX_LOAD="usr/bin/qemu-i386
- usr/bin/qemu-x86_64
- usr/bin/qemu-alpha
- usr/bin/qemu-arm
- usr/bin/qemu-cris
- usr/bin/qemu-m68k
- usr/bin/qemu-microblaze
- usr/bin/qemu-microblazeel
- usr/bin/qemu-mips
- usr/bin/qemu-mipsel
- usr/bin/qemu-or1k
- usr/bin/qemu-ppc
- usr/bin/qemu-ppc64
- usr/bin/qemu-ppc64abi32
- usr/bin/qemu-sh4
- usr/bin/qemu-sh4eb
- usr/bin/qemu-sparc
- usr/bin/qemu-sparc64
- usr/bin/qemu-armeb
- usr/bin/qemu-sparc32plus
- usr/bin/qemu-s390x
- usr/bin/qemu-unicore32
-"
-
-DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure you have the
-kernel module loaded before running kvm. The easiest way to ensure that the
-kernel module is loaded is to load it on boot.
- For AMD CPUs the module is called 'kvm-amd'.
- For Intel CPUs the module is called 'kvm-intel'.
-Please review /etc/conf.d/modules for how to load these.
-
-Make sure your user is in the 'kvm' group. Just run
- $ gpasswd -a <USER> kvm
-then have <USER> re-login.
-
-For brand new installs, the default permissions on /dev/kvm might not let
-you access it. You can tell udev to reset ownership/perms:
- $ udevadm trigger -c add /dev/kvm
-
-If you want to register binfmt handlers for qemu user targets:
-For openrc:
- # rc-update add qemu-binfmt
-For systemd:
- # ln -s /usr/share/qemu/binfmt.d/qemu.conf /etc/binfmt.d/qemu.conf"
-
-pkg_pretend() {
- if use kernel_linux && kernel_is lt 2 6 25; then
- eerror "This version of KVM requires a host kernel of 2.6.25 or higher."
- elif use kernel_linux; then
- if ! linux_config_exists; then
- eerror "Unable to check your kernel for KVM support"
- else
- CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
- ERROR_KVM="You must enable KVM in your kernel to continue"
- ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
- ERROR_KVM_AMD+=" your kernel configuration."
- ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
- ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
- ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
- ERROR_TUN+=" into your kernel or loaded as a module to use the"
- ERROR_TUN+=" virtual network device if using -net tap."
- ERROR_BRIDGE="You will also need support for 802.1d"
- ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
- use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
- ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
- ERROR_VHOST_NET+=" support"
-
- if use amd64 || use x86 || use amd64-linux || use x86-linux; then
- if grep -q AuthenticAMD /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_AMD"
- elif grep -q GenuineIntel /proc/cpuinfo; then
- CONFIG_CHECK+=" ~KVM_INTEL"
- fi
- fi
-
- use python && CONFIG_CHECK+=" ~DEBUG_FS"
- ERROR_DEBUG_FS="debugFS support required for kvm_stat"
-
- # Now do the actual checks setup above
- check_extra_config
- fi
- fi
-
- if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
- eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
- eerror "instances are still pointing to it. Please update your"
- eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
- eerror "and the right system binary (e.g. qemu-system-x86_64)."
- die "update your virt configs to not use qemu-kvm"
- fi
-}
-
-# Sanity check to make sure target lists are kept up-to-date.
-check_targets() {
- local var=$1 mak=$2
- local detected sorted
-
- pushd "${S}"/configs/targets/ >/dev/null || die
-
- # Force C locale until glibc is updated. #564936
- detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
- sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
- if [[ ${sorted} != "${detected}" ]] ; then
- eerror "The ebuild needs to be kept in sync."
- eerror "${var}: ${sorted}"
- eerror "$(printf '%-*s' ${#var} configure): ${detected}"
- die "sync ${var} to the list of targets"
- fi
-
- popd >/dev/null
-}
-
-src_prepare() {
- check_targets IUSE_SOFTMMU_TARGETS softmmu
- check_targets IUSE_USER_TARGETS linux-user
-
- default
-
- # Use correct toolchain to fix cross-compiling
- tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS
- export WINDRES=${CHOST}-windres
-
- # Verbose builds
- MAKEOPTS+=" V=1"
-
- # Remove bundled copy of libfdt
- rm -r dtc || die
-}
-
-##
-# configures qemu based on the build directory and the build type
-# we are using.
-#
-qemu_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- local buildtype=$1
- local builddir="${S}/${buildtype}-build"
-
- mkdir "${builddir}"
-
- local conf_opts=(
- --prefix=/usr
- --sysconfdir=/etc
- --bindir=/usr/bin
- --libdir=/usr/$(get_libdir)
- --datadir=/usr/share
- --docdir=/usr/share/doc/${PF}/html
- --mandir=/usr/share/man
- --localstatedir=/var
- --disable-bsd-user
- --disable-containers # bug #732972
- --disable-guest-agent
- --disable-strip
-
- # bug #746752: TCG interpreter has a few limitations:
- # - it does not support FPU
- # - it's generally slower on non-self-modifying code
- # It's advantage is support for host architectures
- # where native codegeneration is not implemented.
- # Gentoo has qemu keyworded only on targets with
- # native code generation available. Avoid the interpreter.
- --disable-tcg-interpreter
-
- --disable-werror
- # We support gnutls/nettle for crypto operations. It is possible
- # to use gcrypt when gnutls/nettle are disabled (but not when they
- # are enabled), but it's not really worth the hassle. Disable it
- # all the time to avoid automatically detecting it. #568856
- --disable-gcrypt
- --python="${PYTHON}"
- --cc="$(tc-getCC)"
- --cxx="$(tc-getCXX)"
- --host-cc="$(tc-getBUILD_CC)"
- $(use_enable debug debug-info)
- $(use_enable debug debug-tcg)
- $(use_enable doc docs)
- $(use_enable nls gettext)
- $(use_enable plugins)
- $(use_enable xattr attr)
- )
-
- # Disable options not used by user targets. This simplifies building
- # static user targets (USE=static-user) considerably.
- conf_notuser() {
- if [[ ${buildtype} == "user" ]] ; then
- echo "--disable-${2:-$1}"
- else
- use_enable "$@"
- fi
- }
- # Enable option only for softmmu build, but not 'user' or 'tools'
- conf_softmmu() {
- if [[ ${buildtype} == "softmmu" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Enable option only for tools build, but not 'user' or 'softmmu'
- conf_tools() {
- if [[ ${buildtype} == "tools" ]] ; then
- use_enable "$@"
- else
- echo "--disable-${2:-$1}"
- fi
- }
- # Special case for the malloc flag, because the --disable flag does
- # not exist and trying like above will break configuring.
- conf_malloc() {
- if [[ ! ${buildtype} == "user" ]] ; then
- usex "${1}" "--enable-malloc=${1}" ""
- fi
- }
- conf_opts+=(
- $(conf_notuser accessibility brlapi)
- $(conf_notuser aio linux-aio)
- $(conf_softmmu bpf)
- $(conf_notuser bzip2)
- $(conf_notuser capstone)
- $(conf_notuser caps cap-ng)
- $(conf_notuser curl)
- $(conf_notuser fdt)
- $(conf_notuser fuse)
- $(conf_notuser glusterfs)
- $(conf_notuser gnutls)
- $(conf_notuser gnutls nettle)
- $(conf_notuser gtk)
- $(conf_notuser infiniband rdma)
- $(conf_notuser iscsi libiscsi)
- $(conf_notuser io-uring linux-io-uring)
- $(conf_malloc jemalloc)
- $(conf_notuser jpeg vnc-jpeg)
- $(conf_notuser kernel_linux kvm)
- $(conf_notuser lzo)
- $(conf_notuser multipath mpath)
- $(conf_notuser ncurses curses)
- $(conf_notuser nfs libnfs)
- $(conf_notuser numa)
- $(conf_notuser opengl)
- $(conf_notuser png vnc-png)
- $(conf_notuser rbd)
- $(conf_notuser sasl vnc-sasl)
- $(conf_notuser sdl)
- $(conf_softmmu sdl-image)
- $(conf_notuser seccomp)
- $(conf_notuser slirp slirp system)
- $(conf_notuser smartcard)
- $(conf_notuser snappy)
- $(conf_notuser spice)
- $(conf_notuser ssh libssh)
- $(conf_notuser udev libudev)
- $(conf_notuser usb libusb)
- $(conf_notuser usbredir usb-redir)
- $(conf_notuser vde)
- $(conf_notuser vhost-net)
- $(conf_notuser vhost-user-fs)
- $(conf_tools vhost-user-fs virtiofsd)
- $(conf_notuser virgl virglrenderer)
- $(conf_softmmu virtfs)
- $(conf_notuser vnc)
- $(conf_notuser vte)
- $(conf_notuser xen)
- $(conf_notuser xen xen-pci-passthrough)
- $(conf_notuser xfs xfsctl)
- # use prebuilt keymaps, bug #759604
- --disable-xkbcommon
- $(conf_notuser zstd)
- )
-
- if [[ ${buildtype} == "user" ]] ; then
- conf_opts+=( --disable-libxml2 )
- else
- conf_opts+=( --enable-libxml2 )
- fi
-
- if [[ ! ${buildtype} == "user" ]] ; then
- # audio options
- local audio_opts=(
- # Note: backend order matters here: #716202
- # We iterate from higher-level to lower level.
- $(usex pulseaudio pa "")
- $(usev jack)
- $(usev sdl)
- $(usev alsa)
- $(usev oss)
- )
- conf_opts+=(
- --audio-drv-list="${audio_opts// /,}"
- )
- fi
-
- case ${buildtype} in
- user)
- conf_opts+=(
- --enable-linux-user
- --disable-system
- --disable-blobs
- --disable-tools
- )
- local static_flag="static-user"
- ;;
- softmmu)
- conf_opts+=(
- --disable-linux-user
- --enable-system
- --disable-tools
- )
- local static_flag="static"
- ;;
- tools)
- conf_opts+=(
- --disable-linux-user
- --disable-system
- --disable-blobs
- --enable-tools
- )
- local static_flag="static"
- ;;
- esac
-
- local targets="${buildtype}_targets"
- [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
-
- # Add support for SystemTAP
- use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
-
- # We always want to attempt to build with PIE support as it results
- # in a more secure binary. But it doesn't work with static or if
- # the current GCC doesn't have PIE support.
- if use ${static_flag}; then
- conf_opts+=( --static --disable-pie )
- else
- tc-enables-pie && conf_opts+=( --enable-pie )
- fi
-
- # Meson will not use a cross-file unless cross_prefix is set.
- tc-is-cross-compiler && conf_opts+=( --cross-prefix="${CHOST}-" )
-
- # Plumb through equivalent of EXTRA_ECONF to allow experiments
- # like bug #747928.
- conf_opts+=( ${EXTRA_CONF_QEMU} )
-
- echo "../configure ${conf_opts[*]}"
- cd "${builddir}"
- ../configure "${conf_opts[@]}" || die "configure failed"
-}
-
-src_configure() {
- local target
-
- python_setup
-
- softmmu_targets= softmmu_bins=()
- user_targets= user_bins=()
-
- for target in ${IUSE_SOFTMMU_TARGETS} ; do
- if use "qemu_softmmu_targets_${target}"; then
- softmmu_targets+=",${target}-softmmu"
- softmmu_bins+=( "qemu-system-${target}" )
- fi
- done
-
- for target in ${IUSE_USER_TARGETS} ; do
- if use "qemu_user_targets_${target}"; then
- user_targets+=",${target}-linux-user"
- user_bins+=( "qemu-${target}" )
- fi
- done
-
- softmmu_targets=${softmmu_targets#,}
- user_targets=${user_targets#,}
-
- [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
- [[ -n ${user_targets} ]] && qemu_src_configure "user"
- qemu_src_configure "tools"
-}
-
-src_compile() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- default
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- default
- fi
-
- cd "${S}/tools-build"
- default
-}
-
-src_test() {
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- pax-mark m */qemu-system-* #515550
- emake check
- fi
-}
-
-qemu_python_install() {
- python_domodule "${S}/python/qemu"
-
- python_doscript "${S}/scripts/kvm/vmxcap"
- python_doscript "${S}/scripts/qmp/qmp-shell"
- python_doscript "${S}/scripts/qmp/qemu-ga-client"
-}
-
-# Generate binfmt support files.
-# - /etc/init.d/qemu-binfmt script which registers the user handlers (openrc)
-# - /usr/share/qemu/binfmt.d/qemu.conf (for use with systemd-binfmt)
-generate_initd() {
- local out="${T}/qemu-binfmt"
- local out_systemd="${T}/qemu.conf"
- local d="${T}/binfmt.d"
-
- einfo "Generating qemu binfmt scripts and configuration files"
-
- # Generate the debian fragments first.
- mkdir -p "${d}"
- "${S}"/scripts/qemu-binfmt-conf.sh \
- --debian \
- --exportdir "${d}" \
- --qemu-path "${EPREFIX}/usr/bin" \
- || die
- # Then turn the fragments into a shell script we can source.
- sed -E -i \
- -e 's:^([^ ]+) (.*)$:\1="\2":' \
- "${d}"/* || die
-
- # Generate the init.d script by assembling the fragments from above.
- local f qcpu package interpreter magic mask
- cat "${FILESDIR}"/qemu-binfmt.initd.head >"${out}" || die
- for f in "${d}"/qemu-* ; do
- source "${f}"
-
- # Normalize the cpu logic like we do in the init.d for the native cpu.
- qcpu=${package#qemu-}
- case ${qcpu} in
- arm*) qcpu="arm";;
- mips*) qcpu="mips";;
- ppc*) qcpu="ppc";;
- s390*) qcpu="s390";;
- sh*) qcpu="sh";;
- sparc*) qcpu="sparc";;
- esac
-
- # we use 'printf' here to be portable across 'sh'
- # implementations: #679168
- cat <<EOF >>"${out}"
- if [ "\${cpu}" != "${qcpu}" -a -x "${interpreter}" ] ; then
- printf '%s\n' ':${package}:M::${magic}:${mask}:${interpreter}:'"\${QEMU_BINFMT_FLAGS}" >/proc/sys/fs/binfmt_misc/register
- fi
-EOF
-
- echo ":${package}:M::${magic}:${mask}:${interpreter}:OC" >>"${out_systemd}"
-
- done
- cat "${FILESDIR}"/qemu-binfmt.initd.tail >>"${out}" || die
-}
-
-src_install() {
- if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
- emake DESTDIR="${ED}" install
-
- # Install binfmt handler init script for user targets.
- generate_initd
- doinitd "${T}/qemu-binfmt"
-
- # Install binfmt/qemu.conf.
- insinto "/usr/share/qemu/binfmt.d"
- doins "${T}/qemu.conf"
- fi
-
- if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
- emake DESTDIR="${ED}" install
-
- # This might not exist if the test failed. #512010
- [[ -e check-report.html ]] && dodoc check-report.html
-
- if use kernel_linux; then
- udev_newrules "${FILESDIR}"/65-kvm.rules-r2 65-kvm.rules
- fi
-
- if use python; then
- python_foreach_impl qemu_python_install
- fi
- fi
-
- cd "${S}/tools-build"
- emake DESTDIR="${ED}" install
-
- # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
- pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
-
- # Install config file example for qemu-bridge-helper
- insinto "/etc/qemu"
- doins "${FILESDIR}/bridge.conf"
-
- cd "${S}"
- dodoc MAINTAINERS docs/specs/pci-ids.txt
- newdoc pc-bios/README README.pc-bios
-
- # Disallow stripping of prebuilt firmware files.
- dostrip -x ${QA_PREBUILT}
-
- if [[ -n ${softmmu_targets} ]]; then
- # Remove SeaBIOS since we're using the SeaBIOS packaged one
- rm "${ED}/usr/share/qemu/bios.bin"
- rm "${ED}/usr/share/qemu/bios-256k.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
- dosym ../seabios/bios-256k.bin /usr/share/qemu/bios-256k.bin
- fi
-
- # Remove vgabios since we're using the seavgabios packaged one
- rm "${ED}/usr/share/qemu/vgabios.bin"
- rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
- rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
- rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
- rm "${ED}/usr/share/qemu/vgabios-virtio.bin"
- rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
- # PPC/PPC64 loads vgabios-stdvga
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 || use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64; then
- dosym ../seavgabios/vgabios-isavga.bin /usr/share/qemu/vgabios.bin
- dosym ../seavgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
- dosym ../seavgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
- dosym ../seavgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
- dosym ../seavgabios/vgabios-virtio.bin /usr/share/qemu/vgabios-virtio.bin
- dosym ../seavgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
- fi
-
- # Remove sgabios since we're using the sgabios packaged one
- rm "${ED}/usr/share/qemu/sgabios.bin"
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
- fi
-
- # Remove iPXE since we're using the iPXE packaged one
- rm "${ED}"/usr/share/qemu/pxe-*.rom
- if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
- dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
- dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
- dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
- dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
- dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
- dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
- fi
- fi
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_create_doc
-}
-
-firmware_abi_change() {
- local pv
- for pv in ${REPLACING_VERSIONS}; do
- if ver_test ${pv} -lt ${FIRMWARE_ABI_VERSION}; then
- return 0
- fi
- done
- return 1
-}
-
-pkg_postinst() {
- if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
- udev_reload
- fi
-
- xdg_icon_cache_update
-
- [[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
-
- DISABLE_AUTOFORMATTING=true
- readme.gentoo_print_elog
-
- if use pin-upstream-blobs && firmware_abi_change; then
- ewarn "This version of qemu pins new versions of firmware blobs:"
- ewarn " $(best_version sys-firmware/edk2-ovmf)"
- ewarn " $(best_version sys-firmware/ipxe)"
- ewarn " $(best_version sys-firmware/seabios)"
- ewarn " $(best_version sys-firmware/sgabios)"
- ewarn "This might break resume of hibernated guests (started with a different"
- ewarn "firmware version) and live migration to/from qemu versions with different"
- ewarn "firmware. Please (cold) restart all running guests. For functional"
- ewarn "guest migration ensure that all"
- ewarn "hosts run at least"
- ewarn " app-emulation/qemu-${FIRMWARE_ABI_VERSION}."
- fi
-}
-
-pkg_info() {
- echo "Using:"
- echo " $(best_version app-emulation/spice-protocol)"
- echo " $(best_version sys-firmware/edk2-ovmf)"
- if has_version 'sys-firmware/edk2-ovmf[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/ipxe)"
- echo " $(best_version sys-firmware/seabios)"
- if has_version 'sys-firmware/seabios[binary]'; then
- echo " USE=binary"
- else
- echo " USE=''"
- fi
- echo " $(best_version sys-firmware/sgabios)"
-}
-
-pkg_postrm() {
- xdg_icon_cache_update
-}
diff --git a/app-emulation/qemu/qemu-7.0.0-r1.ebuild b/app-emulation/qemu/qemu-7.0.0-r1.ebuild
index 168fc9e56ec9..10bff2d0b799 100644
--- a/app-emulation/qemu/qemu-7.0.0-r1.ebuild
+++ b/app-emulation/qemu/qemu-7.0.0-r1.ebuild
@@ -24,7 +24,7 @@ if [[ ${PV} = *9999* ]]; then
else
MY_P="${PN}-${PV/_rc/-rc}"
SRC_URI="https://download.qemu.org/${MY_P}.tar.xz"
- KEYWORDS="amd64 ~arm ~arm64 ~ppc ppc64 ~riscv x86"
+ KEYWORDS="amd64 ~arm arm64 ~loong ~ppc ppc64 ~riscv x86"
S="${WORKDIR}/${MY_P}"
fi
@@ -870,7 +870,7 @@ pkg_postinst() {
xdg_icon_cache_update
[[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+ fcaps cap_net_admin "${EROOT}"/usr/libexec/qemu-bridge-helper
DISABLE_AUTOFORMATTING=true
readme.gentoo_print_elog
diff --git a/app-emulation/qemu/qemu-7.0.0_rc4.ebuild b/app-emulation/qemu/qemu-7.0.0-r2.ebuild
index ef1f8a349879..f048b6385812 100644
--- a/app-emulation/qemu/qemu-7.0.0_rc4.ebuild
+++ b/app-emulation/qemu/qemu-7.0.0-r2.ebuild
@@ -6,12 +6,12 @@ EAPI=8
PYTHON_COMPAT=( python3_{8,9,10} )
PYTHON_REQ_USE="ncurses,readline"
-FIRMWARE_ABI_VERSION="6.2.0"
+FIRMWARE_ABI_VERSION="7.0.0"
inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
pax-utils xdg-utils
-if [[ ${PV} = *9999* ]]; then
+if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://gitlab.com/qemu-project/qemu.git/"
EGIT_SUBMODULES=(
meson
@@ -24,7 +24,7 @@ if [[ ${PV} = *9999* ]]; then
else
MY_P="${PN}-${PV/_rc/-rc}"
SRC_URI="https://download.qemu.org/${MY_P}.tar.xz"
- #KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86"
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
S="${WORKDIR}/${MY_P}"
fi
@@ -149,7 +149,7 @@ SOFTMMU_TOOLS_DEPEND="
capstone? ( dev-libs/capstone:= )
caps? ( sys-libs/libcap-ng[static-libs(+)] )
curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.1[static-libs(+)] )
fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
gnutls? (
@@ -165,7 +165,7 @@ SOFTMMU_TOOLS_DEPEND="
io-uring? ( sys-libs/liburing:=[static-libs(+)] )
jack? ( virtual/jack )
jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ jpeg? ( media-libs/libjpeg-turbo:=[static-libs(+)] )
lzo? ( dev-libs/lzo:2[static-libs(+)] )
multipath? ( sys-fs/multipath-tools )
ncurses? (
@@ -279,6 +279,8 @@ PATCHES=(
"${FILESDIR}"/${PN}-6.0.0-make.patch
"${FILESDIR}"/${PN}-6.1.0-strings.patch
"${FILESDIR}"/${PN}-7.0.0-also-build-virtfs-proxy-helper.patch
+ "${FILESDIR}"/${P}-virtio-scsi-fixes.patch
+ "${FILESDIR}"/${P}-pci-overflow-fortify-source-3.patch
)
QA_PREBUILT="
@@ -418,6 +420,11 @@ src_prepare() {
# Verbose builds
MAKEOPTS+=" V=1"
+ # We already force -D_FORTIFY_SOURCE=2 (or 3) in our toolchain, but
+ # this setting (-U then -D..=2) will prevent us from trying out 3, so
+ # drop it. No change to level of protection b/c we patch our toolchain.
+ sed -i -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' configure || die
+
# Remove bundled copy of libfdt
rm -r dtc || die
}
@@ -432,7 +439,7 @@ qemu_src_configure() {
local buildtype=$1
local builddir="${S}/${buildtype}-build"
- mkdir "${builddir}"
+ mkdir "${builddir}" || die
local conf_opts=(
--prefix=/usr
@@ -468,6 +475,7 @@ qemu_src_configure() {
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
--host-cc="$(tc-getBUILD_CC)"
+
$(use_enable alsa)
$(use_enable debug debug-info)
$(use_enable debug debug-tcg)
@@ -673,22 +681,22 @@ src_configure() {
src_compile() {
if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
+ cd "${S}/user-build" || die
default
fi
if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
+ cd "${S}/softmmu-build" || die
default
fi
- cd "${S}/tools-build"
+ cd "${S}/tools-build" || die
default
}
src_test() {
if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
+ cd "${S}/softmmu-build" || die
pax-mark m */qemu-system-* #515550
emake check
fi
@@ -785,19 +793,19 @@ src_install() {
fi
fi
- cd "${S}/tools-build"
+ cd "${S}/tools-build" || die
emake DESTDIR="${ED}" install
# Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
+ pushd "${ED}"/usr/bin >/dev/null || die
pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
+ popd >/dev/null || die
# Install config file example for qemu-bridge-helper
insinto "/etc/qemu"
doins "${FILESDIR}/bridge.conf"
- cd "${S}"
+ cd "${S}" || die
dodoc MAINTAINERS docs/specs/pci-ids.txt
newdoc pc-bios/README README.pc-bios
@@ -870,7 +878,7 @@ pkg_postinst() {
xdg_icon_cache_update
[[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+ fcaps cap_net_admin "${EROOT}"/usr/libexec/qemu-bridge-helper
DISABLE_AUTOFORMATTING=true
readme.gentoo_print_elog
diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild
index b927c5981570..b9d896ec56bc 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -6,12 +6,12 @@ EAPI=8
PYTHON_COMPAT=( python3_{8,9,10} )
PYTHON_REQ_USE="ncurses,readline"
-FIRMWARE_ABI_VERSION="6.2.0"
+FIRMWARE_ABI_VERSION="7.0.0"
inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \
pax-utils xdg-utils
-if [[ ${PV} = *9999* ]]; then
+if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://gitlab.com/qemu-project/qemu.git/"
EGIT_SUBMODULES=(
meson
@@ -22,8 +22,10 @@ if [[ ${PV} = *9999* ]]; then
inherit git-r3
SRC_URI=""
else
- SRC_URI="https://download.qemu.org/${P}.tar.xz"
- KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+ MY_P="${PN}-${PV/_rc/-rc}"
+ SRC_URI="https://download.qemu.org/${MY_P}.tar.xz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+ S="${WORKDIR}/${MY_P}"
fi
DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
@@ -147,7 +149,7 @@ SOFTMMU_TOOLS_DEPEND="
capstone? ( dev-libs/capstone:= )
caps? ( sys-libs/libcap-ng[static-libs(+)] )
curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
- fdt? ( >=sys-apps/dtc-1.5.0[static-libs(+)] )
+ fdt? ( >=sys-apps/dtc-1.5.1[static-libs(+)] )
fuse? ( >=sys-fs/fuse-3.1:3[static-libs(+)] )
glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
gnutls? (
@@ -163,7 +165,7 @@ SOFTMMU_TOOLS_DEPEND="
io-uring? ( sys-libs/liburing:=[static-libs(+)] )
jack? ( virtual/jack )
jemalloc? ( dev-libs/jemalloc )
- jpeg? ( virtual/jpeg:0=[static-libs(+)] )
+ jpeg? ( media-libs/libjpeg-turbo:=[static-libs(+)] )
lzo? ( dev-libs/lzo:2[static-libs(+)] )
multipath? ( sys-fs/multipath-tools )
ncurses? (
@@ -416,6 +418,11 @@ src_prepare() {
# Verbose builds
MAKEOPTS+=" V=1"
+ # We already force -D_FORTIFY_SOURCE=2 (or 3) in our toolchain, but
+ # this setting (-U then -D..=2) will prevent us from trying out 3, so
+ # drop it. No change to level of protection b/c we patch our toolchain.
+ sed -i -e 's/-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2//' configure || die
+
# Remove bundled copy of libfdt
rm -r dtc || die
}
@@ -430,7 +437,7 @@ qemu_src_configure() {
local buildtype=$1
local builddir="${S}/${buildtype}-build"
- mkdir "${builddir}"
+ mkdir "${builddir}" || die
local conf_opts=(
--prefix=/usr
@@ -466,6 +473,7 @@ qemu_src_configure() {
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
--host-cc="$(tc-getBUILD_CC)"
+
$(use_enable alsa)
$(use_enable debug debug-info)
$(use_enable debug debug-tcg)
@@ -671,22 +679,22 @@ src_configure() {
src_compile() {
if [[ -n ${user_targets} ]]; then
- cd "${S}/user-build"
+ cd "${S}/user-build" || die
default
fi
if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
+ cd "${S}/softmmu-build" || die
default
fi
- cd "${S}/tools-build"
+ cd "${S}/tools-build" || die
default
}
src_test() {
if [[ -n ${softmmu_targets} ]]; then
- cd "${S}/softmmu-build"
+ cd "${S}/softmmu-build" || die
pax-mark m */qemu-system-* #515550
emake check
fi
@@ -783,19 +791,19 @@ src_install() {
fi
fi
- cd "${S}/tools-build"
+ cd "${S}/tools-build" || die
emake DESTDIR="${ED}" install
# Disable mprotect on the qemu binaries as they use JITs to be fast #459348
- pushd "${ED}"/usr/bin >/dev/null
+ pushd "${ED}"/usr/bin >/dev/null || die
pax-mark mr "${softmmu_bins[@]}" "${user_bins[@]}" # bug 575594
- popd >/dev/null
+ popd >/dev/null || die
# Install config file example for qemu-bridge-helper
insinto "/etc/qemu"
doins "${FILESDIR}/bridge.conf"
- cd "${S}"
+ cd "${S}" || die
dodoc MAINTAINERS docs/specs/pci-ids.txt
newdoc pc-bios/README README.pc-bios
@@ -868,7 +876,7 @@ pkg_postinst() {
xdg_icon_cache_update
[[ -z ${EPREFIX} ]] && [[ -f ${EROOT}/usr/libexec/qemu-bridge-helper ]] && \
- fcaps cap_net_admin ${EROOT}/usr/libexec/qemu-bridge-helper
+ fcaps cap_net_admin "${EROOT}"/usr/libexec/qemu-bridge-helper
DISABLE_AUTOFORMATTING=true
readme.gentoo_print_elog