Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/qemu/, app-emulation/qemu/files/
Date: Thu, 17 Dec 2015 15:12:52
Message-Id: 1450365157.841a44c7da275802491b0c7adaae009e7821f136.vapier@gentoo
1 commit: 841a44c7da275802491b0c7adaae009e7821f136
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 17 15:10:17 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 17 15:12:37 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=841a44c7
7
8 app-emulation/qemu: drop versions <2.4.1-r2
9
10 app-emulation/qemu/Manifest | 4 -
11 .../qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch | 241 --------
12 .../qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch | 58 --
13 .../qemu/files/qemu-2.3.0-CVE-2015-3209.patch | 51 --
14 .../qemu/files/qemu-2.3.0-CVE-2015-3214.patch | 41 --
15 .../qemu/files/qemu-2.3.0-CVE-2015-3456.patch | 86 ---
16 .../qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch | 75 ---
17 .../qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch | 26 -
18 .../qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch | 69 ---
19 .../qemu/files/qemu-2.3.0-CVE-2015-5158.patch | 40 --
20 .../qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch | 82 ---
21 .../qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch | 373 ------------
22 .../qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch | 39 --
23 .../qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch | 53 --
24 .../qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch | 34 --
25 .../qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch | 35 --
26 .../qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch | 32 -
27 .../qemu/files/qemu-2.3.0-CVE-2015-5166.patch | 36 --
28 .../qemu/files/qemu-2.3.0-virtio-serial.patch | 34 --
29 .../qemu/files/qemu-2.4.0-CVE-2015-5225.patch | 86 ---
30 .../qemu/files/qemu-2.4.0-CVE-2015-6855.patch | 146 -----
31 .../qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch | 58 --
32 .../qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch | 54 --
33 .../qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch | 47 --
34 .../qemu/files/qemu-2.4.0-block-mirror-crash.patch | 124 ----
35 .../qemu/files/qemu-2.4.0-e1000-loop.patch | 39 --
36 app-emulation/qemu/qemu-2.3.0-r5.ebuild | 611 -------------------
37 app-emulation/qemu/qemu-2.3.0-r6.ebuild | 612 -------------------
38 app-emulation/qemu/qemu-2.3.0-r7.ebuild | 612 -------------------
39 app-emulation/qemu/qemu-2.3.1-r1.ebuild | 598 -------------------
40 app-emulation/qemu/qemu-2.3.1.ebuild | 598 -------------------
41 app-emulation/qemu/qemu-2.4.0-r1.ebuild | 640 --------------------
42 app-emulation/qemu/qemu-2.4.0-r2.ebuild | 640 --------------------
43 app-emulation/qemu/qemu-2.4.0.1-r1.ebuild | 645 ---------------------
44 app-emulation/qemu/qemu-2.4.0.1-r2.ebuild | 645 ---------------------
45 app-emulation/qemu/qemu-2.4.0.1.ebuild | 640 --------------------
46 app-emulation/qemu/qemu-2.4.1-r1.ebuild | 640 --------------------
47 app-emulation/qemu/qemu-2.4.1.ebuild | 638 --------------------
48 38 files changed, 9482 deletions(-)
49
50 diff --git a/app-emulation/qemu/Manifest b/app-emulation/qemu/Manifest
51 index 91125c9..6269bb7 100644
52 --- a/app-emulation/qemu/Manifest
53 +++ b/app-emulation/qemu/Manifest
54 @@ -1,6 +1,2 @@
55 -DIST qemu-2.3.0.tar.bz2 24683085 SHA256 b6bab7f763d5be73e7cb5ee7d4c8365b7a8df2972c52fa5ded18893bd8281588 SHA512 7a40d213c5696b27784abd2a3119e49d42c38c923be431826c73a8f14c19074435d7f1a652686c53baf08e81f5a3005b2ddc92d67c32f6a2b19659ab627e9eaa WHIRLPOOL 9dad6e342027c3be512b4e0b40e810e0a6f1dc84a16847aa5aac74d97f7a347e60d42e770335a090f83e90a1614294f86552a84edc1faafc7093d3e32602f5de
56 -DIST qemu-2.3.1.tar.bz2 24692020 SHA256 661d029809421cae06b4b1bc74ac0e560cb4ed47c9523c676ff277fa26dca15f SHA512 309e6df7dcc0a064d1a17c7dac2f60398700dfa8c6b60b66e4202966248097cbc49af75aa97725bc34773151be6fd75836810e9f0741ba65cdc208414fa78f6b WHIRLPOOL 26750ee00513daa99cdcd585c4b8407b8258a9c3559ae6335266d7754cb6679e7c10c56f8d12ae0ef2b5cd5d6a9a6a536213f8e86e81ced37e46205c796a773e
57 -DIST qemu-2.4.0.1.tar.bz2 25068555 SHA256 ecfe8b88037e41e817d72c460c56c6a0b573d540d6ba38b162d0de4fd22d1bdb SHA512 08eabe92fa9096386ef00f8e9d99eeec1508d15e5a98431e043a729cbaca2d96d6e3afc612e7c4a0fe5a6bba80006276185f1066b4c73105b2ea24b7e9133b84 WHIRLPOOL 1daaec23d6ada6af8bf4902e590fb96375e7149d2f53ff6bf6d8fb39722c182a2d2efcc0d40bee673a8316f621983c512daa54202bb4e632b3a4b09f0268cd09
58 -DIST qemu-2.4.0.tar.bz2 25070979 SHA256 72b0b991bbcc540663a019e1e8c4f714053b691dda32c9b9ee80b25f367e6620 SHA512 8740e0fb2c654ed897dff4649f1f83d14d57cfa9cbde723899f115982f93253ce9a2bddd60aab379d241027d2044137770efe4c0b3c83d5b20f3a2a06f05a5dc WHIRLPOOL 8c6cfae096624e01f0d5daeb86aa2dccbeaa86d2aeab626cf55cf20b7edace82d0b0f3a1d85eeb2dc1fd53abaaa9dccf8f0d7ddc657a1f5ffd72fd68301648f1
59 DIST qemu-2.4.1.tar.bz2 25087522 SHA256 e3d5cf4c8b1f9129c9c797329a515bfb6b3b1ded0ab8b394c8a316490fe3a177 SHA512 fde32b71a50d888c1055e61f4e6dfc45bb97e8e9ebee490c545965fbdcbd5ffd859fbf20648abed1f4fa9fcc5635e9b22e1829bbe802fc8aaf989d6013235917 WHIRLPOOL a698cfa5d2d138eeddb3c6bea57e3b89ca5d47165c04ed1cfd66a81647ac59cbdd594c919abef67bf198278da1160c5b9f3a0da84cd73827f3eb19a6e6f05436
60 DIST qemu-2.5.0.tar.bz2 25464996 SHA256 3443887401619fe33bfa5d900a4f2d6a79425ae2b7e43d5b8c36eb7a683772d4 SHA512 12153f94cc7f834fd6a85f25690c36f2331d88d414426fb8b9ac20a34e6f9222b1eda30b727674af583580fae90dfd6d0614a905dce1567d94cd049d426b9dd3 WHIRLPOOL 8f5717989d8d234ecf1763ee386b2e1f20c3b17918de130c6dae255e4523a230b2b01a759eba25e4b9f604c680d9b868c56f58bd71b7c6c2c22a2e46804435ef
61
62 diff --git a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch b/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
63 deleted file mode 100644
64 index 35ef8fd..0000000
65 --- a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-1.patch
66 +++ /dev/null
67 @@ -1,241 +0,0 @@
68 -From a2bebfd6e09d285aa793cae3fb0fc3a39a9fee6e Mon Sep 17 00:00:00 2001
69 -From: "Daniel P. Berrange" <berrange@××××××.com>
70 -Date: Mon, 23 Mar 2015 22:58:21 +0000
71 -Subject: [PATCH] CVE-2015-1779: incrementally decode websocket frames
72 -
73 -The logic for decoding websocket frames wants to fully
74 -decode the frame header and payload, before allowing the
75 -VNC server to see any of the payload data. There is no
76 -size limit on websocket payloads, so this allows a
77 -malicious network client to consume 2^64 bytes in memory
78 -in QEMU. It can trigger this denial of service before
79 -the VNC server even performs any authentication.
80 -
81 -The fix is to decode the header, and then incrementally
82 -decode the payload data as it is needed. With this fix
83 -the websocket decoder will allow at most 4k of data to
84 -be buffered before decoding and processing payload.
85 -
86 -Signed-off-by: Daniel P. Berrange <berrange@××××××.com>
87 -
88 -[ kraxel: fix frequent spurious disconnects, suggested by Peter Maydell ]
89 -
90 - @@ -361,7 +361,7 @@ int vncws_decode_frame_payload(Buffer *input,
91 - - *payload_size = input->offset;
92 - + *payload_size = *payload_remain;
93 -
94 -[ kraxel: fix 32bit build ]
95 -
96 - @@ -306,7 +306,7 @@ struct VncState
97 - - uint64_t ws_payload_remain;
98 - + size_t ws_payload_remain;
99 -
100 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
101 ----
102 - ui/vnc-ws.c | 105 ++++++++++++++++++++++++++++++++++++++++--------------------
103 - ui/vnc-ws.h | 9 ++++--
104 - ui/vnc.h | 2 ++
105 - 3 files changed, 80 insertions(+), 36 deletions(-)
106 -
107 -diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
108 -index 85dbb7e..0b7de4e 100644
109 ---- a/ui/vnc-ws.c
110 -+++ b/ui/vnc-ws.c
111 -@@ -107,7 +107,7 @@ long vnc_client_read_ws(VncState *vs)
112 - {
113 - int ret, err;
114 - uint8_t *payload;
115 -- size_t payload_size, frame_size;
116 -+ size_t payload_size, header_size;
117 - VNC_DEBUG("Read websocket %p size %zd offset %zd\n", vs->ws_input.buffer,
118 - vs->ws_input.capacity, vs->ws_input.offset);
119 - buffer_reserve(&vs->ws_input, 4096);
120 -@@ -117,18 +117,39 @@ long vnc_client_read_ws(VncState *vs)
121 - }
122 - vs->ws_input.offset += ret;
123 -
124 -- /* make sure that nothing is left in the ws_input buffer */
125 -+ ret = 0;
126 -+ /* consume as much of ws_input buffer as possible */
127 - do {
128 -- err = vncws_decode_frame(&vs->ws_input, &payload,
129 -- &payload_size, &frame_size);
130 -- if (err <= 0) {
131 -- return err;
132 -+ if (vs->ws_payload_remain == 0) {
133 -+ err = vncws_decode_frame_header(&vs->ws_input,
134 -+ &header_size,
135 -+ &vs->ws_payload_remain,
136 -+ &vs->ws_payload_mask);
137 -+ if (err <= 0) {
138 -+ return err;
139 -+ }
140 -+
141 -+ buffer_advance(&vs->ws_input, header_size);
142 - }
143 -+ if (vs->ws_payload_remain != 0) {
144 -+ err = vncws_decode_frame_payload(&vs->ws_input,
145 -+ &vs->ws_payload_remain,
146 -+ &vs->ws_payload_mask,
147 -+ &payload,
148 -+ &payload_size);
149 -+ if (err < 0) {
150 -+ return err;
151 -+ }
152 -+ if (err == 0) {
153 -+ return ret;
154 -+ }
155 -+ ret += err;
156 -
157 -- buffer_reserve(&vs->input, payload_size);
158 -- buffer_append(&vs->input, payload, payload_size);
159 -+ buffer_reserve(&vs->input, payload_size);
160 -+ buffer_append(&vs->input, payload, payload_size);
161 -
162 -- buffer_advance(&vs->ws_input, frame_size);
163 -+ buffer_advance(&vs->ws_input, payload_size);
164 -+ }
165 - } while (vs->ws_input.offset > 0);
166 -
167 - return ret;
168 -@@ -265,15 +286,14 @@ void vncws_encode_frame(Buffer *output, const void *payload,
169 - buffer_append(output, payload, payload_size);
170 - }
171 -
172 --int vncws_decode_frame(Buffer *input, uint8_t **payload,
173 -- size_t *payload_size, size_t *frame_size)
174 -+int vncws_decode_frame_header(Buffer *input,
175 -+ size_t *header_size,
176 -+ size_t *payload_remain,
177 -+ WsMask *payload_mask)
178 - {
179 - unsigned char opcode = 0, fin = 0, has_mask = 0;
180 -- size_t header_size = 0;
181 -- uint32_t *payload32;
182 -+ size_t payload_len;
183 - WsHeader *header = (WsHeader *)input->buffer;
184 -- WsMask mask;
185 -- int i;
186 -
187 - if (input->offset < WS_HEAD_MIN_LEN + 4) {
188 - /* header not complete */
189 -@@ -283,7 +303,7 @@ int vncws_decode_frame(Buffer *input, uint8_t **payload,
190 - fin = (header->b0 & 0x80) >> 7;
191 - opcode = header->b0 & 0x0f;
192 - has_mask = (header->b1 & 0x80) >> 7;
193 -- *payload_size = header->b1 & 0x7f;
194 -+ payload_len = header->b1 & 0x7f;
195 -
196 - if (opcode == WS_OPCODE_CLOSE) {
197 - /* disconnect */
198 -@@ -300,40 +320,57 @@ int vncws_decode_frame(Buffer *input, uint8_t **payload,
199 - return -2;
200 - }
201 -
202 -- if (*payload_size < 126) {
203 -- header_size = 6;
204 -- mask = header->u.m;
205 -- } else if (*payload_size == 126 && input->offset >= 8) {
206 -- *payload_size = be16_to_cpu(header->u.s16.l16);
207 -- header_size = 8;
208 -- mask = header->u.s16.m16;
209 -- } else if (*payload_size == 127 && input->offset >= 14) {
210 -- *payload_size = be64_to_cpu(header->u.s64.l64);
211 -- header_size = 14;
212 -- mask = header->u.s64.m64;
213 -+ if (payload_len < 126) {
214 -+ *payload_remain = payload_len;
215 -+ *header_size = 6;
216 -+ *payload_mask = header->u.m;
217 -+ } else if (payload_len == 126 && input->offset >= 8) {
218 -+ *payload_remain = be16_to_cpu(header->u.s16.l16);
219 -+ *header_size = 8;
220 -+ *payload_mask = header->u.s16.m16;
221 -+ } else if (payload_len == 127 && input->offset >= 14) {
222 -+ *payload_remain = be64_to_cpu(header->u.s64.l64);
223 -+ *header_size = 14;
224 -+ *payload_mask = header->u.s64.m64;
225 - } else {
226 - /* header not complete */
227 - return 0;
228 - }
229 -
230 -- *frame_size = header_size + *payload_size;
231 -+ return 1;
232 -+}
233 -+
234 -+int vncws_decode_frame_payload(Buffer *input,
235 -+ size_t *payload_remain, WsMask *payload_mask,
236 -+ uint8_t **payload, size_t *payload_size)
237 -+{
238 -+ size_t i;
239 -+ uint32_t *payload32;
240 -
241 -- if (input->offset < *frame_size) {
242 -- /* frame not complete */
243 -+ *payload = input->buffer;
244 -+ /* If we aren't at the end of the payload, then drop
245 -+ * off the last bytes, so we're always multiple of 4
246 -+ * for purpose of unmasking, except at end of payload
247 -+ */
248 -+ if (input->offset < *payload_remain) {
249 -+ *payload_size = input->offset - (input->offset % 4);
250 -+ } else {
251 -+ *payload_size = *payload_remain;
252 -+ }
253 -+ if (*payload_size == 0) {
254 - return 0;
255 - }
256 --
257 -- *payload = input->buffer + header_size;
258 -+ *payload_remain -= *payload_size;
259 -
260 - /* unmask frame */
261 - /* process 1 frame (32 bit op) */
262 - payload32 = (uint32_t *)(*payload);
263 - for (i = 0; i < *payload_size / 4; i++) {
264 -- payload32[i] ^= mask.u;
265 -+ payload32[i] ^= payload_mask->u;
266 - }
267 - /* process the remaining bytes (if any) */
268 - for (i *= 4; i < *payload_size; i++) {
269 -- (*payload)[i] ^= mask.c[i % 4];
270 -+ (*payload)[i] ^= payload_mask->c[i % 4];
271 - }
272 -
273 - return 1;
274 -diff --git a/ui/vnc-ws.h b/ui/vnc-ws.h
275 -index ef229b7..14d4230 100644
276 ---- a/ui/vnc-ws.h
277 -+++ b/ui/vnc-ws.h
278 -@@ -83,7 +83,12 @@ long vnc_client_read_ws(VncState *vs);
279 - void vncws_process_handshake(VncState *vs, uint8_t *line, size_t size);
280 - void vncws_encode_frame(Buffer *output, const void *payload,
281 - const size_t payload_size);
282 --int vncws_decode_frame(Buffer *input, uint8_t **payload,
283 -- size_t *payload_size, size_t *frame_size);
284 -+int vncws_decode_frame_header(Buffer *input,
285 -+ size_t *header_size,
286 -+ size_t *payload_remain,
287 -+ WsMask *payload_mask);
288 -+int vncws_decode_frame_payload(Buffer *input,
289 -+ size_t *payload_remain, WsMask *payload_mask,
290 -+ uint8_t **payload, size_t *payload_size);
291 -
292 - #endif /* __QEMU_UI_VNC_WS_H */
293 -diff --git a/ui/vnc.h b/ui/vnc.h
294 -index e19ac39..3f7c6a9 100644
295 ---- a/ui/vnc.h
296 -+++ b/ui/vnc.h
297 -@@ -306,6 +306,8 @@ struct VncState
298 - #ifdef CONFIG_VNC_WS
299 - Buffer ws_input;
300 - Buffer ws_output;
301 -+ size_t ws_payload_remain;
302 -+ WsMask ws_payload_mask;
303 - #endif
304 - /* current output mode information */
305 - VncWritePixels *write_pixels;
306 ---
307 -2.3.5
308 -
309
310 diff --git a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch b/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
311 deleted file mode 100644
312 index c7a8c8b..0000000
313 --- a/app-emulation/qemu/files/qemu-2.2.1-CVE-2015-1779-2.patch
314 +++ /dev/null
315 @@ -1,58 +0,0 @@
316 -From 2cdb5e142fb93e875fa53c52864ef5eb8d5d8b41 Mon Sep 17 00:00:00 2001
317 -From: "Daniel P. Berrange" <berrange@××××××.com>
318 -Date: Mon, 23 Mar 2015 22:58:22 +0000
319 -Subject: [PATCH] CVE-2015-1779: limit size of HTTP headers from websockets
320 - clients
321 -
322 -The VNC server websockets decoder will read and buffer data from
323 -websockets clients until it sees the end of the HTTP headers,
324 -as indicated by \r\n\r\n. In theory this allows a malicious to
325 -trick QEMU into consuming an arbitrary amount of RAM. In practice,
326 -because QEMU runs g_strstr_len() across the buffered header data,
327 -it will spend increasingly long burning CPU time searching for
328 -the substring match and less & less time reading data. So while
329 -this does cause arbitrary memory growth, the bigger problem is
330 -that QEMU will be burning 100% of available CPU time.
331 -
332 -A novnc websockets client typically sends headers of around
333 -512 bytes in length. As such it is reasonable to place a 4096
334 -byte limit on the amount of data buffered while searching for
335 -the end of HTTP headers.
336 -
337 -Signed-off-by: Daniel P. Berrange <berrange@××××××.com>
338 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
339 ----
340 - ui/vnc-ws.c | 10 ++++++++--
341 - 1 file changed, 8 insertions(+), 2 deletions(-)
342 -
343 -diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
344 -index 0b7de4e..62eb97f 100644
345 ---- a/ui/vnc-ws.c
346 -+++ b/ui/vnc-ws.c
347 -@@ -81,8 +81,11 @@ void vncws_handshake_read(void *opaque)
348 - VncState *vs = opaque;
349 - uint8_t *handshake_end;
350 - long ret;
351 -- buffer_reserve(&vs->ws_input, 4096);
352 -- ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), 4096);
353 -+ /* Typical HTTP headers from novnc are 512 bytes, so limiting
354 -+ * total header size to 4096 is easily enough. */
355 -+ size_t want = 4096 - vs->ws_input.offset;
356 -+ buffer_reserve(&vs->ws_input, want);
357 -+ ret = vnc_client_read_buf(vs, buffer_end(&vs->ws_input), want);
358 -
359 - if (!ret) {
360 - if (vs->csock == -1) {
361 -@@ -99,6 +102,9 @@ void vncws_handshake_read(void *opaque)
362 - vncws_process_handshake(vs, vs->ws_input.buffer, vs->ws_input.offset);
363 - buffer_advance(&vs->ws_input, handshake_end - vs->ws_input.buffer +
364 - strlen(WS_HANDSHAKE_END));
365 -+ } else if (vs->ws_input.offset >= 4096) {
366 -+ VNC_DEBUG("End of headers not found in first 4096 bytes\n");
367 -+ vnc_client_error(vs);
368 - }
369 - }
370 -
371 ---
372 -2.3.5
373 -
374
375 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3209.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3209.patch
376 deleted file mode 100644
377 index 885db3b..0000000
378 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3209.patch
379 +++ /dev/null
380 @@ -1,51 +0,0 @@
381 -https://bugs.gentoo.org/551752
382 -
383 -From 9f7c594c006289ad41169b854d70f5da6e400a2a Mon Sep 17 00:00:00 2001
384 -From: Petr Matousek <pmatouse@××××××.com>
385 -Date: Sun, 24 May 2015 10:53:44 +0200
386 -Subject: [PATCH] pcnet: force the buffer access to be in bounds during tx
387 -
388 -4096 is the maximum length per TMD and it is also currently the size of
389 -the relay buffer pcnet driver uses for sending the packet data to QEMU
390 -for further processing. With packet spanning multiple TMDs it can
391 -happen that the overall packet size will be bigger than sizeof(buffer),
392 -which results in memory corruption.
393 -
394 -Fix this by only allowing to queue maximum sizeof(buffer) bytes.
395 -
396 -This is CVE-2015-3209.
397 -
398 -[Fixed 3-space indentation to QEMU's 4-space coding standard.
399 ---Stefan]
400 -
401 -Signed-off-by: Petr Matousek <pmatouse@××××××.com>
402 -Reported-by: Matt Tait <matttait@××××××.com>
403 -Reviewed-by: Peter Maydell <peter.maydell@××××××.org>
404 -Reviewed-by: Stefan Hajnoczi <stefanha@××××××.com>
405 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
406 ----
407 - hw/net/pcnet.c | 8 ++++++++
408 - 1 file changed, 8 insertions(+)
409 -
410 -diff --git a/hw/net/pcnet.c b/hw/net/pcnet.c
411 -index bdfd38f..68b9981 100644
412 ---- a/hw/net/pcnet.c
413 -+++ b/hw/net/pcnet.c
414 -@@ -1241,6 +1241,14 @@ static void pcnet_transmit(PCNetState *s)
415 - }
416 -
417 - bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
418 -+
419 -+ /* if multi-tmd packet outsizes s->buffer then skip it silently.
420 -+ Note: this is not what real hw does */
421 -+ if (s->xmit_pos + bcnt > sizeof(s->buffer)) {
422 -+ s->xmit_pos = -1;
423 -+ goto txdone;
424 -+ }
425 -+
426 - s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
427 - s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
428 - s->xmit_pos += bcnt;
429 ---
430 -2.2.0.rc0.207.ga3a616c
431 -
432
433 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3214.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3214.patch
434 deleted file mode 100644
435 index 7fee8fd..0000000
436 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3214.patch
437 +++ /dev/null
438 @@ -1,41 +0,0 @@
439 -From: Petr Matousek <pmatouse@××××××.com>
440 -Date: Wed, 17 Jun 2015 10:46:11 +0000 (+0200)
441 -Subject: i8254: fix out-of-bounds memory access in pit_ioport_read()
442 -X-Git-Tag: v2.4.0-rc0~43^2~9
443 -X-Git-Url: http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h=d4862a87e31a51de9eb260f25c9e99a75efe3235;hp=9dacf32d2cbd66cbcce7944ebdfd6b2df20e33b8
444 -
445 -i8254: fix out-of-bounds memory access in pit_ioport_read()
446 -
447 -Due converting PIO to the new memory read/write api we no longer provide
448 -separate I/O region lenghts for read and write operations. As a result,
449 -reading from PIT Mode/Command register will end with accessing
450 -pit->channels with invalid index.
451 -
452 -Fix this by ignoring read from the Mode/Command register.
453 -
454 -This is CVE-2015-3214.
455 -
456 -Reported-by: Matt Tait <matttait@××××××.com>
457 -Fixes: 0505bcdec8228d8de39ab1a02644e71999e7c052
458 -Cc: qemu-stable@××××××.org
459 -Signed-off-by: Petr Matousek <pmatouse@××××××.com>
460 -Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
461 ----
462 -
463 -diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c
464 -index 3450c98..9b65a33 100644
465 ---- a/hw/timer/i8254.c
466 -+++ b/hw/timer/i8254.c
467 -@@ -196,6 +196,12 @@ static uint64_t pit_ioport_read(void *opaque, hwaddr addr,
468 - PITChannelState *s;
469 -
470 - addr &= 3;
471 -+
472 -+ if (addr == 3) {
473 -+ /* Mode/Command register is write only, read is ignored */
474 -+ return 0;
475 -+ }
476 -+
477 - s = &pit->channels[addr];
478 - if (s->status_latched) {
479 - s->status_latched = 0;
480
481 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
482 deleted file mode 100644
483 index 87697d0..0000000
484 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-3456.patch
485 +++ /dev/null
486 @@ -1,86 +0,0 @@
487 -https://bugs.gentoo.org/549404
488 -
489 -From e907746266721f305d67bc0718795fedee2e824c Mon Sep 17 00:00:00 2001
490 -From: Petr Matousek <pmatouse@××××××.com>
491 -Date: Wed, 6 May 2015 09:48:59 +0200
492 -Subject: [PATCH] fdc: force the fifo access to be in bounds of the allocated buffer
493 -
494 -During processing of certain commands such as FD_CMD_READ_ID and
495 -FD_CMD_DRIVE_SPECIFICATION_COMMAND the fifo memory access could
496 -get out of bounds leading to memory corruption with values coming
497 -from the guest.
498 -
499 -Fix this by making sure that the index is always bounded by the
500 -allocated memory.
501 -
502 -This is CVE-2015-3456.
503 -
504 -Signed-off-by: Petr Matousek <pmatouse@××××××.com>
505 -Reviewed-by: John Snow <jsnow@××××××.com>
506 -Signed-off-by: John Snow <jsnow@××××××.com>
507 ----
508 - hw/block/fdc.c | 17 +++++++++++------
509 - 1 files changed, 11 insertions(+), 6 deletions(-)
510 -
511 -diff --git a/hw/block/fdc.c b/hw/block/fdc.c
512 -index f72a392..d8a8edd 100644
513 ---- a/hw/block/fdc.c
514 -+++ b/hw/block/fdc.c
515 -@@ -1497,7 +1497,7 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
516 - {
517 - FDrive *cur_drv;
518 - uint32_t retval = 0;
519 -- int pos;
520 -+ uint32_t pos;
521 -
522 - cur_drv = get_cur_drv(fdctrl);
523 - fdctrl->dsr &= ~FD_DSR_PWRDOWN;
524 -@@ -1506,8 +1506,8 @@ static uint32_t fdctrl_read_data(FDCtrl *fdctrl)
525 - return 0;
526 - }
527 - pos = fdctrl->data_pos;
528 -+ pos %= FD_SECTOR_LEN;
529 - if (fdctrl->msr & FD_MSR_NONDMA) {
530 -- pos %= FD_SECTOR_LEN;
531 - if (pos == 0) {
532 - if (fdctrl->data_pos != 0)
533 - if (!fdctrl_seek_to_next_sect(fdctrl, cur_drv)) {
534 -@@ -1852,10 +1852,13 @@ static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
535 - static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direction)
536 - {
537 - FDrive *cur_drv = get_cur_drv(fdctrl);
538 -+ uint32_t pos;
539 -
540 -- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) {
541 -+ pos = fdctrl->data_pos - 1;
542 -+ pos %= FD_SECTOR_LEN;
543 -+ if (fdctrl->fifo[pos] & 0x80) {
544 - /* Command parameters done */
545 -- if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x40) {
546 -+ if (fdctrl->fifo[pos] & 0x40) {
547 - fdctrl->fifo[0] = fdctrl->fifo[1];
548 - fdctrl->fifo[2] = 0;
549 - fdctrl->fifo[3] = 0;
550 -@@ -1955,7 +1958,7 @@ static uint8_t command_to_handler[256];
551 - static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
552 - {
553 - FDrive *cur_drv;
554 -- int pos;
555 -+ uint32_t pos;
556 -
557 - /* Reset mode */
558 - if (!(fdctrl->dor & FD_DOR_nRESET)) {
559 -@@ -2004,7 +2007,9 @@ static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
560 - }
561 -
562 - FLOPPY_DPRINTF("%s: %02x\n", __func__, value);
563 -- fdctrl->fifo[fdctrl->data_pos++] = value;
564 -+ pos = fdctrl->data_pos++;
565 -+ pos %= FD_SECTOR_LEN;
566 -+ fdctrl->fifo[pos] = value;
567 - if (fdctrl->data_pos == fdctrl->data_len) {
568 - /* We now have all parameters
569 - * and will be able to treat the command
570 ---
571 -1.7.0.4
572 -
573
574 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch
575 deleted file mode 100644
576 index 759e403..0000000
577 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-1.patch
578 +++ /dev/null
579 @@ -1,75 +0,0 @@
580 -From d2ff85854512574e7209f295e87b0835d5b032c6 Mon Sep 17 00:00:00 2001
581 -From: Kevin Wolf <kwolf@××××××.com>
582 -Date: Sun, 26 Jul 2015 23:42:53 -0400
583 -Subject: [PATCH] ide: Check array bounds before writing to io_buffer
584 - (CVE-2015-5154)
585 -
586 -If the end_transfer_func of a command is called because enough data has
587 -been read or written for the current PIO transfer, and it fails to
588 -correctly call the command completion functions, the DRQ bit in the
589 -status register and s->end_transfer_func may remain set. This allows the
590 -guest to access further bytes in s->io_buffer beyond s->data_end, and
591 -eventually overflowing the io_buffer.
592 -
593 -One case where this currently happens is emulation of the ATAPI command
594 -START STOP UNIT.
595 -
596 -This patch fixes the problem by adding explicit array bounds checks
597 -before accessing the buffer instead of relying on end_transfer_func to
598 -function correctly.
599 -
600 -Cc: qemu-stable@××××××.org
601 -Signed-off-by: Kevin Wolf <kwolf@××××××.com>
602 -Reviewed-by: John Snow <jsnow@××××××.com>
603 ----
604 - hw/ide/core.c | 16 ++++++++++++++++
605 - 1 file changed, 16 insertions(+)
606 -
607 -diff --git a/hw/ide/core.c b/hw/ide/core.c
608 -index 122e955..44fcc23 100644
609 ---- a/hw/ide/core.c
610 -+++ b/hw/ide/core.c
611 -@@ -2021,6 +2021,10 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
612 - }
613 -
614 - p = s->data_ptr;
615 -+ if (p + 2 > s->data_end) {
616 -+ return;
617 -+ }
618 -+
619 - *(uint16_t *)p = le16_to_cpu(val);
620 - p += 2;
621 - s->data_ptr = p;
622 -@@ -2042,6 +2046,10 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
623 - }
624 -
625 - p = s->data_ptr;
626 -+ if (p + 2 > s->data_end) {
627 -+ return 0;
628 -+ }
629 -+
630 - ret = cpu_to_le16(*(uint16_t *)p);
631 - p += 2;
632 - s->data_ptr = p;
633 -@@ -2063,6 +2071,10 @@ void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
634 - }
635 -
636 - p = s->data_ptr;
637 -+ if (p + 4 > s->data_end) {
638 -+ return;
639 -+ }
640 -+
641 - *(uint32_t *)p = le32_to_cpu(val);
642 - p += 4;
643 - s->data_ptr = p;
644 -@@ -2084,6 +2096,10 @@ uint32_t ide_data_readl(void *opaque, uint32_t addr)
645 - }
646 -
647 - p = s->data_ptr;
648 -+ if (p + 4 > s->data_end) {
649 -+ return 0;
650 -+ }
651 -+
652 - ret = cpu_to_le32(*(uint32_t *)p);
653 - p += 4;
654 - s->data_ptr = p;
655
656 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch
657 deleted file mode 100644
658 index 6d7902a..0000000
659 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-2.patch
660 +++ /dev/null
661 @@ -1,26 +0,0 @@
662 -From 03441c3a4a42beb25460dd11592539030337d0f8 Mon Sep 17 00:00:00 2001
663 -From: Kevin Wolf <kwolf@××××××.com>
664 -Date: Sun, 26 Jul 2015 23:42:53 -0400
665 -Subject: [PATCH] ide/atapi: Fix START STOP UNIT command completion
666 -
667 -The command must be completed on all code paths. START STOP UNIT with
668 -pwrcnd set should succeed without doing anything.
669 -
670 -Signed-off-by: Kevin Wolf <kwolf@××××××.com>
671 -Reviewed-by: John Snow <jsnow@××××××.com>
672 ----
673 - hw/ide/atapi.c | 1 +
674 - 1 file changed, 1 insertion(+)
675 -
676 -diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
677 -index 950e311..79dd167 100644
678 ---- a/hw/ide/atapi.c
679 -+++ b/hw/ide/atapi.c
680 -@@ -983,6 +983,7 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)
681 -
682 - if (pwrcnd) {
683 - /* eject/load only happens for power condition == 0 */
684 -+ ide_atapi_cmd_ok(s);
685 - return;
686 - }
687 -
688
689 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch
690 deleted file mode 100644
691 index f6f346f..0000000
692 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5154-3.patch
693 +++ /dev/null
694 @@ -1,69 +0,0 @@
695 -From cb72cba83021fa42719e73a5249c12096a4d1cfc Mon Sep 17 00:00:00 2001
696 -From: Kevin Wolf <kwolf@××××××.com>
697 -Date: Sun, 26 Jul 2015 23:42:53 -0400
698 -Subject: [PATCH] ide: Clear DRQ after handling all expected accesses
699 -
700 -This is additional hardening against an end_transfer_func that fails to
701 -clear the DRQ status bit. The bit must be unset as soon as the PIO
702 -transfer has completed, so it's better to do this in a central place
703 -instead of duplicating the code in all commands (and forgetting it in
704 -some).
705 -
706 -Signed-off-by: Kevin Wolf <kwolf@××××××.com>
707 -Reviewed-by: John Snow <jsnow@××××××.com>
708 ----
709 - hw/ide/core.c | 16 ++++++++++++----
710 - 1 file changed, 12 insertions(+), 4 deletions(-)
711 -
712 -diff --git a/hw/ide/core.c b/hw/ide/core.c
713 -index 44fcc23..50449ca 100644
714 ---- a/hw/ide/core.c
715 -+++ b/hw/ide/core.c
716 -@@ -2028,8 +2028,10 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
717 - *(uint16_t *)p = le16_to_cpu(val);
718 - p += 2;
719 - s->data_ptr = p;
720 -- if (p >= s->data_end)
721 -+ if (p >= s->data_end) {
722 -+ s->status &= ~DRQ_STAT;
723 - s->end_transfer_func(s);
724 -+ }
725 - }
726 -
727 - uint32_t ide_data_readw(void *opaque, uint32_t addr)
728 -@@ -2053,8 +2055,10 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
729 - ret = cpu_to_le16(*(uint16_t *)p);
730 - p += 2;
731 - s->data_ptr = p;
732 -- if (p >= s->data_end)
733 -+ if (p >= s->data_end) {
734 -+ s->status &= ~DRQ_STAT;
735 - s->end_transfer_func(s);
736 -+ }
737 - return ret;
738 - }
739 -
740 -@@ -2078,8 +2082,10 @@ void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
741 - *(uint32_t *)p = le32_to_cpu(val);
742 - p += 4;
743 - s->data_ptr = p;
744 -- if (p >= s->data_end)
745 -+ if (p >= s->data_end) {
746 -+ s->status &= ~DRQ_STAT;
747 - s->end_transfer_func(s);
748 -+ }
749 - }
750 -
751 - uint32_t ide_data_readl(void *opaque, uint32_t addr)
752 -@@ -2103,8 +2109,10 @@ uint32_t ide_data_readl(void *opaque, uint32_t addr)
753 - ret = cpu_to_le32(*(uint32_t *)p);
754 - p += 4;
755 - s->data_ptr = p;
756 -- if (p >= s->data_end)
757 -+ if (p >= s->data_end) {
758 -+ s->status &= ~DRQ_STAT;
759 - s->end_transfer_func(s);
760 -+ }
761 - return ret;
762 - }
763 -
764
765 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5158.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5158.patch
766 deleted file mode 100644
767 index 9badc9b..0000000
768 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5158.patch
769 +++ /dev/null
770 @@ -1,40 +0,0 @@
771 -commit c170aad8b057223b1139d72e5ce7acceafab4fa9
772 -Author: Paolo Bonzini <pbonzini@××××××.com>
773 -Date: Tue Jul 21 08:59:39 2015 +0200
774 -
775 - scsi: fix buffer overflow in scsi_req_parse_cdb (CVE-2015-5158)
776 -
777 - This is a guest-triggerable buffer overflow present in QEMU 2.2.0
778 - and newer. scsi_cdb_length returns -1 as an error value, but the
779 - caller does not check it.
780 -
781 - Luckily, the massive overflow means that QEMU will just SIGSEGV,
782 - making the impact much smaller.
783 -
784 - Reported-by: Zhu Donghai (朱东海) <donghai.zdh@×××××××××××.com>
785 - Fixes: 1894df02811f6b79ea3ffbf1084599d96f316173
786 - Reviewed-by: Fam Zheng <famz@××××××.com>
787 - Cc: qemu-stable@××××××.org
788 - Signed-off-by: Paolo Bonzini <pbonzini@××××××.com>
789 -
790 -diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
791 -index f50b2f0..f0ae462 100644
792 ---- a/hw/scsi/scsi-bus.c
793 -+++ b/hw/scsi/scsi-bus.c
794 -@@ -1239,10 +1239,15 @@ int scsi_cdb_length(uint8_t *buf) {
795 - int scsi_req_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf)
796 - {
797 - int rc;
798 -+ int len;
799 -
800 - cmd->lba = -1;
801 -- cmd->len = scsi_cdb_length(buf);
802 -+ len = scsi_cdb_length(buf);
803 -+ if (len < 0) {
804 -+ return -1;
805 -+ }
806 -
807 -+ cmd->len = len;
808 - switch (dev->type) {
809 - case TYPE_TAPE:
810 - rc = scsi_req_stream_xfer(cmd, dev, buf);
811
812 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch
813 deleted file mode 100644
814 index 043d189..0000000
815 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-1.patch
816 +++ /dev/null
817 @@ -1,82 +0,0 @@
818 -From 5e0c290415b9d57077a86e70c8e6a058868334d3 Mon Sep 17 00:00:00 2001
819 -From: Stefan Hajnoczi <stefanha@××××××.com>
820 -Date: Wed, 15 Jul 2015 18:16:58 +0100
821 -Subject: [PATCH 1/7] rtl8139: avoid nested ifs in IP header parsing
822 -
823 -Transmit offload needs to parse packet headers. If header fields have
824 -unexpected values the offload processing is skipped.
825 -
826 -The code currently uses nested ifs because there is relatively little
827 -input validation. The next patches will add missing input validation
828 -and a goto label is more appropriate to avoid deep if statement nesting.
829 -
830 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
831 ----
832 - hw/net/rtl8139.c | 41 ++++++++++++++++++++++-------------------
833 - 1 file changed, 22 insertions(+), 19 deletions(-)
834 -
835 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
836 -index 5f0197c..91ba33b 100644
837 ---- a/hw/net/rtl8139.c
838 -+++ b/hw/net/rtl8139.c
839 -@@ -2174,28 +2174,30 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
840 - size_t eth_payload_len = 0;
841 -
842 - int proto = be16_to_cpu(*(uint16_t *)(saved_buffer + 12));
843 -- if (proto == ETH_P_IP)
844 -+ if (proto != ETH_P_IP)
845 - {
846 -- DPRINTF("+++ C+ mode has IP packet\n");
847 --
848 -- /* not aligned */
849 -- eth_payload_data = saved_buffer + ETH_HLEN;
850 -- eth_payload_len = saved_size - ETH_HLEN;
851 --
852 -- ip = (ip_header*)eth_payload_data;
853 --
854 -- if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
855 -- DPRINTF("+++ C+ mode packet has bad IP version %d "
856 -- "expected %d\n", IP_HEADER_VERSION(ip),
857 -- IP_HEADER_VERSION_4);
858 -- ip = NULL;
859 -- } else {
860 -- hlen = IP_HEADER_LENGTH(ip);
861 -- ip_protocol = ip->ip_p;
862 -- ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
863 -- }
864 -+ goto skip_offload;
865 - }
866 -
867 -+ DPRINTF("+++ C+ mode has IP packet\n");
868 -+
869 -+ /* not aligned */
870 -+ eth_payload_data = saved_buffer + ETH_HLEN;
871 -+ eth_payload_len = saved_size - ETH_HLEN;
872 -+
873 -+ ip = (ip_header*)eth_payload_data;
874 -+
875 -+ if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
876 -+ DPRINTF("+++ C+ mode packet has bad IP version %d "
877 -+ "expected %d\n", IP_HEADER_VERSION(ip),
878 -+ IP_HEADER_VERSION_4);
879 -+ goto skip_offload;
880 -+ }
881 -+
882 -+ hlen = IP_HEADER_LENGTH(ip);
883 -+ ip_protocol = ip->ip_p;
884 -+ ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
885 -+
886 - if (ip)
887 - {
888 - if (txdw0 & CP_TX_IPCS)
889 -@@ -2391,6 +2393,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
890 - }
891 - }
892 -
893 -+skip_offload:
894 - /* update tally counter */
895 - ++s->tally_counters.TxOk;
896 -
897 ---
898 -2.1.4
899 -
900
901 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch
902 deleted file mode 100644
903 index 7a76a8a..0000000
904 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-2.patch
905 +++ /dev/null
906 @@ -1,373 +0,0 @@
907 -From 2d7d80e8dc160904fa7276cc05da26c062a50066 Mon Sep 17 00:00:00 2001
908 -From: Stefan Hajnoczi <stefanha@××××××.com>
909 -Date: Wed, 15 Jul 2015 18:16:59 +0100
910 -Subject: [PATCH 2/7] rtl8139: drop tautologous if (ip) {...} statement
911 -
912 -The previous patch stopped using the ip pointer as an indicator that the
913 -IP header is present. When we reach the if (ip) {...} statement we know
914 -ip is always non-NULL.
915 -
916 -Remove the if statement to reduce nesting.
917 -
918 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
919 ----
920 - hw/net/rtl8139.c | 305 +++++++++++++++++++++++++++----------------------------
921 - 1 file changed, 151 insertions(+), 154 deletions(-)
922 -
923 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
924 -index 91ba33b..2f12d42 100644
925 ---- a/hw/net/rtl8139.c
926 -+++ b/hw/net/rtl8139.c
927 -@@ -2198,198 +2198,195 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
928 - ip_protocol = ip->ip_p;
929 - ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
930 -
931 -- if (ip)
932 -+ if (txdw0 & CP_TX_IPCS)
933 - {
934 -- if (txdw0 & CP_TX_IPCS)
935 -- {
936 -- DPRINTF("+++ C+ mode need IP checksum\n");
937 -+ DPRINTF("+++ C+ mode need IP checksum\n");
938 -
939 -- if (hlen<sizeof(ip_header) || hlen>eth_payload_len) {/* min header length */
940 -- /* bad packet header len */
941 -- /* or packet too short */
942 -- }
943 -- else
944 -- {
945 -- ip->ip_sum = 0;
946 -- ip->ip_sum = ip_checksum(ip, hlen);
947 -- DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
948 -- hlen, ip->ip_sum);
949 -- }
950 -+ if (hlen<sizeof(ip_header) || hlen>eth_payload_len) {/* min header length */
951 -+ /* bad packet header len */
952 -+ /* or packet too short */
953 - }
954 --
955 -- if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
956 -+ else
957 - {
958 -- int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK;
959 -+ ip->ip_sum = 0;
960 -+ ip->ip_sum = ip_checksum(ip, hlen);
961 -+ DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
962 -+ hlen, ip->ip_sum);
963 -+ }
964 -+ }
965 -
966 -- DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d "
967 -- "frame data %d specified MSS=%d\n", ETH_MTU,
968 -- ip_data_len, saved_size - ETH_HLEN, large_send_mss);
969 -+ if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
970 -+ {
971 -+ int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK;
972 -
973 -- int tcp_send_offset = 0;
974 -- int send_count = 0;
975 -+ DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d "
976 -+ "frame data %d specified MSS=%d\n", ETH_MTU,
977 -+ ip_data_len, saved_size - ETH_HLEN, large_send_mss);
978 -
979 -- /* maximum IP header length is 60 bytes */
980 -- uint8_t saved_ip_header[60];
981 -+ int tcp_send_offset = 0;
982 -+ int send_count = 0;
983 -
984 -- /* save IP header template; data area is used in tcp checksum calculation */
985 -- memcpy(saved_ip_header, eth_payload_data, hlen);
986 -+ /* maximum IP header length is 60 bytes */
987 -+ uint8_t saved_ip_header[60];
988 -
989 -- /* a placeholder for checksum calculation routine in tcp case */
990 -- uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
991 -- // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
992 -+ /* save IP header template; data area is used in tcp checksum calculation */
993 -+ memcpy(saved_ip_header, eth_payload_data, hlen);
994 -
995 -- /* pointer to TCP header */
996 -- tcp_header *p_tcp_hdr = (tcp_header*)(eth_payload_data + hlen);
997 -+ /* a placeholder for checksum calculation routine in tcp case */
998 -+ uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
999 -+ // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
1000 -
1001 -- int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
1002 -+ /* pointer to TCP header */
1003 -+ tcp_header *p_tcp_hdr = (tcp_header*)(eth_payload_data + hlen);
1004 -
1005 -- /* ETH_MTU = ip header len + tcp header len + payload */
1006 -- int tcp_data_len = ip_data_len - tcp_hlen;
1007 -- int tcp_chunk_size = ETH_MTU - hlen - tcp_hlen;
1008 -+ int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
1009 -
1010 -- DPRINTF("+++ C+ mode TSO IP data len %d TCP hlen %d TCP "
1011 -- "data len %d TCP chunk size %d\n", ip_data_len,
1012 -- tcp_hlen, tcp_data_len, tcp_chunk_size);
1013 -+ /* ETH_MTU = ip header len + tcp header len + payload */
1014 -+ int tcp_data_len = ip_data_len - tcp_hlen;
1015 -+ int tcp_chunk_size = ETH_MTU - hlen - tcp_hlen;
1016 -
1017 -- /* note the cycle below overwrites IP header data,
1018 -- but restores it from saved_ip_header before sending packet */
1019 -+ DPRINTF("+++ C+ mode TSO IP data len %d TCP hlen %d TCP "
1020 -+ "data len %d TCP chunk size %d\n", ip_data_len,
1021 -+ tcp_hlen, tcp_data_len, tcp_chunk_size);
1022 -
1023 -- int is_last_frame = 0;
1024 -+ /* note the cycle below overwrites IP header data,
1025 -+ but restores it from saved_ip_header before sending packet */
1026 -
1027 -- for (tcp_send_offset = 0; tcp_send_offset < tcp_data_len; tcp_send_offset += tcp_chunk_size)
1028 -- {
1029 -- uint16_t chunk_size = tcp_chunk_size;
1030 --
1031 -- /* check if this is the last frame */
1032 -- if (tcp_send_offset + tcp_chunk_size >= tcp_data_len)
1033 -- {
1034 -- is_last_frame = 1;
1035 -- chunk_size = tcp_data_len - tcp_send_offset;
1036 -- }
1037 --
1038 -- DPRINTF("+++ C+ mode TSO TCP seqno %08x\n",
1039 -- be32_to_cpu(p_tcp_hdr->th_seq));
1040 --
1041 -- /* add 4 TCP pseudoheader fields */
1042 -- /* copy IP source and destination fields */
1043 -- memcpy(data_to_checksum, saved_ip_header + 12, 8);
1044 --
1045 -- DPRINTF("+++ C+ mode TSO calculating TCP checksum for "
1046 -- "packet with %d bytes data\n", tcp_hlen +
1047 -- chunk_size);
1048 --
1049 -- if (tcp_send_offset)
1050 -- {
1051 -- memcpy((uint8_t*)p_tcp_hdr + tcp_hlen, (uint8_t*)p_tcp_hdr + tcp_hlen + tcp_send_offset, chunk_size);
1052 -- }
1053 --
1054 -- /* keep PUSH and FIN flags only for the last frame */
1055 -- if (!is_last_frame)
1056 -- {
1057 -- TCP_HEADER_CLEAR_FLAGS(p_tcp_hdr, TCP_FLAG_PUSH|TCP_FLAG_FIN);
1058 -- }
1059 --
1060 -- /* recalculate TCP checksum */
1061 -- ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
1062 -- p_tcpip_hdr->zeros = 0;
1063 -- p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
1064 -- p_tcpip_hdr->ip_payload = cpu_to_be16(tcp_hlen + chunk_size);
1065 --
1066 -- p_tcp_hdr->th_sum = 0;
1067 --
1068 -- int tcp_checksum = ip_checksum(data_to_checksum, tcp_hlen + chunk_size + 12);
1069 -- DPRINTF("+++ C+ mode TSO TCP checksum %04x\n",
1070 -- tcp_checksum);
1071 --
1072 -- p_tcp_hdr->th_sum = tcp_checksum;
1073 --
1074 -- /* restore IP header */
1075 -- memcpy(eth_payload_data, saved_ip_header, hlen);
1076 --
1077 -- /* set IP data length and recalculate IP checksum */
1078 -- ip->ip_len = cpu_to_be16(hlen + tcp_hlen + chunk_size);
1079 --
1080 -- /* increment IP id for subsequent frames */
1081 -- ip->ip_id = cpu_to_be16(tcp_send_offset/tcp_chunk_size + be16_to_cpu(ip->ip_id));
1082 --
1083 -- ip->ip_sum = 0;
1084 -- ip->ip_sum = ip_checksum(eth_payload_data, hlen);
1085 -- DPRINTF("+++ C+ mode TSO IP header len=%d "
1086 -- "checksum=%04x\n", hlen, ip->ip_sum);
1087 --
1088 -- int tso_send_size = ETH_HLEN + hlen + tcp_hlen + chunk_size;
1089 -- DPRINTF("+++ C+ mode TSO transferring packet size "
1090 -- "%d\n", tso_send_size);
1091 -- rtl8139_transfer_frame(s, saved_buffer, tso_send_size,
1092 -- 0, (uint8_t *) dot1q_buffer);
1093 --
1094 -- /* add transferred count to TCP sequence number */
1095 -- p_tcp_hdr->th_seq = cpu_to_be32(chunk_size + be32_to_cpu(p_tcp_hdr->th_seq));
1096 -- ++send_count;
1097 -- }
1098 -+ int is_last_frame = 0;
1099 -
1100 -- /* Stop sending this frame */
1101 -- saved_size = 0;
1102 -- }
1103 -- else if (txdw0 & (CP_TX_TCPCS|CP_TX_UDPCS))
1104 -+ for (tcp_send_offset = 0; tcp_send_offset < tcp_data_len; tcp_send_offset += tcp_chunk_size)
1105 - {
1106 -- DPRINTF("+++ C+ mode need TCP or UDP checksum\n");
1107 -+ uint16_t chunk_size = tcp_chunk_size;
1108 -
1109 -- /* maximum IP header length is 60 bytes */
1110 -- uint8_t saved_ip_header[60];
1111 -- memcpy(saved_ip_header, eth_payload_data, hlen);
1112 -+ /* check if this is the last frame */
1113 -+ if (tcp_send_offset + tcp_chunk_size >= tcp_data_len)
1114 -+ {
1115 -+ is_last_frame = 1;
1116 -+ chunk_size = tcp_data_len - tcp_send_offset;
1117 -+ }
1118 -
1119 -- uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
1120 -- // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
1121 -+ DPRINTF("+++ C+ mode TSO TCP seqno %08x\n",
1122 -+ be32_to_cpu(p_tcp_hdr->th_seq));
1123 -
1124 - /* add 4 TCP pseudoheader fields */
1125 - /* copy IP source and destination fields */
1126 - memcpy(data_to_checksum, saved_ip_header + 12, 8);
1127 -
1128 -- if ((txdw0 & CP_TX_TCPCS) && ip_protocol == IP_PROTO_TCP)
1129 -+ DPRINTF("+++ C+ mode TSO calculating TCP checksum for "
1130 -+ "packet with %d bytes data\n", tcp_hlen +
1131 -+ chunk_size);
1132 -+
1133 -+ if (tcp_send_offset)
1134 - {
1135 -- DPRINTF("+++ C+ mode calculating TCP checksum for "
1136 -- "packet with %d bytes data\n", ip_data_len);
1137 -+ memcpy((uint8_t*)p_tcp_hdr + tcp_hlen, (uint8_t*)p_tcp_hdr + tcp_hlen + tcp_send_offset, chunk_size);
1138 -+ }
1139 -
1140 -- ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
1141 -- p_tcpip_hdr->zeros = 0;
1142 -- p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
1143 -- p_tcpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
1144 -+ /* keep PUSH and FIN flags only for the last frame */
1145 -+ if (!is_last_frame)
1146 -+ {
1147 -+ TCP_HEADER_CLEAR_FLAGS(p_tcp_hdr, TCP_FLAG_PUSH|TCP_FLAG_FIN);
1148 -+ }
1149 -
1150 -- tcp_header* p_tcp_hdr = (tcp_header *) (data_to_checksum+12);
1151 -+ /* recalculate TCP checksum */
1152 -+ ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
1153 -+ p_tcpip_hdr->zeros = 0;
1154 -+ p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
1155 -+ p_tcpip_hdr->ip_payload = cpu_to_be16(tcp_hlen + chunk_size);
1156 -
1157 -- p_tcp_hdr->th_sum = 0;
1158 -+ p_tcp_hdr->th_sum = 0;
1159 -
1160 -- int tcp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
1161 -- DPRINTF("+++ C+ mode TCP checksum %04x\n",
1162 -- tcp_checksum);
1163 -+ int tcp_checksum = ip_checksum(data_to_checksum, tcp_hlen + chunk_size + 12);
1164 -+ DPRINTF("+++ C+ mode TSO TCP checksum %04x\n",
1165 -+ tcp_checksum);
1166 -
1167 -- p_tcp_hdr->th_sum = tcp_checksum;
1168 -- }
1169 -- else if ((txdw0 & CP_TX_UDPCS) && ip_protocol == IP_PROTO_UDP)
1170 -- {
1171 -- DPRINTF("+++ C+ mode calculating UDP checksum for "
1172 -- "packet with %d bytes data\n", ip_data_len);
1173 -+ p_tcp_hdr->th_sum = tcp_checksum;
1174 -
1175 -- ip_pseudo_header *p_udpip_hdr = (ip_pseudo_header *)data_to_checksum;
1176 -- p_udpip_hdr->zeros = 0;
1177 -- p_udpip_hdr->ip_proto = IP_PROTO_UDP;
1178 -- p_udpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
1179 -+ /* restore IP header */
1180 -+ memcpy(eth_payload_data, saved_ip_header, hlen);
1181 -
1182 -- udp_header *p_udp_hdr = (udp_header *) (data_to_checksum+12);
1183 -+ /* set IP data length and recalculate IP checksum */
1184 -+ ip->ip_len = cpu_to_be16(hlen + tcp_hlen + chunk_size);
1185 -
1186 -- p_udp_hdr->uh_sum = 0;
1187 -+ /* increment IP id for subsequent frames */
1188 -+ ip->ip_id = cpu_to_be16(tcp_send_offset/tcp_chunk_size + be16_to_cpu(ip->ip_id));
1189 -
1190 -- int udp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
1191 -- DPRINTF("+++ C+ mode UDP checksum %04x\n",
1192 -- udp_checksum);
1193 -+ ip->ip_sum = 0;
1194 -+ ip->ip_sum = ip_checksum(eth_payload_data, hlen);
1195 -+ DPRINTF("+++ C+ mode TSO IP header len=%d "
1196 -+ "checksum=%04x\n", hlen, ip->ip_sum);
1197 -
1198 -- p_udp_hdr->uh_sum = udp_checksum;
1199 -- }
1200 -+ int tso_send_size = ETH_HLEN + hlen + tcp_hlen + chunk_size;
1201 -+ DPRINTF("+++ C+ mode TSO transferring packet size "
1202 -+ "%d\n", tso_send_size);
1203 -+ rtl8139_transfer_frame(s, saved_buffer, tso_send_size,
1204 -+ 0, (uint8_t *) dot1q_buffer);
1205 -
1206 -- /* restore IP header */
1207 -- memcpy(eth_payload_data, saved_ip_header, hlen);
1208 -+ /* add transferred count to TCP sequence number */
1209 -+ p_tcp_hdr->th_seq = cpu_to_be32(chunk_size + be32_to_cpu(p_tcp_hdr->th_seq));
1210 -+ ++send_count;
1211 - }
1212 -+
1213 -+ /* Stop sending this frame */
1214 -+ saved_size = 0;
1215 -+ }
1216 -+ else if (txdw0 & (CP_TX_TCPCS|CP_TX_UDPCS))
1217 -+ {
1218 -+ DPRINTF("+++ C+ mode need TCP or UDP checksum\n");
1219 -+
1220 -+ /* maximum IP header length is 60 bytes */
1221 -+ uint8_t saved_ip_header[60];
1222 -+ memcpy(saved_ip_header, eth_payload_data, hlen);
1223 -+
1224 -+ uint8_t *data_to_checksum = eth_payload_data + hlen - 12;
1225 -+ // size_t data_to_checksum_len = eth_payload_len - hlen + 12;
1226 -+
1227 -+ /* add 4 TCP pseudoheader fields */
1228 -+ /* copy IP source and destination fields */
1229 -+ memcpy(data_to_checksum, saved_ip_header + 12, 8);
1230 -+
1231 -+ if ((txdw0 & CP_TX_TCPCS) && ip_protocol == IP_PROTO_TCP)
1232 -+ {
1233 -+ DPRINTF("+++ C+ mode calculating TCP checksum for "
1234 -+ "packet with %d bytes data\n", ip_data_len);
1235 -+
1236 -+ ip_pseudo_header *p_tcpip_hdr = (ip_pseudo_header *)data_to_checksum;
1237 -+ p_tcpip_hdr->zeros = 0;
1238 -+ p_tcpip_hdr->ip_proto = IP_PROTO_TCP;
1239 -+ p_tcpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
1240 -+
1241 -+ tcp_header* p_tcp_hdr = (tcp_header *) (data_to_checksum+12);
1242 -+
1243 -+ p_tcp_hdr->th_sum = 0;
1244 -+
1245 -+ int tcp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
1246 -+ DPRINTF("+++ C+ mode TCP checksum %04x\n",
1247 -+ tcp_checksum);
1248 -+
1249 -+ p_tcp_hdr->th_sum = tcp_checksum;
1250 -+ }
1251 -+ else if ((txdw0 & CP_TX_UDPCS) && ip_protocol == IP_PROTO_UDP)
1252 -+ {
1253 -+ DPRINTF("+++ C+ mode calculating UDP checksum for "
1254 -+ "packet with %d bytes data\n", ip_data_len);
1255 -+
1256 -+ ip_pseudo_header *p_udpip_hdr = (ip_pseudo_header *)data_to_checksum;
1257 -+ p_udpip_hdr->zeros = 0;
1258 -+ p_udpip_hdr->ip_proto = IP_PROTO_UDP;
1259 -+ p_udpip_hdr->ip_payload = cpu_to_be16(ip_data_len);
1260 -+
1261 -+ udp_header *p_udp_hdr = (udp_header *) (data_to_checksum+12);
1262 -+
1263 -+ p_udp_hdr->uh_sum = 0;
1264 -+
1265 -+ int udp_checksum = ip_checksum(data_to_checksum, ip_data_len + 12);
1266 -+ DPRINTF("+++ C+ mode UDP checksum %04x\n",
1267 -+ udp_checksum);
1268 -+
1269 -+ p_udp_hdr->uh_sum = udp_checksum;
1270 -+ }
1271 -+
1272 -+ /* restore IP header */
1273 -+ memcpy(eth_payload_data, saved_ip_header, hlen);
1274 - }
1275 - }
1276 -
1277 ---
1278 -2.1.4
1279 -
1280
1281 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch
1282 deleted file mode 100644
1283 index 5676f46..0000000
1284 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-3.patch
1285 +++ /dev/null
1286 @@ -1,39 +0,0 @@
1287 -From 043d28507ef7c5fdc34866f5e3b27a72bd0cd072 Mon Sep 17 00:00:00 2001
1288 -From: Stefan Hajnoczi <stefanha@××××××.com>
1289 -Date: Wed, 15 Jul 2015 18:17:00 +0100
1290 -Subject: [PATCH 3/7] rtl8139: skip offload on short Ethernet/IP header
1291 -
1292 -Transmit offload features access Ethernet and IP headers the packet. If
1293 -the packet is too short we must not attempt to access header fields:
1294 -
1295 - int proto = be16_to_cpu(*(uint16_t *)(saved_buffer + 12));
1296 - ...
1297 - eth_payload_data = saved_buffer + ETH_HLEN;
1298 - ...
1299 - ip = (ip_header*)eth_payload_data;
1300 - if (IP_HEADER_VERSION(ip) != IP_HEADER_VERSION_4) {
1301 -
1302 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
1303 ----
1304 - hw/net/rtl8139.c | 5 +++++
1305 - 1 file changed, 5 insertions(+)
1306 -
1307 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1308 -index 2f12d42..d377b6b 100644
1309 ---- a/hw/net/rtl8139.c
1310 -+++ b/hw/net/rtl8139.c
1311 -@@ -2164,6 +2164,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
1312 - {
1313 - DPRINTF("+++ C+ mode offloaded task checksum\n");
1314 -
1315 -+ /* Large enough for Ethernet and IP headers? */
1316 -+ if (saved_size < ETH_HLEN + sizeof(ip_header)) {
1317 -+ goto skip_offload;
1318 -+ }
1319 -+
1320 - /* ip packet header */
1321 - ip_header *ip = NULL;
1322 - int hlen = 0;
1323 ---
1324 -2.1.4
1325 -
1326
1327 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch
1328 deleted file mode 100644
1329 index 495d8d6..0000000
1330 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-4.patch
1331 +++ /dev/null
1332 @@ -1,53 +0,0 @@
1333 -From 5a75d242fe019d05b46ef9bc330a6892525c84a7 Mon Sep 17 00:00:00 2001
1334 -From: Stefan Hajnoczi <stefanha@××××××.com>
1335 -Date: Wed, 15 Jul 2015 18:17:01 +0100
1336 -Subject: [PATCH 4/7] rtl8139: check IP Header Length field
1337 -
1338 -The IP Header Length field was only checked in the IP checksum case, but
1339 -is used in other cases too.
1340 -
1341 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
1342 ----
1343 - hw/net/rtl8139.c | 19 ++++++++-----------
1344 - 1 file changed, 8 insertions(+), 11 deletions(-)
1345 -
1346 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1347 -index d377b6b..cd5ac05 100644
1348 ---- a/hw/net/rtl8139.c
1349 -+++ b/hw/net/rtl8139.c
1350 -@@ -2200,6 +2200,10 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
1351 - }
1352 -
1353 - hlen = IP_HEADER_LENGTH(ip);
1354 -+ if (hlen < sizeof(ip_header) || hlen > eth_payload_len) {
1355 -+ goto skip_offload;
1356 -+ }
1357 -+
1358 - ip_protocol = ip->ip_p;
1359 - ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
1360 -
1361 -@@ -2207,17 +2211,10 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
1362 - {
1363 - DPRINTF("+++ C+ mode need IP checksum\n");
1364 -
1365 -- if (hlen<sizeof(ip_header) || hlen>eth_payload_len) {/* min header length */
1366 -- /* bad packet header len */
1367 -- /* or packet too short */
1368 -- }
1369 -- else
1370 -- {
1371 -- ip->ip_sum = 0;
1372 -- ip->ip_sum = ip_checksum(ip, hlen);
1373 -- DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
1374 -- hlen, ip->ip_sum);
1375 -- }
1376 -+ ip->ip_sum = 0;
1377 -+ ip->ip_sum = ip_checksum(ip, hlen);
1378 -+ DPRINTF("+++ C+ mode IP header len=%d checksum=%04x\n",
1379 -+ hlen, ip->ip_sum);
1380 - }
1381 -
1382 - if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
1383 ---
1384 -2.1.4
1385 -
1386
1387 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch
1388 deleted file mode 100644
1389 index e633ea6..0000000
1390 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-5.patch
1391 +++ /dev/null
1392 @@ -1,34 +0,0 @@
1393 -From 6c79ea275d72bc1fd88bdcf1e7d231b2c9c865de Mon Sep 17 00:00:00 2001
1394 -From: Stefan Hajnoczi <stefanha@××××××.com>
1395 -Date: Wed, 15 Jul 2015 18:17:02 +0100
1396 -Subject: [PATCH 5/7] rtl8139: check IP Total Length field
1397 -
1398 -The IP Total Length field includes the IP header and data. Make sure it
1399 -is valid and does not exceed the Ethernet payload size.
1400 -
1401 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
1402 ----
1403 - hw/net/rtl8139.c | 7 ++++++-
1404 - 1 file changed, 6 insertions(+), 1 deletion(-)
1405 -
1406 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1407 -index cd5ac05..ed2b23b 100644
1408 ---- a/hw/net/rtl8139.c
1409 -+++ b/hw/net/rtl8139.c
1410 -@@ -2205,7 +2205,12 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
1411 - }
1412 -
1413 - ip_protocol = ip->ip_p;
1414 -- ip_data_len = be16_to_cpu(ip->ip_len) - hlen;
1415 -+
1416 -+ ip_data_len = be16_to_cpu(ip->ip_len);
1417 -+ if (ip_data_len < hlen || ip_data_len > eth_payload_len) {
1418 -+ goto skip_offload;
1419 -+ }
1420 -+ ip_data_len -= hlen;
1421 -
1422 - if (txdw0 & CP_TX_IPCS)
1423 - {
1424 ---
1425 -2.1.4
1426 -
1427
1428 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch
1429 deleted file mode 100644
1430 index dd716a6..0000000
1431 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-6.patch
1432 +++ /dev/null
1433 @@ -1,35 +0,0 @@
1434 -From 30aa7be430e7c982e9163f3bcc745d3aa57b6aa4 Mon Sep 17 00:00:00 2001
1435 -From: Stefan Hajnoczi <stefanha@××××××.com>
1436 -Date: Wed, 15 Jul 2015 18:17:03 +0100
1437 -Subject: [PATCH 6/7] rtl8139: skip offload on short TCP header
1438 -
1439 -TCP Large Segment Offload accesses the TCP header in the packet. If the
1440 -packet is too short we must not attempt to access header fields:
1441 -
1442 - tcp_header *p_tcp_hdr = (tcp_header*)(eth_payload_data + hlen);
1443 - int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
1444 -
1445 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
1446 ----
1447 - hw/net/rtl8139.c | 5 +++++
1448 - 1 file changed, 5 insertions(+)
1449 -
1450 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1451 -index ed2b23b..c8f0df9 100644
1452 ---- a/hw/net/rtl8139.c
1453 -+++ b/hw/net/rtl8139.c
1454 -@@ -2224,6 +2224,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
1455 -
1456 - if ((txdw0 & CP_TX_LGSEN) && ip_protocol == IP_PROTO_TCP)
1457 - {
1458 -+ /* Large enough for the TCP header? */
1459 -+ if (ip_data_len < sizeof(tcp_header)) {
1460 -+ goto skip_offload;
1461 -+ }
1462 -+
1463 - int large_send_mss = (txdw0 >> 16) & CP_TC_LGSEN_MSS_MASK;
1464 -
1465 - DPRINTF("+++ C+ mode offloaded task TSO MTU=%d IP data %d "
1466 ---
1467 -2.1.4
1468 -
1469
1470 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch
1471 deleted file mode 100644
1472 index 4c0ad79..0000000
1473 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5165-7.patch
1474 +++ /dev/null
1475 @@ -1,32 +0,0 @@
1476 -From 9a084807bf6ca7c16d997a236d304111894a6539 Mon Sep 17 00:00:00 2001
1477 -From: Stefan Hajnoczi <stefanha@××××××.com>
1478 -Date: Wed, 15 Jul 2015 18:17:04 +0100
1479 -Subject: [PATCH 7/7] rtl8139: check TCP Data Offset field
1480 -
1481 -The TCP Data Offset field contains the length of the header. Make sure
1482 -it is valid and does not exceed the IP data length.
1483 -
1484 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
1485 ----
1486 - hw/net/rtl8139.c | 5 +++++
1487 - 1 file changed, 5 insertions(+)
1488 -
1489 -diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
1490 -index c8f0df9..2df4a51 100644
1491 ---- a/hw/net/rtl8139.c
1492 -+++ b/hw/net/rtl8139.c
1493 -@@ -2253,6 +2253,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
1494 -
1495 - int tcp_hlen = TCP_HEADER_DATA_OFFSET(p_tcp_hdr);
1496 -
1497 -+ /* Invalid TCP data offset? */
1498 -+ if (tcp_hlen < sizeof(tcp_header) || tcp_hlen > ip_data_len) {
1499 -+ goto skip_offload;
1500 -+ }
1501 -+
1502 - /* ETH_MTU = ip header len + tcp header len + payload */
1503 - int tcp_data_len = ip_data_len - tcp_hlen;
1504 - int tcp_chunk_size = ETH_MTU - hlen - tcp_hlen;
1505 ---
1506 -2.1.4
1507 -
1508
1509 diff --git a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5166.patch b/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5166.patch
1510 deleted file mode 100644
1511 index fc41d7b..0000000
1512 --- a/app-emulation/qemu/files/qemu-2.3.0-CVE-2015-5166.patch
1513 +++ /dev/null
1514 @@ -1,36 +0,0 @@
1515 -From: Stefano Stabellini <stefano.stabellini@×××××××××.com>
1516 -
1517 -Fix release_drive on unplugged devices (pci_piix3_xen_ide_unplug)
1518 -
1519 -pci_piix3_xen_ide_unplug should completely unhook the unplugged
1520 -IDEDevice from the corresponding BlockBackend, otherwise the next call
1521 -to release_drive will try to detach the drive again.
1522 -
1523 -Suggested-by: Kevin Wolf <kwolf@××××××.com>
1524 -Signed-off-by: Stefano Stabellini <stefano.stabellini@×××××××××.com>
1525 -
1526 -diff --git a/hw/ide/piix.c b/hw/ide/piix.c
1527 -index adb6649..5a26c86 100644
1528 ---- a/hw/ide/piix.c
1529 -+++ b/hw/ide/piix.c
1530 -@@ -169,6 +169,7 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
1531 - PCIIDEState *pci_ide;
1532 - DriveInfo *di;
1533 - int i;
1534 -+ IDEDevice *idedev;
1535 -
1536 - pci_ide = PCI_IDE(dev);
1537 -
1538 -@@ -181,6 +182,12 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev)
1539 - blk_detach_dev(blk, ds);
1540 - }
1541 - pci_ide->bus[di->bus].ifs[di->unit].blk = NULL;
1542 -+ if (!(i % 2)) {
1543 -+ idedev = pci_ide->bus[di->bus].master;
1544 -+ } else {
1545 -+ idedev = pci_ide->bus[di->bus].slave;
1546 -+ }
1547 -+ idedev->conf.blk = NULL;
1548 - blk_unref(blk);
1549 - }
1550 - }
1551
1552 diff --git a/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch b/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch
1553 deleted file mode 100644
1554 index d84797f..0000000
1555 --- a/app-emulation/qemu/files/qemu-2.3.0-virtio-serial.patch
1556 +++ /dev/null
1557 @@ -1,34 +0,0 @@
1558 -https://bugs.gentoo.org/557206
1559 -
1560 -From 7882080388be5088e72c425b02223c02e6cb4295 Mon Sep 17 00:00:00 2001
1561 -From: "Michael S. Tsirkin" <mst@××××××.com>
1562 -Date: Thu, 23 Jul 2015 17:52:02 +0300
1563 -Subject: [PATCH] virtio-serial: fix ANY_LAYOUT
1564 -
1565 -Don't assume a specific layout for control messages.
1566 -Required by virtio 1.
1567 -
1568 -Signed-off-by: Michael S. Tsirkin <mst@××××××.com>
1569 -Reviewed-by: Amit Shah <amit.shah@××××××.com>
1570 -Reviewed-by: Jason Wang <jasowang@××××××.com>
1571 ----
1572 - hw/char/virtio-serial-bus.c | 3 ++-
1573 - 1 file changed, 2 insertions(+), 1 deletion(-)
1574 -
1575 -diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
1576 -index 78c73e5..929e49c 100644
1577 ---- a/hw/char/virtio-serial-bus.c
1578 -+++ b/hw/char/virtio-serial-bus.c
1579 -@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
1580 - return 0;
1581 - }
1582 -
1583 -- memcpy(elem.in_sg[0].iov_base, buf, len);
1584 -+ /* TODO: detect a buffer that's too short, set NEEDS_RESET */
1585 -+ iov_from_buf(elem.in_sg, elem.in_num, 0, buf, len);
1586 -
1587 - virtqueue_push(vq, &elem, len);
1588 - virtio_notify(VIRTIO_DEVICE(vser), vq);
1589 ---
1590 -2.4.4
1591 -
1592
1593 diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch
1594 deleted file mode 100644
1595 index de7090d..0000000
1596 --- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-5225.patch
1597 +++ /dev/null
1598 @@ -1,86 +0,0 @@
1599 -https://bugs.gentoo.org/558416
1600 -
1601 -fix from upstream git
1602 -
1603 -From eb8934b0418b3b1d125edddc4fc334a54334a49b Mon Sep 17 00:00:00 2001
1604 -From: Gerd Hoffmann <kraxel@××××××.com>
1605 -Date: Mon, 17 Aug 2015 19:56:53 +0200
1606 -Subject: [PATCH] vnc: fix memory corruption (CVE-2015-5225)
1607 -MIME-Version: 1.0
1608 -Content-Type: text/plain; charset=UTF-8
1609 -Content-Transfer-Encoding: 8bit
1610 -
1611 -The _cmp_bytes variable added by commit "bea60dd ui/vnc: fix potential
1612 -memory corruption issues" can become negative. Result is (possibly
1613 -exploitable) memory corruption. Reason for that is it uses the stride
1614 -instead of bytes per scanline to apply limits.
1615 -
1616 -For the server surface is is actually fine. vnc creates that itself,
1617 -there is never any padding and thus scanline length always equals stride.
1618 -
1619 -For the guest surface scanline length and stride are typically identical
1620 -too, but it doesn't has to be that way. So add and use a new variable
1621 -(guest_ll) for the guest scanline length. Also rename min_stride to
1622 -line_bytes to make more clear what it actually is. Finally sprinkle
1623 -in an assert() to make sure we never use a negative _cmp_bytes again.
1624 -
1625 -Reported-by: 范祚至(库特) <zuozhi.fzz@×××××××××××.com>
1626 -Reviewed-by: P J P <ppandit@××××××.com>
1627 -Signed-off-by: Gerd Hoffmann <kraxel@××××××.com>
1628 ----
1629 - ui/vnc.c | 15 ++++++++++-----
1630 - 1 file changed, 10 insertions(+), 5 deletions(-)
1631 -
1632 -diff --git a/ui/vnc.c b/ui/vnc.c
1633 -index e26973a..caf82f5 100644
1634 ---- a/ui/vnc.c
1635 -+++ b/ui/vnc.c
1636 -@@ -2872,7 +2872,7 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
1637 - pixman_image_get_width(vd->server));
1638 - int height = MIN(pixman_image_get_height(vd->guest.fb),
1639 - pixman_image_get_height(vd->server));
1640 -- int cmp_bytes, server_stride, min_stride, guest_stride, y = 0;
1641 -+ int cmp_bytes, server_stride, line_bytes, guest_ll, guest_stride, y = 0;
1642 - uint8_t *guest_row0 = NULL, *server_row0;
1643 - VncState *vs;
1644 - int has_dirty = 0;
1645 -@@ -2891,17 +2891,21 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
1646 - * Update server dirty map.
1647 - */
1648 - server_row0 = (uint8_t *)pixman_image_get_data(vd->server);
1649 -- server_stride = guest_stride = pixman_image_get_stride(vd->server);
1650 -+ server_stride = guest_stride = guest_ll =
1651 -+ pixman_image_get_stride(vd->server);
1652 - cmp_bytes = MIN(VNC_DIRTY_PIXELS_PER_BIT * VNC_SERVER_FB_BYTES,
1653 - server_stride);
1654 - if (vd->guest.format != VNC_SERVER_FB_FORMAT) {
1655 - int width = pixman_image_get_width(vd->server);
1656 - tmpbuf = qemu_pixman_linebuf_create(VNC_SERVER_FB_FORMAT, width);
1657 - } else {
1658 -+ int guest_bpp =
1659 -+ PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
1660 - guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
1661 - guest_stride = pixman_image_get_stride(vd->guest.fb);
1662 -+ guest_ll = pixman_image_get_width(vd->guest.fb) * ((guest_bpp + 7) / 8);
1663 - }
1664 -- min_stride = MIN(server_stride, guest_stride);
1665 -+ line_bytes = MIN(server_stride, guest_ll);
1666 -
1667 - for (;;) {
1668 - int x;
1669 -@@ -2932,9 +2936,10 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
1670 - if (!test_and_clear_bit(x, vd->guest.dirty[y])) {
1671 - continue;
1672 - }
1673 -- if ((x + 1) * cmp_bytes > min_stride) {
1674 -- _cmp_bytes = min_stride - x * cmp_bytes;
1675 -+ if ((x + 1) * cmp_bytes > line_bytes) {
1676 -+ _cmp_bytes = line_bytes - x * cmp_bytes;
1677 - }
1678 -+ assert(_cmp_bytes >= 0);
1679 - if (memcmp(server_ptr, guest_ptr, _cmp_bytes) == 0) {
1680 - continue;
1681 - }
1682 ---
1683 -2.5.0
1684 -
1685
1686 diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch
1687 deleted file mode 100644
1688 index 69dd66a..0000000
1689 --- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-6855.patch
1690 +++ /dev/null
1691 @@ -1,146 +0,0 @@
1692 -https://bugs.gentoo.org/560422
1693 -
1694 -From d9033e1d3aa666c5071580617a57bd853c5d794a Mon Sep 17 00:00:00 2001
1695 -From: John Snow <jsnow@××××××.com>
1696 -Date: Thu, 17 Sep 2015 14:17:05 -0400
1697 -Subject: [PATCH] ide: fix ATAPI command permissions
1698 -
1699 -We're a little too lenient with what we'll let an ATAPI drive handle.
1700 -Clamp down on the IDE command execution table to remove CD_OK permissions
1701 -from commands that are not and have never been ATAPI commands.
1702 -
1703 -For ATAPI command validity, please see:
1704 -- ATA4 Section 6.5 ("PACKET Command feature set")
1705 -- ATA8/ACS Section 4.3 ("The PACKET feature set")
1706 -- ACS3 Section 4.3 ("The PACKET feature set")
1707 -
1708 -ACS3 has a historical command validity table in Table B.4
1709 -("Historical Command Assignments") that can be referenced to find when
1710 -a command was introduced, deprecated, obsoleted, etc.
1711 -
1712 -The only reference for ATAPI command validity is by checking that
1713 -version's PACKET feature set section.
1714 -
1715 -ATAPI was introduced by T13 into ATA4, all commands retired prior to ATA4
1716 -therefore are assumed to have never been ATAPI commands.
1717 -
1718 -Mandatory commands, as listed in ATA8-ACS3, are:
1719 -
1720 -- DEVICE RESET
1721 -- EXECUTE DEVICE DIAGNOSTIC
1722 -- IDENTIFY DEVICE
1723 -- IDENTIFY PACKET DEVICE
1724 -- NOP
1725 -- PACKET
1726 -- READ SECTOR(S)
1727 -- SET FEATURES
1728 -
1729 -Optional commands as listed in ATA8-ACS3, are:
1730 -
1731 -- FLUSH CACHE
1732 -- READ LOG DMA EXT
1733 -- READ LOG EXT
1734 -- WRITE LOG DMA EXT
1735 -- WRITE LOG EXT
1736 -
1737 -All other commands are illegal to send to an ATAPI device and should
1738 -be rejected by the device.
1739 -
1740 -CD_OK removal justifications:
1741 -
1742 -0x06 WIN_DSM Defined in ACS2. Not valid for ATAPI.
1743 -0x21 WIN_READ_ONCE Retired in ATA5. Not ATAPI in ATA4.
1744 -0x94 WIN_STANDBYNOW2 Retired in ATA4. Did not coexist with ATAPI.
1745 -0x95 WIN_IDLEIMMEDIATE2 Retired in ATA4. Did not coexist with ATAPI.
1746 -0x96 WIN_STANDBY2 Retired in ATA4. Did not coexist with ATAPI.
1747 -0x97 WIN_SETIDLE2 Retired in ATA4. Did not coexist with ATAPI.
1748 -0x98 WIN_CHECKPOWERMODE2 Retired in ATA4. Did not coexist with ATAPI.
1749 -0x99 WIN_SLEEPNOW2 Retired in ATA4. Did not coexist with ATAPI.
1750 -0xE0 WIN_STANDBYNOW1 Not part of ATAPI in ATA4, ACS or ACS3.
1751 -0xE1 WIN_IDLEIMMDIATE Not part of ATAPI in ATA4, ACS or ACS3.
1752 -0xE2 WIN_STANDBY Not part of ATAPI in ATA4, ACS or ACS3.
1753 -0xE3 WIN_SETIDLE1 Not part of ATAPI in ATA4, ACS or ACS3.
1754 -0xE4 WIN_CHECKPOWERMODE1 Not part of ATAPI in ATA4, ACS or ACS3.
1755 -0xE5 WIN_SLEEPNOW1 Not part of ATAPI in ATA4, ACS or ACS3.
1756 -0xF8 WIN_READ_NATIVE_MAX Obsoleted in ACS3. Not ATAPI in ATA4 or ACS.
1757 -
1758 -This patch fixes a divide by zero fault that can be caused by sending
1759 -the WIN_READ_NATIVE_MAX command to an ATAPI drive, which causes it to
1760 -attempt to use zeroed CHS values to perform sector arithmetic.
1761 -
1762 -Reported-by: Qinghao Tang <luodalongde@×××××.com>
1763 -Signed-off-by: John Snow <jsnow@××××××.com>
1764 -Reviewed-by: Markus Armbruster <armbru@××××××.com>
1765 -Message-id: 1441816082-21031-1-git-send-email-jsnow@××××××.com
1766 -CC: qemu-stable@××××××.org
1767 ----
1768 - hw/ide/core.c | 30 +++++++++++++++---------------
1769 - 1 file changed, 15 insertions(+), 15 deletions(-)
1770 -
1771 -diff --git a/hw/ide/core.c b/hw/ide/core.c
1772 -index 8ba04df..1cc6945 100644
1773 ---- a/hw/ide/core.c
1774 -+++ b/hw/ide/core.c
1775 -@@ -1746,11 +1746,11 @@ static const struct {
1776 - } ide_cmd_table[0x100] = {
1777 - /* NOP not implemented, mandatory for CD */
1778 - [CFA_REQ_EXT_ERROR_CODE] = { cmd_cfa_req_ext_error_code, CFA_OK },
1779 -- [WIN_DSM] = { cmd_data_set_management, ALL_OK },
1780 -+ [WIN_DSM] = { cmd_data_set_management, HD_CFA_OK },
1781 - [WIN_DEVICE_RESET] = { cmd_device_reset, CD_OK },
1782 - [WIN_RECAL] = { cmd_nop, HD_CFA_OK | SET_DSC},
1783 - [WIN_READ] = { cmd_read_pio, ALL_OK },
1784 -- [WIN_READ_ONCE] = { cmd_read_pio, ALL_OK },
1785 -+ [WIN_READ_ONCE] = { cmd_read_pio, HD_CFA_OK },
1786 - [WIN_READ_EXT] = { cmd_read_pio, HD_CFA_OK },
1787 - [WIN_READDMA_EXT] = { cmd_read_dma, HD_CFA_OK },
1788 - [WIN_READ_NATIVE_MAX_EXT] = { cmd_read_native_max, HD_CFA_OK | SET_DSC },
1789 -@@ -1769,12 +1769,12 @@ static const struct {
1790 - [CFA_TRANSLATE_SECTOR] = { cmd_cfa_translate_sector, CFA_OK },
1791 - [WIN_DIAGNOSE] = { cmd_exec_dev_diagnostic, ALL_OK },
1792 - [WIN_SPECIFY] = { cmd_nop, HD_CFA_OK | SET_DSC },
1793 -- [WIN_STANDBYNOW2] = { cmd_nop, ALL_OK },
1794 -- [WIN_IDLEIMMEDIATE2] = { cmd_nop, ALL_OK },
1795 -- [WIN_STANDBY2] = { cmd_nop, ALL_OK },
1796 -- [WIN_SETIDLE2] = { cmd_nop, ALL_OK },
1797 -- [WIN_CHECKPOWERMODE2] = { cmd_check_power_mode, ALL_OK | SET_DSC },
1798 -- [WIN_SLEEPNOW2] = { cmd_nop, ALL_OK },
1799 -+ [WIN_STANDBYNOW2] = { cmd_nop, HD_CFA_OK },
1800 -+ [WIN_IDLEIMMEDIATE2] = { cmd_nop, HD_CFA_OK },
1801 -+ [WIN_STANDBY2] = { cmd_nop, HD_CFA_OK },
1802 -+ [WIN_SETIDLE2] = { cmd_nop, HD_CFA_OK },
1803 -+ [WIN_CHECKPOWERMODE2] = { cmd_check_power_mode, HD_CFA_OK | SET_DSC },
1804 -+ [WIN_SLEEPNOW2] = { cmd_nop, HD_CFA_OK },
1805 - [WIN_PACKETCMD] = { cmd_packet, CD_OK },
1806 - [WIN_PIDENTIFY] = { cmd_identify_packet, CD_OK },
1807 - [WIN_SMART] = { cmd_smart, HD_CFA_OK | SET_DSC },
1808 -@@ -1788,19 +1788,19 @@ static const struct {
1809 - [WIN_WRITEDMA] = { cmd_write_dma, HD_CFA_OK },
1810 - [WIN_WRITEDMA_ONCE] = { cmd_write_dma, HD_CFA_OK },
1811 - [CFA_WRITE_MULTI_WO_ERASE] = { cmd_write_multiple, CFA_OK },
1812 -- [WIN_STANDBYNOW1] = { cmd_nop, ALL_OK },
1813 -- [WIN_IDLEIMMEDIATE] = { cmd_nop, ALL_OK },
1814 -- [WIN_STANDBY] = { cmd_nop, ALL_OK },
1815 -- [WIN_SETIDLE1] = { cmd_nop, ALL_OK },
1816 -- [WIN_CHECKPOWERMODE1] = { cmd_check_power_mode, ALL_OK | SET_DSC },
1817 -- [WIN_SLEEPNOW1] = { cmd_nop, ALL_OK },
1818 -+ [WIN_STANDBYNOW1] = { cmd_nop, HD_CFA_OK },
1819 -+ [WIN_IDLEIMMEDIATE] = { cmd_nop, HD_CFA_OK },
1820 -+ [WIN_STANDBY] = { cmd_nop, HD_CFA_OK },
1821 -+ [WIN_SETIDLE1] = { cmd_nop, HD_CFA_OK },
1822 -+ [WIN_CHECKPOWERMODE1] = { cmd_check_power_mode, HD_CFA_OK | SET_DSC },
1823 -+ [WIN_SLEEPNOW1] = { cmd_nop, HD_CFA_OK },
1824 - [WIN_FLUSH_CACHE] = { cmd_flush_cache, ALL_OK },
1825 - [WIN_FLUSH_CACHE_EXT] = { cmd_flush_cache, HD_CFA_OK },
1826 - [WIN_IDENTIFY] = { cmd_identify, ALL_OK },
1827 - [WIN_SETFEATURES] = { cmd_set_features, ALL_OK | SET_DSC },
1828 - [IBM_SENSE_CONDITION] = { cmd_ibm_sense_condition, CFA_OK | SET_DSC },
1829 - [CFA_WEAR_LEVEL] = { cmd_cfa_erase_sectors, HD_CFA_OK | SET_DSC },
1830 -- [WIN_READ_NATIVE_MAX] = { cmd_read_native_max, ALL_OK | SET_DSC },
1831 -+ [WIN_READ_NATIVE_MAX] = { cmd_read_native_max, HD_CFA_OK | SET_DSC },
1832 - };
1833 -
1834 - static bool ide_cmd_permitted(IDEState *s, uint32_t cmd)
1835 ---
1836 -2.6.0.rc2.230.g3dd15c0
1837 -
1838
1839 diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch
1840 deleted file mode 100644
1841 index 4ee46e1..0000000
1842 --- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-1.patch
1843 +++ /dev/null
1844 @@ -1,58 +0,0 @@
1845 -https://bugs.gentoo.org/560760
1846 -
1847 -From ce317461573bac12b10d67699b4ddf1f97cf066c Mon Sep 17 00:00:00 2001
1848 -From: Jason Wang <jasowang@××××××.com>
1849 -Date: Fri, 25 Sep 2015 13:21:28 +0800
1850 -Subject: [PATCH 1/3] virtio: introduce virtqueue_unmap_sg()
1851 -
1852 -Factor out sg unmapping logic. This will be reused by the patch that
1853 -can discard descriptor.
1854 -
1855 -Cc: Michael S. Tsirkin <mst@××××××.com>
1856 -Cc: Andrew James <andrew.james@×××.com>
1857 -Signed-off-by: Jason Wang <jasowang@××××××.com>
1858 -Reviewed-by: Michael S. Tsirkin <mst@××××××.com>
1859 -Signed-off-by: Michael S. Tsirkin <mst@××××××.com>
1860 ----
1861 - hw/virtio/virtio.c | 14 ++++++++++----
1862 - 1 file changed, 10 insertions(+), 4 deletions(-)
1863 -
1864 -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
1865 -index 7504f8b..6f2b96c 100644
1866 ---- a/hw/virtio/virtio.c
1867 -+++ b/hw/virtio/virtio.c
1868 -@@ -244,14 +244,12 @@ int virtio_queue_empty(VirtQueue *vq)
1869 - return vring_avail_idx(vq) == vq->last_avail_idx;
1870 - }
1871 -
1872 --void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
1873 -- unsigned int len, unsigned int idx)
1874 -+static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
1875 -+ unsigned int len)
1876 - {
1877 - unsigned int offset;
1878 - int i;
1879 -
1880 -- trace_virtqueue_fill(vq, elem, len, idx);
1881 --
1882 - offset = 0;
1883 - for (i = 0; i < elem->in_num; i++) {
1884 - size_t size = MIN(len - offset, elem->in_sg[i].iov_len);
1885 -@@ -267,6 +265,14 @@ void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
1886 - cpu_physical_memory_unmap(elem->out_sg[i].iov_base,
1887 - elem->out_sg[i].iov_len,
1888 - 0, elem->out_sg[i].iov_len);
1889 -+}
1890 -+
1891 -+void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
1892 -+ unsigned int len, unsigned int idx)
1893 -+{
1894 -+ trace_virtqueue_fill(vq, elem, len, idx);
1895 -+
1896 -+ virtqueue_unmap_sg(vq, elem, len);
1897 -
1898 - idx = (idx + vring_used_idx(vq)) % vq->vring.num;
1899 -
1900 ---
1901 -2.6.0.rc2.230.g3dd15c0
1902 -
1903
1904 diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch
1905 deleted file mode 100644
1906 index 8c73fcb..0000000
1907 --- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-2.patch
1908 +++ /dev/null
1909 @@ -1,54 +0,0 @@
1910 -https://bugs.gentoo.org/560760
1911 -
1912 -From 29b9f5efd78ae0f9cc02dd169b6e80d2c404bade Mon Sep 17 00:00:00 2001
1913 -From: Jason Wang <jasowang@××××××.com>
1914 -Date: Fri, 25 Sep 2015 13:21:29 +0800
1915 -Subject: [PATCH 2/3] virtio: introduce virtqueue_discard()
1916 -
1917 -This patch introduces virtqueue_discard() to discard a descriptor and
1918 -unmap the sgs. This will be used by the patch that will discard
1919 -descriptor when packet is truncated.
1920 -
1921 -Cc: Michael S. Tsirkin <mst@××××××.com>
1922 -Signed-off-by: Jason Wang <jasowang@××××××.com>
1923 -Reviewed-by: Michael S. Tsirkin <mst@××××××.com>
1924 -Signed-off-by: Michael S. Tsirkin <mst@××××××.com>
1925 ----
1926 - hw/virtio/virtio.c | 7 +++++++
1927 - include/hw/virtio/virtio.h | 2 ++
1928 - 2 files changed, 9 insertions(+)
1929 -
1930 -diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
1931 -index 6f2b96c..d0bc72e 100644
1932 ---- a/hw/virtio/virtio.c
1933 -+++ b/hw/virtio/virtio.c
1934 -@@ -267,6 +267,13 @@ static void virtqueue_unmap_sg(VirtQueue *vq, const VirtQueueElement *elem,
1935 - 0, elem->out_sg[i].iov_len);
1936 - }
1937 -
1938 -+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
1939 -+ unsigned int len)
1940 -+{
1941 -+ vq->last_avail_idx--;
1942 -+ virtqueue_unmap_sg(vq, elem, len);
1943 -+}
1944 -+
1945 - void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
1946 - unsigned int len, unsigned int idx)
1947 - {
1948 -diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
1949 -index 6201ee8..9d09115 100644
1950 ---- a/include/hw/virtio/virtio.h
1951 -+++ b/include/hw/virtio/virtio.h
1952 -@@ -146,6 +146,8 @@ void virtio_del_queue(VirtIODevice *vdev, int n);
1953 - void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
1954 - unsigned int len);
1955 - void virtqueue_flush(VirtQueue *vq, unsigned int count);
1956 -+void virtqueue_discard(VirtQueue *vq, const VirtQueueElement *elem,
1957 -+ unsigned int len);
1958 - void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
1959 - unsigned int len, unsigned int idx);
1960 -
1961 ---
1962 -2.6.0.rc2.230.g3dd15c0
1963 -
1964
1965 diff --git a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch b/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch
1966 deleted file mode 100644
1967 index 96981e9..0000000
1968 --- a/app-emulation/qemu/files/qemu-2.4.0-CVE-2015-7295-3.patch
1969 +++ /dev/null
1970 @@ -1,47 +0,0 @@
1971 -https://bugs.gentoo.org/560760
1972 -
1973 -From 0cf33fb6b49a19de32859e2cdc6021334f448fb3 Mon Sep 17 00:00:00 2001
1974 -From: Jason Wang <jasowang@××××××.com>
1975 -Date: Fri, 25 Sep 2015 13:21:30 +0800
1976 -Subject: [PATCH 3/3] virtio-net: correctly drop truncated packets
1977 -
1978 -When packet is truncated during receiving, we drop the packets but
1979 -neither discard the descriptor nor add and signal used
1980 -descriptor. This will lead several issues:
1981 -
1982 -- sg mappings are leaked
1983 -- rx will be stalled if a lots of packets were truncated
1984 -
1985 -In order to be consistent with vhost, fix by discarding the descriptor
1986 -in this case.
1987 -
1988 -Cc: Michael S. Tsirkin <mst@××××××.com>
1989 -Signed-off-by: Jason Wang <jasowang@××××××.com>
1990 -Reviewed-by: Michael S. Tsirkin <mst@××××××.com>
1991 -Signed-off-by: Michael S. Tsirkin <mst@××××××.com>
1992 ----
1993 - hw/net/virtio-net.c | 8 +-------
1994 - 1 file changed, 1 insertion(+), 7 deletions(-)
1995 -
1996 -diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
1997 -index d388c55..a877614 100644
1998 ---- a/hw/net/virtio-net.c
1999 -+++ b/hw/net/virtio-net.c
2000 -@@ -1094,13 +1094,7 @@ static ssize_t virtio_net_receive(NetClientState *nc, const uint8_t *buf, size_t
2001 - * must have consumed the complete packet.
2002 - * Otherwise, drop it. */
2003 - if (!n->mergeable_rx_bufs && offset < size) {
2004 --#if 0
2005 -- error_report("virtio-net truncated non-mergeable packet: "
2006 -- "i %zd mergeable %d offset %zd, size %zd, "
2007 -- "guest hdr len %zd, host hdr len %zd",
2008 -- i, n->mergeable_rx_bufs,
2009 -- offset, size, n->guest_hdr_len, n->host_hdr_len);
2010 --#endif
2011 -+ virtqueue_discard(q->rx_vq, &elem, total);
2012 - return size;
2013 - }
2014 -
2015 ---
2016 -2.6.0.rc2.230.g3dd15c0
2017 -
2018
2019 diff --git a/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch b/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch
2020 deleted file mode 100644
2021 index ad4051e..0000000
2022 --- a/app-emulation/qemu/files/qemu-2.4.0-block-mirror-crash.patch
2023 +++ /dev/null
2024 @@ -1,124 +0,0 @@
2025 -https://bugs.gentoo.org/558396
2026 -
2027 -fix from upstream git
2028 -
2029 -From e424aff5f307227b1c2512bbb8ece891bb895cef Mon Sep 17 00:00:00 2001
2030 -From: Kevin Wolf <kwolf@××××××.com>
2031 -Date: Thu, 13 Aug 2015 10:41:50 +0200
2032 -Subject: [PATCH] mirror: Fix coroutine reentrance
2033 -
2034 -This fixes a regression introduced by commit dcfb3beb ("mirror: Do zero
2035 -write on target if sectors not allocated"), which was reported to cause
2036 -aborts with the message "Co-routine re-entered recursively".
2037 -
2038 -The cause for this bug is the following code in mirror_iteration_done():
2039 -
2040 - if (s->common.busy) {
2041 - qemu_coroutine_enter(s->common.co, NULL);
2042 - }
2043 -
2044 -This has always been ugly because - unlike most places that reenter - it
2045 -doesn't have a specific yield that it pairs with, but is more
2046 -uncontrolled. What we really mean here is "reenter the coroutine if
2047 -it's in one of the four explicit yields in mirror.c".
2048 -
2049 -This used to be equivalent with s->common.busy because neither
2050 -mirror_run() nor mirror_iteration() call any function that could yield.
2051 -However since commit dcfb3beb this doesn't hold true any more:
2052 -bdrv_get_block_status_above() can yield.
2053 -
2054 -So what happens is that bdrv_get_block_status_above() wants to take a
2055 -lock that is already held, so it adds itself to the queue of waiting
2056 -coroutines and yields. Instead of being woken up by the unlock function,
2057 -however, it gets woken up by mirror_iteration_done(), which is obviously
2058 -wrong.
2059 -
2060 -In most cases the code actually happens to cope fairly well with such
2061 -cases, but in this specific case, the unlock must already have scheduled
2062 -the coroutine for wakeup when mirror_iteration_done() reentered it. And
2063 -then the coroutine happened to process the scheduled restarts and tried
2064 -to reenter itself recursively.
2065 -
2066 -This patch fixes the problem by pairing the reenter in
2067 -mirror_iteration_done() with specific yields instead of abusing
2068 -s->common.busy.
2069 -
2070 -Cc: qemu-stable@××××××.org
2071 -Signed-off-by: Kevin Wolf <kwolf@××××××.com>
2072 -Reviewed-by: Paolo Bonzini <pbonzini@××××××.com>
2073 -Reviewed-by: Stefan Hajnoczi <stefanha@××××××.com>
2074 -Reviewed-by: Jeff Cody <jcody@××××××.com>
2075 -Message-id: 1439455310-11263-1-git-send-email-kwolf@××××××.com
2076 -Signed-off-by: Jeff Cody <jcody@××××××.com>
2077 ----
2078 - block/mirror.c | 15 ++++++++++-----
2079 - 1 file changed, 10 insertions(+), 5 deletions(-)
2080 -
2081 -diff --git a/block/mirror.c b/block/mirror.c
2082 -index 0841964..9474443 100644
2083 ---- a/block/mirror.c
2084 -+++ b/block/mirror.c
2085 -@@ -60,6 +60,7 @@ typedef struct MirrorBlockJob {
2086 - int sectors_in_flight;
2087 - int ret;
2088 - bool unmap;
2089 -+ bool waiting_for_io;
2090 - } MirrorBlockJob;
2091 -
2092 - typedef struct MirrorOp {
2093 -@@ -114,11 +115,7 @@ static void mirror_iteration_done(MirrorOp *op, int ret)
2094 - qemu_iovec_destroy(&op->qiov);
2095 - g_slice_free(MirrorOp, op);
2096 -
2097 -- /* Enter coroutine when it is not sleeping. The coroutine sleeps to
2098 -- * rate-limit itself. The coroutine will eventually resume since there is
2099 -- * a sleep timeout so don't wake it early.
2100 -- */
2101 -- if (s->common.busy) {
2102 -+ if (s->waiting_for_io) {
2103 - qemu_coroutine_enter(s->common.co, NULL);
2104 - }
2105 - }
2106 -@@ -203,7 +200,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
2107 - /* Wait for I/O to this cluster (from a previous iteration) to be done. */
2108 - while (test_bit(next_chunk, s->in_flight_bitmap)) {
2109 - trace_mirror_yield_in_flight(s, sector_num, s->in_flight);
2110 -+ s->waiting_for_io = true;
2111 - qemu_coroutine_yield();
2112 -+ s->waiting_for_io = false;
2113 - }
2114 -
2115 - do {
2116 -@@ -239,7 +238,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
2117 - */
2118 - while (nb_chunks == 0 && s->buf_free_count < added_chunks) {
2119 - trace_mirror_yield_buf_busy(s, nb_chunks, s->in_flight);
2120 -+ s->waiting_for_io = true;
2121 - qemu_coroutine_yield();
2122 -+ s->waiting_for_io = false;
2123 - }
2124 - if (s->buf_free_count < nb_chunks + added_chunks) {
2125 - trace_mirror_break_buf_busy(s, nb_chunks, s->in_flight);
2126 -@@ -337,7 +338,9 @@ static void mirror_free_init(MirrorBlockJob *s)
2127 - static void mirror_drain(MirrorBlockJob *s)
2128 - {
2129 - while (s->in_flight > 0) {
2130 -+ s->waiting_for_io = true;
2131 - qemu_coroutine_yield();
2132 -+ s->waiting_for_io = false;
2133 - }
2134 - }
2135 -
2136 -@@ -510,7 +513,9 @@ static void coroutine_fn mirror_run(void *opaque)
2137 - if (s->in_flight == MAX_IN_FLIGHT || s->buf_free_count == 0 ||
2138 - (cnt == 0 && s->in_flight > 0)) {
2139 - trace_mirror_yield(s, s->in_flight, s->buf_free_count, cnt);
2140 -+ s->waiting_for_io = true;
2141 - qemu_coroutine_yield();
2142 -+ s->waiting_for_io = false;
2143 - continue;
2144 - } else if (cnt != 0) {
2145 - delay_ns = mirror_iteration(s);
2146 ---
2147 -2.5.0
2148 -
2149
2150 diff --git a/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch b/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch
2151 deleted file mode 100644
2152 index f2538a7..0000000
2153 --- a/app-emulation/qemu/files/qemu-2.4.0-e1000-loop.patch
2154 +++ /dev/null
2155 @@ -1,39 +0,0 @@
2156 -https://bugs.gentoo.org/559656
2157 -
2158 -https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg01199.html
2159 -
2160 -From: Stefan Hajnoczi <stefanha@××××××.com>
2161 -Subject: [PATCH] e1000: Avoid infinite loop in processing transmit descriptor
2162 -Newsgroups: gmane.comp.emulators.qemu
2163 -Date: 2015-09-04 16:21:06 GMT (2 days, 12 hours and 51 minutes ago)
2164 -From: P J P <pjp@×××××××××××××.org>
2165 -
2166 -While processing transmit descriptors, it could lead to an infinite
2167 -loop if 'bytes' was to become zero; Add a check to avoid it.
2168 -
2169 -[The guest can force 'bytes' to 0 by setting the hdr_len and mss
2170 -descriptor fields to 0.
2171 ---Stefan]
2172 -
2173 -Signed-off-by: P J P <pjp@×××××××××××××.org>
2174 -Signed-off-by: Stefan Hajnoczi <stefanha@××××××.com>
2175 ----
2176 - hw/net/e1000.c | 3 ++-
2177 - 1 file changed, 2 insertions(+), 1 deletion(-)
2178 -
2179 -diff --git a/hw/net/e1000.c b/hw/net/e1000.c
2180 -index 5c6bcd0..09c9e9d 100644
2181 ---- a/hw/net/e1000.c
2182 -+++ b/hw/net/e1000.c
2183 -@@ -740,7 +740,8 @@ process_tx_desc(E1000State *s, struct e1000_tx_desc *dp)
2184 - memmove(tp->data, tp->header, tp->hdr_len);
2185 - tp->size = tp->hdr_len;
2186 - }
2187 -- } while (split_size -= bytes);
2188 -+ split_size -= bytes;
2189 -+ } while (bytes && split_size);
2190 - } else if (!tp->tse && tp->cptse) {
2191 - // context descriptor TSE is not set, while data descriptor TSE is set
2192 - DBGOUT(TXERR, "TCP segmentation error\n");
2193 ---
2194 -2.4.3
2195
2196 diff --git a/app-emulation/qemu/qemu-2.3.0-r5.ebuild b/app-emulation/qemu/qemu-2.3.0-r5.ebuild
2197 deleted file mode 100644
2198 index 9e0cf4f..0000000
2199 --- a/app-emulation/qemu/qemu-2.3.0-r5.ebuild
2200 +++ /dev/null
2201 @@ -1,611 +0,0 @@
2202 -# Copyright 1999-2015 Gentoo Foundation
2203 -# Distributed under the terms of the GNU General Public License v2
2204 -# $Id$
2205 -
2206 -EAPI=5
2207 -
2208 -PYTHON_COMPAT=( python2_7 )
2209 -PYTHON_REQ_USE="ncurses,readline"
2210 -
2211 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
2212 - user udev fcaps readme.gentoo pax-utils
2213 -
2214 -BACKPORTS=
2215 -
2216 -if [[ ${PV} = *9999* ]]; then
2217 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
2218 - inherit git-2
2219 - SRC_URI=""
2220 -else
2221 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
2222 - ${BACKPORTS:+
2223 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
2224 - KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
2225 -fi
2226 -
2227 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
2228 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
2229 -
2230 -LICENSE="GPL-2 LGPL-2 BSD-2"
2231 -SLOT="0"
2232 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
2233 -gtk gtk2 infiniband iscsi +jpeg \
2234 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
2235 -+png pulseaudio python \
2236 -rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
2237 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
2238 -virtfs +vnc xattr xen xfs"
2239 -
2240 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
2241 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
2242 -x86_64"
2243 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
2244 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
2245 -
2246 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
2247 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
2248 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
2249 -
2250 -# Require at least one softmmu or user target.
2251 -# Block USE flag configurations known to not work.
2252 -REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
2253 - ${PYTHON_REQUIRED_USE}
2254 - gtk2? ( gtk )
2255 - qemu_softmmu_targets_arm? ( fdt )
2256 - qemu_softmmu_targets_microblaze? ( fdt )
2257 - qemu_softmmu_targets_ppc? ( fdt )
2258 - qemu_softmmu_targets_ppc64? ( fdt )
2259 - static? ( static-softmmu static-user )
2260 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
2261 - virtfs? ( xattr )"
2262 -
2263 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
2264 -#
2265 -# The attr lib isn't always linked in (although the USE flag is always
2266 -# respected). This is because qemu supports using the C library's API
2267 -# when available rather than always using the extranl library.
2268 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
2269 - sys-libs/zlib[static-libs(+)]
2270 - xattr? ( sys-apps/attr[static-libs(+)] )"
2271 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
2272 - >=x11-libs/pixman-0.28.0[static-libs(+)]
2273 - aio? ( dev-libs/libaio[static-libs(+)] )
2274 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
2275 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
2276 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
2277 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
2278 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
2279 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
2280 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
2281 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
2282 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
2283 - numa? ( sys-process/numactl[static-libs(+)] )
2284 - png? ( media-libs/libpng:0=[static-libs(+)] )
2285 - rbd? ( sys-cluster/ceph[static-libs(+)] )
2286 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
2287 - sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
2288 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
2289 - snappy? ( app-arch/snappy[static-libs(+)] )
2290 - spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
2291 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
2292 - tls? ( net-libs/gnutls[static-libs(+)] )
2293 - usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
2294 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
2295 - vde? ( net-misc/vde[static-libs(+)] )
2296 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
2297 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
2298 -X86_FIRMWARE_DEPEND="
2299 - >=sys-firmware/ipxe-1.0.0_p20130624
2300 - pin-upstream-blobs? (
2301 - ~sys-firmware/seabios-1.7.5
2302 - ~sys-firmware/sgabios-0.1_pre8
2303 - ~sys-firmware/vgabios-0.7a
2304 - )
2305 - !pin-upstream-blobs? (
2306 - sys-firmware/seabios
2307 - sys-firmware/sgabios
2308 - sys-firmware/vgabios
2309 - )"
2310 -CDEPEND="
2311 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
2312 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
2313 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
2314 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
2315 - accessibility? ( app-accessibility/brltty )
2316 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
2317 - bluetooth? ( net-wireless/bluez )
2318 - gtk? (
2319 - gtk2? ( x11-libs/gtk+:2 )
2320 - !gtk2? ( x11-libs/gtk+:3 )
2321 - x11-libs/vte:2.90
2322 - )
2323 - iscsi? ( net-libs/libiscsi )
2324 - opengl? ( virtual/opengl )
2325 - pulseaudio? ( media-sound/pulseaudio )
2326 - python? ( ${PYTHON_DEPS} )
2327 - sdl? ( media-libs/libsdl[X] )
2328 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
2329 - spice? ( >=app-emulation/spice-protocol-0.12.3 )
2330 - systemtap? ( dev-util/systemtap )
2331 - usbredir? ( >=sys-apps/usbredir-0.6 )
2332 - virtfs? ( sys-libs/libcap )
2333 - xen? ( app-emulation/xen-tools:= )"
2334 -DEPEND="${CDEPEND}
2335 - dev-lang/perl
2336 - =dev-lang/python-2*
2337 - sys-apps/texinfo
2338 - virtual/pkgconfig
2339 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
2340 - gtk? ( nls? ( sys-devel/gettext ) )
2341 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
2342 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
2343 - test? (
2344 - dev-libs/glib[utils]
2345 - sys-devel/bc
2346 - )"
2347 -RDEPEND="${CDEPEND}
2348 - selinux? ( sec-policy/selinux-qemu )
2349 -"
2350 -
2351 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
2352 -
2353 -QA_PREBUILT="
2354 - usr/share/qemu/openbios-ppc
2355 - usr/share/qemu/openbios-sparc64
2356 - usr/share/qemu/openbios-sparc32
2357 - usr/share/qemu/palcode-clipper
2358 - usr/share/qemu/s390-ccw.img
2359 - usr/share/qemu/u-boot.e500
2360 -"
2361 -
2362 -QA_WX_LOAD="usr/bin/qemu-i386
2363 - usr/bin/qemu-x86_64
2364 - usr/bin/qemu-alpha
2365 - usr/bin/qemu-arm
2366 - usr/bin/qemu-cris
2367 - usr/bin/qemu-m68k
2368 - usr/bin/qemu-microblaze
2369 - usr/bin/qemu-microblazeel
2370 - usr/bin/qemu-mips
2371 - usr/bin/qemu-mipsel
2372 - usr/bin/qemu-or32
2373 - usr/bin/qemu-ppc
2374 - usr/bin/qemu-ppc64
2375 - usr/bin/qemu-ppc64abi32
2376 - usr/bin/qemu-sh4
2377 - usr/bin/qemu-sh4eb
2378 - usr/bin/qemu-sparc
2379 - usr/bin/qemu-sparc64
2380 - usr/bin/qemu-armeb
2381 - usr/bin/qemu-sparc32plus
2382 - usr/bin/qemu-s390x
2383 - usr/bin/qemu-unicore32"
2384 -
2385 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
2386 -you have the kernel module loaded before running kvm. The easiest way to
2387 -ensure that the kernel module is loaded is to load it on boot.\n
2388 -For AMD CPUs the module is called 'kvm-amd'\n
2389 -For Intel CPUs the module is called 'kvm-intel'\n
2390 -Please review /etc/conf.d/modules for how to load these\n\n
2391 -Make sure your user is in the 'kvm' group\n
2392 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
2393 -
2394 -qemu_support_kvm() {
2395 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
2396 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
2397 - use qemu_softmmu_targets_s390x; then
2398 - return 0
2399 - fi
2400 -
2401 - return 1
2402 -}
2403 -
2404 -pkg_pretend() {
2405 - if use kernel_linux && kernel_is lt 2 6 25; then
2406 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
2407 - elif use kernel_linux; then
2408 - if ! linux_config_exists; then
2409 - eerror "Unable to check your kernel for KVM support"
2410 - else
2411 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
2412 - ERROR_KVM="You must enable KVM in your kernel to continue"
2413 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
2414 - ERROR_KVM_AMD+=" your kernel configuration."
2415 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
2416 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
2417 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
2418 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
2419 - ERROR_TUN+=" virtual network device if using -net tap."
2420 - ERROR_BRIDGE="You will also need support for 802.1d"
2421 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
2422 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
2423 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
2424 - ERROR_VHOST_NET+=" support"
2425 -
2426 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
2427 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
2428 - fi
2429 -
2430 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
2431 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
2432 -
2433 - # Now do the actual checks setup above
2434 - check_extra_config
2435 - fi
2436 - fi
2437 -
2438 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
2439 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
2440 - eerror "instances are still pointing to it. Please update your"
2441 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
2442 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
2443 - die "update your virt configs to not use qemu-kvm"
2444 - fi
2445 -}
2446 -
2447 -pkg_setup() {
2448 - enewgroup kvm 78
2449 -}
2450 -
2451 -src_prepare() {
2452 - # Alter target makefiles to accept CFLAGS set via flag-o
2453 - sed -i -r \
2454 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
2455 - Makefile Makefile.target || die
2456 -
2457 - # Cheap hack to disable gettext .mo generation.
2458 - use nls || rm -f po/*.po
2459 -
2460 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
2461 - epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
2462 - epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
2463 - epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
2464 - epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
2465 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
2466 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
2467 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
2468 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
2469 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
2470 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
2471 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
2472 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
2473 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
2474 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
2475 - epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
2476 - [[ -n ${BACKPORTS} ]] && \
2477 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
2478 - epatch
2479 -
2480 - # Fix ld and objcopy being called directly
2481 - tc-export AR LD OBJCOPY
2482 -
2483 - # Verbose builds
2484 - MAKEOPTS+=" V=1"
2485 -
2486 - epatch_user
2487 -}
2488 -
2489 -##
2490 -# configures qemu based on the build directory and the build type
2491 -# we are using.
2492 -#
2493 -qemu_src_configure() {
2494 - debug-print-function ${FUNCNAME} "$@"
2495 -
2496 - local buildtype=$1
2497 - local builddir=$2
2498 - local static_flag="static-${buildtype}"
2499 -
2500 - # audio options
2501 - local audio_opts="oss"
2502 - use alsa && audio_opts="alsa,${audio_opts}"
2503 - use sdl && audio_opts="sdl,${audio_opts}"
2504 - use pulseaudio && audio_opts="pa,${audio_opts}"
2505 -
2506 - local conf_opts=(
2507 - --prefix=/usr
2508 - --sysconfdir=/etc
2509 - --libdir=/usr/$(get_libdir)
2510 - --docdir=/usr/share/doc/${PF}/html
2511 - --disable-bsd-user
2512 - --disable-guest-agent
2513 - --disable-strip
2514 - --disable-werror
2515 - --python="${PYTHON}"
2516 - --cc="$(tc-getCC)"
2517 - --cxx="$(tc-getCXX)"
2518 - --host-cc="$(tc-getBUILD_CC)"
2519 - $(use_enable debug debug-info)
2520 - $(use_enable debug debug-tcg)
2521 - --enable-docs
2522 - $(use_enable tci tcg-interpreter)
2523 - $(use_enable xattr attr)
2524 - )
2525 -
2526 - # Disable options not used by user targets as the default configure
2527 - # options will autoprobe and try to link in a bunch of unused junk.
2528 - conf_softmmu() {
2529 - if [[ ${buildtype} == "user" ]] ; then
2530 - echo "--disable-${2:-$1}"
2531 - else
2532 - use_enable "$@"
2533 - fi
2534 - }
2535 - conf_opts+=(
2536 - $(conf_softmmu accessibility brlapi)
2537 - $(conf_softmmu aio linux-aio)
2538 - $(conf_softmmu bluetooth bluez)
2539 - $(conf_softmmu caps cap-ng)
2540 - $(conf_softmmu curl)
2541 - $(conf_softmmu fdt)
2542 - $(conf_softmmu glusterfs)
2543 - $(conf_softmmu gtk)
2544 - $(conf_softmmu infiniband rdma)
2545 - $(conf_softmmu iscsi libiscsi)
2546 - $(conf_softmmu jpeg vnc-jpeg)
2547 - $(conf_softmmu kernel_linux kvm)
2548 - $(conf_softmmu lzo)
2549 - $(conf_softmmu ncurses curses)
2550 - $(conf_softmmu nfs libnfs)
2551 - $(conf_softmmu numa)
2552 - $(conf_softmmu opengl)
2553 - $(conf_softmmu png vnc-png)
2554 - $(conf_softmmu rbd)
2555 - $(conf_softmmu sasl vnc-sasl)
2556 - $(conf_softmmu sdl)
2557 - $(conf_softmmu seccomp)
2558 - $(conf_softmmu smartcard smartcard-nss)
2559 - $(conf_softmmu snappy)
2560 - $(conf_softmmu spice)
2561 - $(conf_softmmu ssh libssh2)
2562 - $(conf_softmmu tls quorum)
2563 - $(conf_softmmu tls vnc-tls)
2564 - $(conf_softmmu tls vnc-ws)
2565 - $(conf_softmmu usb libusb)
2566 - $(conf_softmmu usbredir usb-redir)
2567 - $(conf_softmmu uuid)
2568 - $(conf_softmmu vde)
2569 - $(conf_softmmu vhost-net)
2570 - $(conf_softmmu virtfs)
2571 - $(conf_softmmu vnc)
2572 - $(conf_softmmu xen)
2573 - $(conf_softmmu xen xen-pci-passthrough)
2574 - $(conf_softmmu xfs xfsctl)
2575 - )
2576 -
2577 - case ${buildtype} in
2578 - user)
2579 - conf_opts+=(
2580 - --enable-linux-user
2581 - --disable-system
2582 - --target-list="${user_targets}"
2583 - --disable-blobs
2584 - --disable-tools
2585 - )
2586 - ;;
2587 - softmmu)
2588 - conf_opts+=(
2589 - --disable-linux-user
2590 - --enable-system
2591 - --target-list="${softmmu_targets}"
2592 - --with-system-pixman
2593 - --audio-drv-list="${audio_opts}"
2594 - )
2595 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
2596 - ;;
2597 - esac
2598 -
2599 - # Add support for SystemTAP
2600 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
2601 -
2602 - # We always want to attempt to build with PIE support as it results
2603 - # in a more secure binary. But it doesn't work with static or if
2604 - # the current GCC doesn't have PIE support.
2605 - if use ${static_flag}; then
2606 - conf_opts+=( --static --disable-pie )
2607 - else
2608 - gcc-specs-pie && conf_opts+=( --enable-pie )
2609 - fi
2610 -
2611 - einfo "../configure ${conf_opts[*]}"
2612 - cd "${builddir}"
2613 - ../configure "${conf_opts[@]}" || die "configure failed"
2614 -
2615 - # FreeBSD's kernel does not support QEMU assigning/grabbing
2616 - # host USB devices yet
2617 - use kernel_FreeBSD && \
2618 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
2619 -}
2620 -
2621 -src_configure() {
2622 - local target
2623 -
2624 - python_setup
2625 -
2626 - softmmu_targets= softmmu_bins=()
2627 - user_targets= user_bins=()
2628 -
2629 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
2630 - if use "qemu_softmmu_targets_${target}"; then
2631 - softmmu_targets+=",${target}-softmmu"
2632 - softmmu_bins+=( "qemu-system-${target}" )
2633 - fi
2634 - done
2635 -
2636 - for target in ${IUSE_USER_TARGETS} ; do
2637 - if use "qemu_user_targets_${target}"; then
2638 - user_targets+=",${target}-linux-user"
2639 - user_bins+=( "qemu-${target}" )
2640 - fi
2641 - done
2642 -
2643 - [[ -n ${softmmu_targets} ]] && \
2644 - einfo "Building the following softmmu targets: ${softmmu_targets}"
2645 -
2646 - [[ -n ${user_targets} ]] && \
2647 - einfo "Building the following user targets: ${user_targets}"
2648 -
2649 - if [[ -n ${softmmu_targets} ]]; then
2650 - mkdir "${S}/softmmu-build"
2651 - qemu_src_configure "softmmu" "${S}/softmmu-build"
2652 - fi
2653 -
2654 - if [[ -n ${user_targets} ]]; then
2655 - mkdir "${S}/user-build"
2656 - qemu_src_configure "user" "${S}/user-build"
2657 - fi
2658 -}
2659 -
2660 -src_compile() {
2661 - if [[ -n ${user_targets} ]]; then
2662 - cd "${S}/user-build"
2663 - default
2664 - fi
2665 -
2666 - if [[ -n ${softmmu_targets} ]]; then
2667 - cd "${S}/softmmu-build"
2668 - default
2669 - fi
2670 -}
2671 -
2672 -src_test() {
2673 - if [[ -n ${softmmu_targets} ]]; then
2674 - cd "${S}/softmmu-build"
2675 - pax-mark m */qemu-system-* #515550
2676 - emake -j1 check
2677 - emake -j1 check-report.html
2678 - fi
2679 -}
2680 -
2681 -qemu_python_install() {
2682 - python_domodule "${S}/scripts/qmp/qmp.py"
2683 -
2684 - python_doscript "${S}/scripts/kvm/kvm_stat"
2685 - python_doscript "${S}/scripts/kvm/vmxcap"
2686 - python_doscript "${S}/scripts/qmp/qmp-shell"
2687 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
2688 -}
2689 -
2690 -src_install() {
2691 - if [[ -n ${user_targets} ]]; then
2692 - cd "${S}/user-build"
2693 - emake DESTDIR="${ED}" install
2694 -
2695 - # Install binfmt handler init script for user targets
2696 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
2697 - fi
2698 -
2699 - if [[ -n ${softmmu_targets} ]]; then
2700 - cd "${S}/softmmu-build"
2701 - emake DESTDIR="${ED}" install
2702 -
2703 - # This might not exist if the test failed. #512010
2704 - [[ -e check-report.html ]] && dohtml check-report.html
2705 -
2706 - if use kernel_linux; then
2707 - udev_dorules "${FILESDIR}"/65-kvm.rules
2708 - fi
2709 -
2710 - if use python; then
2711 - python_foreach_impl qemu_python_install
2712 - fi
2713 - fi
2714 -
2715 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
2716 - pushd "${ED}"/usr/bin >/dev/null
2717 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
2718 - popd >/dev/null
2719 -
2720 - # Install config file example for qemu-bridge-helper
2721 - insinto "/etc/qemu"
2722 - doins "${FILESDIR}/bridge.conf"
2723 -
2724 - # Remove the docdir placed qmp-commands.txt
2725 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
2726 -
2727 - cd "${S}"
2728 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
2729 - newdoc pc-bios/README README.pc-bios
2730 - dodoc docs/qmp/*.txt
2731 -
2732 - if [[ -n ${softmmu_targets} ]]; then
2733 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
2734 - rm "${ED}/usr/share/qemu/bios.bin"
2735 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2736 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
2737 - fi
2738 -
2739 - # Remove vgabios since we're using the vgabios packaged one
2740 - rm "${ED}/usr/share/qemu/vgabios.bin"
2741 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
2742 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
2743 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
2744 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
2745 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2746 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
2747 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
2748 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
2749 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
2750 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
2751 - fi
2752 -
2753 - # Remove sgabios since we're using the sgabios packaged one
2754 - rm "${ED}/usr/share/qemu/sgabios.bin"
2755 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2756 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
2757 - fi
2758 -
2759 - # Remove iPXE since we're using the iPXE packaged one
2760 - rm "${ED}"/usr/share/qemu/pxe-*.rom
2761 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
2762 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
2763 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
2764 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
2765 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
2766 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
2767 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
2768 - fi
2769 - fi
2770 -
2771 - qemu_support_kvm && readme.gentoo_create_doc
2772 -}
2773 -
2774 -pkg_postinst() {
2775 - if qemu_support_kvm; then
2776 - readme.gentoo_print_elog
2777 - ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
2778 - ewarn "save states has been removed starting with the 1.6.2 release"
2779 - ewarn
2780 - ewarn "It is recommended that you migrate any VMs that may be running"
2781 - ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
2782 - ewarn "any saved states with a newer qemu."
2783 - ewarn
2784 - ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
2785 -
2786 - if use x86 || use amd64; then
2787 - ewarn
2788 - ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
2789 - ewarn "installed. In order to use kvm acceleration, pass the flag"
2790 - ewarn "-enable-kvm when running your system target."
2791 - fi
2792 - fi
2793 -
2794 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
2795 - udev_reload
2796 - fi
2797 -
2798 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
2799 -}
2800 -
2801 -pkg_info() {
2802 - echo "Using:"
2803 - echo " $(best_version app-emulation/spice-protocol)"
2804 - echo " $(best_version sys-firmware/ipxe)"
2805 - echo " $(best_version sys-firmware/seabios)"
2806 - if has_version sys-firmware/seabios[binary]; then
2807 - echo " USE=binary"
2808 - else
2809 - echo " USE=''"
2810 - fi
2811 - echo " $(best_version sys-firmware/vgabios)"
2812 -}
2813
2814 diff --git a/app-emulation/qemu/qemu-2.3.0-r6.ebuild b/app-emulation/qemu/qemu-2.3.0-r6.ebuild
2815 deleted file mode 100644
2816 index b49f43c..0000000
2817 --- a/app-emulation/qemu/qemu-2.3.0-r6.ebuild
2818 +++ /dev/null
2819 @@ -1,612 +0,0 @@
2820 -# Copyright 1999-2015 Gentoo Foundation
2821 -# Distributed under the terms of the GNU General Public License v2
2822 -# $Id$
2823 -
2824 -EAPI=5
2825 -
2826 -PYTHON_COMPAT=( python2_7 )
2827 -PYTHON_REQ_USE="ncurses,readline"
2828 -
2829 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
2830 - user udev fcaps readme.gentoo pax-utils
2831 -
2832 -BACKPORTS=
2833 -
2834 -if [[ ${PV} = *9999* ]]; then
2835 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
2836 - inherit git-2
2837 - SRC_URI=""
2838 -else
2839 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
2840 - ${BACKPORTS:+
2841 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
2842 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
2843 -fi
2844 -
2845 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
2846 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
2847 -
2848 -LICENSE="GPL-2 LGPL-2 BSD-2"
2849 -SLOT="0"
2850 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
2851 -gtk gtk2 infiniband iscsi +jpeg \
2852 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
2853 -+png pulseaudio python \
2854 -rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
2855 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
2856 -virtfs +vnc xattr xen xfs"
2857 -
2858 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
2859 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
2860 -x86_64"
2861 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
2862 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
2863 -
2864 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
2865 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
2866 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
2867 -
2868 -# Require at least one softmmu or user target.
2869 -# Block USE flag configurations known to not work.
2870 -REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
2871 - ${PYTHON_REQUIRED_USE}
2872 - gtk2? ( gtk )
2873 - qemu_softmmu_targets_arm? ( fdt )
2874 - qemu_softmmu_targets_microblaze? ( fdt )
2875 - qemu_softmmu_targets_ppc? ( fdt )
2876 - qemu_softmmu_targets_ppc64? ( fdt )
2877 - static? ( static-softmmu static-user )
2878 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
2879 - virtfs? ( xattr )"
2880 -
2881 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
2882 -#
2883 -# The attr lib isn't always linked in (although the USE flag is always
2884 -# respected). This is because qemu supports using the C library's API
2885 -# when available rather than always using the extranl library.
2886 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
2887 - sys-libs/zlib[static-libs(+)]
2888 - xattr? ( sys-apps/attr[static-libs(+)] )"
2889 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
2890 - >=x11-libs/pixman-0.28.0[static-libs(+)]
2891 - aio? ( dev-libs/libaio[static-libs(+)] )
2892 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
2893 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
2894 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
2895 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
2896 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
2897 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
2898 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
2899 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
2900 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
2901 - numa? ( sys-process/numactl[static-libs(+)] )
2902 - png? ( media-libs/libpng:0=[static-libs(+)] )
2903 - rbd? ( sys-cluster/ceph[static-libs(+)] )
2904 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
2905 - sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
2906 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
2907 - snappy? ( app-arch/snappy[static-libs(+)] )
2908 - spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
2909 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
2910 - tls? ( net-libs/gnutls[static-libs(+)] )
2911 - usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
2912 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
2913 - vde? ( net-misc/vde[static-libs(+)] )
2914 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
2915 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
2916 -X86_FIRMWARE_DEPEND="
2917 - >=sys-firmware/ipxe-1.0.0_p20130624
2918 - pin-upstream-blobs? (
2919 - ~sys-firmware/seabios-1.7.5
2920 - ~sys-firmware/sgabios-0.1_pre8
2921 - ~sys-firmware/vgabios-0.7a
2922 - )
2923 - !pin-upstream-blobs? (
2924 - sys-firmware/seabios
2925 - sys-firmware/sgabios
2926 - sys-firmware/vgabios
2927 - )"
2928 -CDEPEND="
2929 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
2930 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
2931 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
2932 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
2933 - accessibility? ( app-accessibility/brltty )
2934 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
2935 - bluetooth? ( net-wireless/bluez )
2936 - gtk? (
2937 - gtk2? ( x11-libs/gtk+:2 )
2938 - !gtk2? ( x11-libs/gtk+:3 )
2939 - x11-libs/vte:2.90
2940 - )
2941 - iscsi? ( net-libs/libiscsi )
2942 - opengl? ( virtual/opengl )
2943 - pulseaudio? ( media-sound/pulseaudio )
2944 - python? ( ${PYTHON_DEPS} )
2945 - sdl? ( media-libs/libsdl[X] )
2946 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
2947 - spice? ( >=app-emulation/spice-protocol-0.12.3 )
2948 - systemtap? ( dev-util/systemtap )
2949 - usbredir? ( >=sys-apps/usbredir-0.6 )
2950 - virtfs? ( sys-libs/libcap )
2951 - xen? ( app-emulation/xen-tools:= )"
2952 -DEPEND="${CDEPEND}
2953 - dev-lang/perl
2954 - =dev-lang/python-2*
2955 - sys-apps/texinfo
2956 - virtual/pkgconfig
2957 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
2958 - gtk? ( nls? ( sys-devel/gettext ) )
2959 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
2960 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
2961 - test? (
2962 - dev-libs/glib[utils]
2963 - sys-devel/bc
2964 - )"
2965 -RDEPEND="${CDEPEND}
2966 - selinux? ( sec-policy/selinux-qemu )
2967 -"
2968 -
2969 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
2970 -
2971 -QA_PREBUILT="
2972 - usr/share/qemu/openbios-ppc
2973 - usr/share/qemu/openbios-sparc64
2974 - usr/share/qemu/openbios-sparc32
2975 - usr/share/qemu/palcode-clipper
2976 - usr/share/qemu/s390-ccw.img
2977 - usr/share/qemu/u-boot.e500
2978 -"
2979 -
2980 -QA_WX_LOAD="usr/bin/qemu-i386
2981 - usr/bin/qemu-x86_64
2982 - usr/bin/qemu-alpha
2983 - usr/bin/qemu-arm
2984 - usr/bin/qemu-cris
2985 - usr/bin/qemu-m68k
2986 - usr/bin/qemu-microblaze
2987 - usr/bin/qemu-microblazeel
2988 - usr/bin/qemu-mips
2989 - usr/bin/qemu-mipsel
2990 - usr/bin/qemu-or32
2991 - usr/bin/qemu-ppc
2992 - usr/bin/qemu-ppc64
2993 - usr/bin/qemu-ppc64abi32
2994 - usr/bin/qemu-sh4
2995 - usr/bin/qemu-sh4eb
2996 - usr/bin/qemu-sparc
2997 - usr/bin/qemu-sparc64
2998 - usr/bin/qemu-armeb
2999 - usr/bin/qemu-sparc32plus
3000 - usr/bin/qemu-s390x
3001 - usr/bin/qemu-unicore32"
3002 -
3003 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
3004 -you have the kernel module loaded before running kvm. The easiest way to
3005 -ensure that the kernel module is loaded is to load it on boot.\n
3006 -For AMD CPUs the module is called 'kvm-amd'\n
3007 -For Intel CPUs the module is called 'kvm-intel'\n
3008 -Please review /etc/conf.d/modules for how to load these\n\n
3009 -Make sure your user is in the 'kvm' group\n
3010 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
3011 -
3012 -qemu_support_kvm() {
3013 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
3014 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
3015 - use qemu_softmmu_targets_s390x; then
3016 - return 0
3017 - fi
3018 -
3019 - return 1
3020 -}
3021 -
3022 -pkg_pretend() {
3023 - if use kernel_linux && kernel_is lt 2 6 25; then
3024 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
3025 - elif use kernel_linux; then
3026 - if ! linux_config_exists; then
3027 - eerror "Unable to check your kernel for KVM support"
3028 - else
3029 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
3030 - ERROR_KVM="You must enable KVM in your kernel to continue"
3031 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
3032 - ERROR_KVM_AMD+=" your kernel configuration."
3033 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
3034 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
3035 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
3036 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
3037 - ERROR_TUN+=" virtual network device if using -net tap."
3038 - ERROR_BRIDGE="You will also need support for 802.1d"
3039 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
3040 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
3041 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
3042 - ERROR_VHOST_NET+=" support"
3043 -
3044 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
3045 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
3046 - fi
3047 -
3048 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
3049 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
3050 -
3051 - # Now do the actual checks setup above
3052 - check_extra_config
3053 - fi
3054 - fi
3055 -
3056 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
3057 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
3058 - eerror "instances are still pointing to it. Please update your"
3059 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
3060 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
3061 - die "update your virt configs to not use qemu-kvm"
3062 - fi
3063 -}
3064 -
3065 -pkg_setup() {
3066 - enewgroup kvm 78
3067 -}
3068 -
3069 -src_prepare() {
3070 - # Alter target makefiles to accept CFLAGS set via flag-o
3071 - sed -i -r \
3072 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
3073 - Makefile Makefile.target || die
3074 -
3075 - # Cheap hack to disable gettext .mo generation.
3076 - use nls || rm -f po/*.po
3077 -
3078 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
3079 - epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
3080 - epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
3081 - epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
3082 - epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
3083 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
3084 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
3085 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
3086 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
3087 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
3088 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
3089 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
3090 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
3091 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
3092 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
3093 - epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
3094 - epatch "${FILESDIR}"/${P}-virtio-serial.patch #557206
3095 - [[ -n ${BACKPORTS} ]] && \
3096 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
3097 - epatch
3098 -
3099 - # Fix ld and objcopy being called directly
3100 - tc-export AR LD OBJCOPY
3101 -
3102 - # Verbose builds
3103 - MAKEOPTS+=" V=1"
3104 -
3105 - epatch_user
3106 -}
3107 -
3108 -##
3109 -# configures qemu based on the build directory and the build type
3110 -# we are using.
3111 -#
3112 -qemu_src_configure() {
3113 - debug-print-function ${FUNCNAME} "$@"
3114 -
3115 - local buildtype=$1
3116 - local builddir=$2
3117 - local static_flag="static-${buildtype}"
3118 -
3119 - # audio options
3120 - local audio_opts="oss"
3121 - use alsa && audio_opts="alsa,${audio_opts}"
3122 - use sdl && audio_opts="sdl,${audio_opts}"
3123 - use pulseaudio && audio_opts="pa,${audio_opts}"
3124 -
3125 - local conf_opts=(
3126 - --prefix=/usr
3127 - --sysconfdir=/etc
3128 - --libdir=/usr/$(get_libdir)
3129 - --docdir=/usr/share/doc/${PF}/html
3130 - --disable-bsd-user
3131 - --disable-guest-agent
3132 - --disable-strip
3133 - --disable-werror
3134 - --python="${PYTHON}"
3135 - --cc="$(tc-getCC)"
3136 - --cxx="$(tc-getCXX)"
3137 - --host-cc="$(tc-getBUILD_CC)"
3138 - $(use_enable debug debug-info)
3139 - $(use_enable debug debug-tcg)
3140 - --enable-docs
3141 - $(use_enable tci tcg-interpreter)
3142 - $(use_enable xattr attr)
3143 - )
3144 -
3145 - # Disable options not used by user targets as the default configure
3146 - # options will autoprobe and try to link in a bunch of unused junk.
3147 - conf_softmmu() {
3148 - if [[ ${buildtype} == "user" ]] ; then
3149 - echo "--disable-${2:-$1}"
3150 - else
3151 - use_enable "$@"
3152 - fi
3153 - }
3154 - conf_opts+=(
3155 - $(conf_softmmu accessibility brlapi)
3156 - $(conf_softmmu aio linux-aio)
3157 - $(conf_softmmu bluetooth bluez)
3158 - $(conf_softmmu caps cap-ng)
3159 - $(conf_softmmu curl)
3160 - $(conf_softmmu fdt)
3161 - $(conf_softmmu glusterfs)
3162 - $(conf_softmmu gtk)
3163 - $(conf_softmmu infiniband rdma)
3164 - $(conf_softmmu iscsi libiscsi)
3165 - $(conf_softmmu jpeg vnc-jpeg)
3166 - $(conf_softmmu kernel_linux kvm)
3167 - $(conf_softmmu lzo)
3168 - $(conf_softmmu ncurses curses)
3169 - $(conf_softmmu nfs libnfs)
3170 - $(conf_softmmu numa)
3171 - $(conf_softmmu opengl)
3172 - $(conf_softmmu png vnc-png)
3173 - $(conf_softmmu rbd)
3174 - $(conf_softmmu sasl vnc-sasl)
3175 - $(conf_softmmu sdl)
3176 - $(conf_softmmu seccomp)
3177 - $(conf_softmmu smartcard smartcard-nss)
3178 - $(conf_softmmu snappy)
3179 - $(conf_softmmu spice)
3180 - $(conf_softmmu ssh libssh2)
3181 - $(conf_softmmu tls quorum)
3182 - $(conf_softmmu tls vnc-tls)
3183 - $(conf_softmmu tls vnc-ws)
3184 - $(conf_softmmu usb libusb)
3185 - $(conf_softmmu usbredir usb-redir)
3186 - $(conf_softmmu uuid)
3187 - $(conf_softmmu vde)
3188 - $(conf_softmmu vhost-net)
3189 - $(conf_softmmu virtfs)
3190 - $(conf_softmmu vnc)
3191 - $(conf_softmmu xen)
3192 - $(conf_softmmu xen xen-pci-passthrough)
3193 - $(conf_softmmu xfs xfsctl)
3194 - )
3195 -
3196 - case ${buildtype} in
3197 - user)
3198 - conf_opts+=(
3199 - --enable-linux-user
3200 - --disable-system
3201 - --target-list="${user_targets}"
3202 - --disable-blobs
3203 - --disable-tools
3204 - )
3205 - ;;
3206 - softmmu)
3207 - conf_opts+=(
3208 - --disable-linux-user
3209 - --enable-system
3210 - --target-list="${softmmu_targets}"
3211 - --with-system-pixman
3212 - --audio-drv-list="${audio_opts}"
3213 - )
3214 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
3215 - ;;
3216 - esac
3217 -
3218 - # Add support for SystemTAP
3219 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
3220 -
3221 - # We always want to attempt to build with PIE support as it results
3222 - # in a more secure binary. But it doesn't work with static or if
3223 - # the current GCC doesn't have PIE support.
3224 - if use ${static_flag}; then
3225 - conf_opts+=( --static --disable-pie )
3226 - else
3227 - gcc-specs-pie && conf_opts+=( --enable-pie )
3228 - fi
3229 -
3230 - einfo "../configure ${conf_opts[*]}"
3231 - cd "${builddir}"
3232 - ../configure "${conf_opts[@]}" || die "configure failed"
3233 -
3234 - # FreeBSD's kernel does not support QEMU assigning/grabbing
3235 - # host USB devices yet
3236 - use kernel_FreeBSD && \
3237 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
3238 -}
3239 -
3240 -src_configure() {
3241 - local target
3242 -
3243 - python_setup
3244 -
3245 - softmmu_targets= softmmu_bins=()
3246 - user_targets= user_bins=()
3247 -
3248 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
3249 - if use "qemu_softmmu_targets_${target}"; then
3250 - softmmu_targets+=",${target}-softmmu"
3251 - softmmu_bins+=( "qemu-system-${target}" )
3252 - fi
3253 - done
3254 -
3255 - for target in ${IUSE_USER_TARGETS} ; do
3256 - if use "qemu_user_targets_${target}"; then
3257 - user_targets+=",${target}-linux-user"
3258 - user_bins+=( "qemu-${target}" )
3259 - fi
3260 - done
3261 -
3262 - [[ -n ${softmmu_targets} ]] && \
3263 - einfo "Building the following softmmu targets: ${softmmu_targets}"
3264 -
3265 - [[ -n ${user_targets} ]] && \
3266 - einfo "Building the following user targets: ${user_targets}"
3267 -
3268 - if [[ -n ${softmmu_targets} ]]; then
3269 - mkdir "${S}/softmmu-build"
3270 - qemu_src_configure "softmmu" "${S}/softmmu-build"
3271 - fi
3272 -
3273 - if [[ -n ${user_targets} ]]; then
3274 - mkdir "${S}/user-build"
3275 - qemu_src_configure "user" "${S}/user-build"
3276 - fi
3277 -}
3278 -
3279 -src_compile() {
3280 - if [[ -n ${user_targets} ]]; then
3281 - cd "${S}/user-build"
3282 - default
3283 - fi
3284 -
3285 - if [[ -n ${softmmu_targets} ]]; then
3286 - cd "${S}/softmmu-build"
3287 - default
3288 - fi
3289 -}
3290 -
3291 -src_test() {
3292 - if [[ -n ${softmmu_targets} ]]; then
3293 - cd "${S}/softmmu-build"
3294 - pax-mark m */qemu-system-* #515550
3295 - emake -j1 check
3296 - emake -j1 check-report.html
3297 - fi
3298 -}
3299 -
3300 -qemu_python_install() {
3301 - python_domodule "${S}/scripts/qmp/qmp.py"
3302 -
3303 - python_doscript "${S}/scripts/kvm/kvm_stat"
3304 - python_doscript "${S}/scripts/kvm/vmxcap"
3305 - python_doscript "${S}/scripts/qmp/qmp-shell"
3306 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
3307 -}
3308 -
3309 -src_install() {
3310 - if [[ -n ${user_targets} ]]; then
3311 - cd "${S}/user-build"
3312 - emake DESTDIR="${ED}" install
3313 -
3314 - # Install binfmt handler init script for user targets
3315 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
3316 - fi
3317 -
3318 - if [[ -n ${softmmu_targets} ]]; then
3319 - cd "${S}/softmmu-build"
3320 - emake DESTDIR="${ED}" install
3321 -
3322 - # This might not exist if the test failed. #512010
3323 - [[ -e check-report.html ]] && dohtml check-report.html
3324 -
3325 - if use kernel_linux; then
3326 - udev_dorules "${FILESDIR}"/65-kvm.rules
3327 - fi
3328 -
3329 - if use python; then
3330 - python_foreach_impl qemu_python_install
3331 - fi
3332 - fi
3333 -
3334 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
3335 - pushd "${ED}"/usr/bin >/dev/null
3336 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
3337 - popd >/dev/null
3338 -
3339 - # Install config file example for qemu-bridge-helper
3340 - insinto "/etc/qemu"
3341 - doins "${FILESDIR}/bridge.conf"
3342 -
3343 - # Remove the docdir placed qmp-commands.txt
3344 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
3345 -
3346 - cd "${S}"
3347 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
3348 - newdoc pc-bios/README README.pc-bios
3349 - dodoc docs/qmp/*.txt
3350 -
3351 - if [[ -n ${softmmu_targets} ]]; then
3352 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
3353 - rm "${ED}/usr/share/qemu/bios.bin"
3354 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3355 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
3356 - fi
3357 -
3358 - # Remove vgabios since we're using the vgabios packaged one
3359 - rm "${ED}/usr/share/qemu/vgabios.bin"
3360 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
3361 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
3362 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
3363 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
3364 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3365 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
3366 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
3367 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
3368 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
3369 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
3370 - fi
3371 -
3372 - # Remove sgabios since we're using the sgabios packaged one
3373 - rm "${ED}/usr/share/qemu/sgabios.bin"
3374 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3375 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
3376 - fi
3377 -
3378 - # Remove iPXE since we're using the iPXE packaged one
3379 - rm "${ED}"/usr/share/qemu/pxe-*.rom
3380 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3381 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
3382 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
3383 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
3384 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
3385 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
3386 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
3387 - fi
3388 - fi
3389 -
3390 - qemu_support_kvm && readme.gentoo_create_doc
3391 -}
3392 -
3393 -pkg_postinst() {
3394 - if qemu_support_kvm; then
3395 - readme.gentoo_print_elog
3396 - ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
3397 - ewarn "save states has been removed starting with the 1.6.2 release"
3398 - ewarn
3399 - ewarn "It is recommended that you migrate any VMs that may be running"
3400 - ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
3401 - ewarn "any saved states with a newer qemu."
3402 - ewarn
3403 - ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
3404 -
3405 - if use x86 || use amd64; then
3406 - ewarn
3407 - ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
3408 - ewarn "installed. In order to use kvm acceleration, pass the flag"
3409 - ewarn "-enable-kvm when running your system target."
3410 - fi
3411 - fi
3412 -
3413 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
3414 - udev_reload
3415 - fi
3416 -
3417 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
3418 -}
3419 -
3420 -pkg_info() {
3421 - echo "Using:"
3422 - echo " $(best_version app-emulation/spice-protocol)"
3423 - echo " $(best_version sys-firmware/ipxe)"
3424 - echo " $(best_version sys-firmware/seabios)"
3425 - if has_version sys-firmware/seabios[binary]; then
3426 - echo " USE=binary"
3427 - else
3428 - echo " USE=''"
3429 - fi
3430 - echo " $(best_version sys-firmware/vgabios)"
3431 -}
3432
3433 diff --git a/app-emulation/qemu/qemu-2.3.0-r7.ebuild b/app-emulation/qemu/qemu-2.3.0-r7.ebuild
3434 deleted file mode 100644
3435 index b49f43c..0000000
3436 --- a/app-emulation/qemu/qemu-2.3.0-r7.ebuild
3437 +++ /dev/null
3438 @@ -1,612 +0,0 @@
3439 -# Copyright 1999-2015 Gentoo Foundation
3440 -# Distributed under the terms of the GNU General Public License v2
3441 -# $Id$
3442 -
3443 -EAPI=5
3444 -
3445 -PYTHON_COMPAT=( python2_7 )
3446 -PYTHON_REQ_USE="ncurses,readline"
3447 -
3448 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
3449 - user udev fcaps readme.gentoo pax-utils
3450 -
3451 -BACKPORTS=
3452 -
3453 -if [[ ${PV} = *9999* ]]; then
3454 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
3455 - inherit git-2
3456 - SRC_URI=""
3457 -else
3458 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
3459 - ${BACKPORTS:+
3460 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
3461 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
3462 -fi
3463 -
3464 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
3465 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
3466 -
3467 -LICENSE="GPL-2 LGPL-2 BSD-2"
3468 -SLOT="0"
3469 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
3470 -gtk gtk2 infiniband iscsi +jpeg \
3471 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
3472 -+png pulseaudio python \
3473 -rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
3474 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
3475 -virtfs +vnc xattr xen xfs"
3476 -
3477 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
3478 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
3479 -x86_64"
3480 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
3481 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
3482 -
3483 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
3484 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
3485 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
3486 -
3487 -# Require at least one softmmu or user target.
3488 -# Block USE flag configurations known to not work.
3489 -REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
3490 - ${PYTHON_REQUIRED_USE}
3491 - gtk2? ( gtk )
3492 - qemu_softmmu_targets_arm? ( fdt )
3493 - qemu_softmmu_targets_microblaze? ( fdt )
3494 - qemu_softmmu_targets_ppc? ( fdt )
3495 - qemu_softmmu_targets_ppc64? ( fdt )
3496 - static? ( static-softmmu static-user )
3497 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
3498 - virtfs? ( xattr )"
3499 -
3500 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
3501 -#
3502 -# The attr lib isn't always linked in (although the USE flag is always
3503 -# respected). This is because qemu supports using the C library's API
3504 -# when available rather than always using the extranl library.
3505 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
3506 - sys-libs/zlib[static-libs(+)]
3507 - xattr? ( sys-apps/attr[static-libs(+)] )"
3508 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
3509 - >=x11-libs/pixman-0.28.0[static-libs(+)]
3510 - aio? ( dev-libs/libaio[static-libs(+)] )
3511 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
3512 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
3513 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
3514 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
3515 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
3516 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
3517 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
3518 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
3519 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
3520 - numa? ( sys-process/numactl[static-libs(+)] )
3521 - png? ( media-libs/libpng:0=[static-libs(+)] )
3522 - rbd? ( sys-cluster/ceph[static-libs(+)] )
3523 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
3524 - sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
3525 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
3526 - snappy? ( app-arch/snappy[static-libs(+)] )
3527 - spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
3528 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
3529 - tls? ( net-libs/gnutls[static-libs(+)] )
3530 - usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
3531 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
3532 - vde? ( net-misc/vde[static-libs(+)] )
3533 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
3534 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
3535 -X86_FIRMWARE_DEPEND="
3536 - >=sys-firmware/ipxe-1.0.0_p20130624
3537 - pin-upstream-blobs? (
3538 - ~sys-firmware/seabios-1.7.5
3539 - ~sys-firmware/sgabios-0.1_pre8
3540 - ~sys-firmware/vgabios-0.7a
3541 - )
3542 - !pin-upstream-blobs? (
3543 - sys-firmware/seabios
3544 - sys-firmware/sgabios
3545 - sys-firmware/vgabios
3546 - )"
3547 -CDEPEND="
3548 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
3549 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
3550 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
3551 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
3552 - accessibility? ( app-accessibility/brltty )
3553 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
3554 - bluetooth? ( net-wireless/bluez )
3555 - gtk? (
3556 - gtk2? ( x11-libs/gtk+:2 )
3557 - !gtk2? ( x11-libs/gtk+:3 )
3558 - x11-libs/vte:2.90
3559 - )
3560 - iscsi? ( net-libs/libiscsi )
3561 - opengl? ( virtual/opengl )
3562 - pulseaudio? ( media-sound/pulseaudio )
3563 - python? ( ${PYTHON_DEPS} )
3564 - sdl? ( media-libs/libsdl[X] )
3565 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
3566 - spice? ( >=app-emulation/spice-protocol-0.12.3 )
3567 - systemtap? ( dev-util/systemtap )
3568 - usbredir? ( >=sys-apps/usbredir-0.6 )
3569 - virtfs? ( sys-libs/libcap )
3570 - xen? ( app-emulation/xen-tools:= )"
3571 -DEPEND="${CDEPEND}
3572 - dev-lang/perl
3573 - =dev-lang/python-2*
3574 - sys-apps/texinfo
3575 - virtual/pkgconfig
3576 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
3577 - gtk? ( nls? ( sys-devel/gettext ) )
3578 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
3579 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
3580 - test? (
3581 - dev-libs/glib[utils]
3582 - sys-devel/bc
3583 - )"
3584 -RDEPEND="${CDEPEND}
3585 - selinux? ( sec-policy/selinux-qemu )
3586 -"
3587 -
3588 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
3589 -
3590 -QA_PREBUILT="
3591 - usr/share/qemu/openbios-ppc
3592 - usr/share/qemu/openbios-sparc64
3593 - usr/share/qemu/openbios-sparc32
3594 - usr/share/qemu/palcode-clipper
3595 - usr/share/qemu/s390-ccw.img
3596 - usr/share/qemu/u-boot.e500
3597 -"
3598 -
3599 -QA_WX_LOAD="usr/bin/qemu-i386
3600 - usr/bin/qemu-x86_64
3601 - usr/bin/qemu-alpha
3602 - usr/bin/qemu-arm
3603 - usr/bin/qemu-cris
3604 - usr/bin/qemu-m68k
3605 - usr/bin/qemu-microblaze
3606 - usr/bin/qemu-microblazeel
3607 - usr/bin/qemu-mips
3608 - usr/bin/qemu-mipsel
3609 - usr/bin/qemu-or32
3610 - usr/bin/qemu-ppc
3611 - usr/bin/qemu-ppc64
3612 - usr/bin/qemu-ppc64abi32
3613 - usr/bin/qemu-sh4
3614 - usr/bin/qemu-sh4eb
3615 - usr/bin/qemu-sparc
3616 - usr/bin/qemu-sparc64
3617 - usr/bin/qemu-armeb
3618 - usr/bin/qemu-sparc32plus
3619 - usr/bin/qemu-s390x
3620 - usr/bin/qemu-unicore32"
3621 -
3622 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
3623 -you have the kernel module loaded before running kvm. The easiest way to
3624 -ensure that the kernel module is loaded is to load it on boot.\n
3625 -For AMD CPUs the module is called 'kvm-amd'\n
3626 -For Intel CPUs the module is called 'kvm-intel'\n
3627 -Please review /etc/conf.d/modules for how to load these\n\n
3628 -Make sure your user is in the 'kvm' group\n
3629 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
3630 -
3631 -qemu_support_kvm() {
3632 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
3633 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
3634 - use qemu_softmmu_targets_s390x; then
3635 - return 0
3636 - fi
3637 -
3638 - return 1
3639 -}
3640 -
3641 -pkg_pretend() {
3642 - if use kernel_linux && kernel_is lt 2 6 25; then
3643 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
3644 - elif use kernel_linux; then
3645 - if ! linux_config_exists; then
3646 - eerror "Unable to check your kernel for KVM support"
3647 - else
3648 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
3649 - ERROR_KVM="You must enable KVM in your kernel to continue"
3650 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
3651 - ERROR_KVM_AMD+=" your kernel configuration."
3652 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
3653 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
3654 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
3655 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
3656 - ERROR_TUN+=" virtual network device if using -net tap."
3657 - ERROR_BRIDGE="You will also need support for 802.1d"
3658 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
3659 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
3660 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
3661 - ERROR_VHOST_NET+=" support"
3662 -
3663 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
3664 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
3665 - fi
3666 -
3667 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
3668 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
3669 -
3670 - # Now do the actual checks setup above
3671 - check_extra_config
3672 - fi
3673 - fi
3674 -
3675 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
3676 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
3677 - eerror "instances are still pointing to it. Please update your"
3678 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
3679 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
3680 - die "update your virt configs to not use qemu-kvm"
3681 - fi
3682 -}
3683 -
3684 -pkg_setup() {
3685 - enewgroup kvm 78
3686 -}
3687 -
3688 -src_prepare() {
3689 - # Alter target makefiles to accept CFLAGS set via flag-o
3690 - sed -i -r \
3691 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
3692 - Makefile Makefile.target || die
3693 -
3694 - # Cheap hack to disable gettext .mo generation.
3695 - use nls || rm -f po/*.po
3696 -
3697 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
3698 - epatch "${FILESDIR}"/${P}-CVE-2015-3456.patch #549404
3699 - epatch "${FILESDIR}"/${P}-CVE-2015-3209.patch #551752
3700 - epatch "${FILESDIR}"/${P}-CVE-2015-5158.patch #555680
3701 - epatch "${FILESDIR}"/${P}-CVE-2015-3214.patch #556052
3702 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-1.patch #556050 / #555532
3703 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-2.patch #556050 / #555532
3704 - epatch "${FILESDIR}"/${P}-CVE-2015-5154-3.patch #556050 / #555532
3705 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-1.patch #556304
3706 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-2.patch #556304
3707 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-3.patch #556304
3708 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-4.patch #556304
3709 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-5.patch #556304
3710 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-6.patch #556304
3711 - epatch "${FILESDIR}"/${P}-CVE-2015-5165-7.patch #556304
3712 - epatch "${FILESDIR}"/${P}-CVE-2015-5166.patch #556304
3713 - epatch "${FILESDIR}"/${P}-virtio-serial.patch #557206
3714 - [[ -n ${BACKPORTS} ]] && \
3715 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
3716 - epatch
3717 -
3718 - # Fix ld and objcopy being called directly
3719 - tc-export AR LD OBJCOPY
3720 -
3721 - # Verbose builds
3722 - MAKEOPTS+=" V=1"
3723 -
3724 - epatch_user
3725 -}
3726 -
3727 -##
3728 -# configures qemu based on the build directory and the build type
3729 -# we are using.
3730 -#
3731 -qemu_src_configure() {
3732 - debug-print-function ${FUNCNAME} "$@"
3733 -
3734 - local buildtype=$1
3735 - local builddir=$2
3736 - local static_flag="static-${buildtype}"
3737 -
3738 - # audio options
3739 - local audio_opts="oss"
3740 - use alsa && audio_opts="alsa,${audio_opts}"
3741 - use sdl && audio_opts="sdl,${audio_opts}"
3742 - use pulseaudio && audio_opts="pa,${audio_opts}"
3743 -
3744 - local conf_opts=(
3745 - --prefix=/usr
3746 - --sysconfdir=/etc
3747 - --libdir=/usr/$(get_libdir)
3748 - --docdir=/usr/share/doc/${PF}/html
3749 - --disable-bsd-user
3750 - --disable-guest-agent
3751 - --disable-strip
3752 - --disable-werror
3753 - --python="${PYTHON}"
3754 - --cc="$(tc-getCC)"
3755 - --cxx="$(tc-getCXX)"
3756 - --host-cc="$(tc-getBUILD_CC)"
3757 - $(use_enable debug debug-info)
3758 - $(use_enable debug debug-tcg)
3759 - --enable-docs
3760 - $(use_enable tci tcg-interpreter)
3761 - $(use_enable xattr attr)
3762 - )
3763 -
3764 - # Disable options not used by user targets as the default configure
3765 - # options will autoprobe and try to link in a bunch of unused junk.
3766 - conf_softmmu() {
3767 - if [[ ${buildtype} == "user" ]] ; then
3768 - echo "--disable-${2:-$1}"
3769 - else
3770 - use_enable "$@"
3771 - fi
3772 - }
3773 - conf_opts+=(
3774 - $(conf_softmmu accessibility brlapi)
3775 - $(conf_softmmu aio linux-aio)
3776 - $(conf_softmmu bluetooth bluez)
3777 - $(conf_softmmu caps cap-ng)
3778 - $(conf_softmmu curl)
3779 - $(conf_softmmu fdt)
3780 - $(conf_softmmu glusterfs)
3781 - $(conf_softmmu gtk)
3782 - $(conf_softmmu infiniband rdma)
3783 - $(conf_softmmu iscsi libiscsi)
3784 - $(conf_softmmu jpeg vnc-jpeg)
3785 - $(conf_softmmu kernel_linux kvm)
3786 - $(conf_softmmu lzo)
3787 - $(conf_softmmu ncurses curses)
3788 - $(conf_softmmu nfs libnfs)
3789 - $(conf_softmmu numa)
3790 - $(conf_softmmu opengl)
3791 - $(conf_softmmu png vnc-png)
3792 - $(conf_softmmu rbd)
3793 - $(conf_softmmu sasl vnc-sasl)
3794 - $(conf_softmmu sdl)
3795 - $(conf_softmmu seccomp)
3796 - $(conf_softmmu smartcard smartcard-nss)
3797 - $(conf_softmmu snappy)
3798 - $(conf_softmmu spice)
3799 - $(conf_softmmu ssh libssh2)
3800 - $(conf_softmmu tls quorum)
3801 - $(conf_softmmu tls vnc-tls)
3802 - $(conf_softmmu tls vnc-ws)
3803 - $(conf_softmmu usb libusb)
3804 - $(conf_softmmu usbredir usb-redir)
3805 - $(conf_softmmu uuid)
3806 - $(conf_softmmu vde)
3807 - $(conf_softmmu vhost-net)
3808 - $(conf_softmmu virtfs)
3809 - $(conf_softmmu vnc)
3810 - $(conf_softmmu xen)
3811 - $(conf_softmmu xen xen-pci-passthrough)
3812 - $(conf_softmmu xfs xfsctl)
3813 - )
3814 -
3815 - case ${buildtype} in
3816 - user)
3817 - conf_opts+=(
3818 - --enable-linux-user
3819 - --disable-system
3820 - --target-list="${user_targets}"
3821 - --disable-blobs
3822 - --disable-tools
3823 - )
3824 - ;;
3825 - softmmu)
3826 - conf_opts+=(
3827 - --disable-linux-user
3828 - --enable-system
3829 - --target-list="${softmmu_targets}"
3830 - --with-system-pixman
3831 - --audio-drv-list="${audio_opts}"
3832 - )
3833 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
3834 - ;;
3835 - esac
3836 -
3837 - # Add support for SystemTAP
3838 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
3839 -
3840 - # We always want to attempt to build with PIE support as it results
3841 - # in a more secure binary. But it doesn't work with static or if
3842 - # the current GCC doesn't have PIE support.
3843 - if use ${static_flag}; then
3844 - conf_opts+=( --static --disable-pie )
3845 - else
3846 - gcc-specs-pie && conf_opts+=( --enable-pie )
3847 - fi
3848 -
3849 - einfo "../configure ${conf_opts[*]}"
3850 - cd "${builddir}"
3851 - ../configure "${conf_opts[@]}" || die "configure failed"
3852 -
3853 - # FreeBSD's kernel does not support QEMU assigning/grabbing
3854 - # host USB devices yet
3855 - use kernel_FreeBSD && \
3856 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
3857 -}
3858 -
3859 -src_configure() {
3860 - local target
3861 -
3862 - python_setup
3863 -
3864 - softmmu_targets= softmmu_bins=()
3865 - user_targets= user_bins=()
3866 -
3867 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
3868 - if use "qemu_softmmu_targets_${target}"; then
3869 - softmmu_targets+=",${target}-softmmu"
3870 - softmmu_bins+=( "qemu-system-${target}" )
3871 - fi
3872 - done
3873 -
3874 - for target in ${IUSE_USER_TARGETS} ; do
3875 - if use "qemu_user_targets_${target}"; then
3876 - user_targets+=",${target}-linux-user"
3877 - user_bins+=( "qemu-${target}" )
3878 - fi
3879 - done
3880 -
3881 - [[ -n ${softmmu_targets} ]] && \
3882 - einfo "Building the following softmmu targets: ${softmmu_targets}"
3883 -
3884 - [[ -n ${user_targets} ]] && \
3885 - einfo "Building the following user targets: ${user_targets}"
3886 -
3887 - if [[ -n ${softmmu_targets} ]]; then
3888 - mkdir "${S}/softmmu-build"
3889 - qemu_src_configure "softmmu" "${S}/softmmu-build"
3890 - fi
3891 -
3892 - if [[ -n ${user_targets} ]]; then
3893 - mkdir "${S}/user-build"
3894 - qemu_src_configure "user" "${S}/user-build"
3895 - fi
3896 -}
3897 -
3898 -src_compile() {
3899 - if [[ -n ${user_targets} ]]; then
3900 - cd "${S}/user-build"
3901 - default
3902 - fi
3903 -
3904 - if [[ -n ${softmmu_targets} ]]; then
3905 - cd "${S}/softmmu-build"
3906 - default
3907 - fi
3908 -}
3909 -
3910 -src_test() {
3911 - if [[ -n ${softmmu_targets} ]]; then
3912 - cd "${S}/softmmu-build"
3913 - pax-mark m */qemu-system-* #515550
3914 - emake -j1 check
3915 - emake -j1 check-report.html
3916 - fi
3917 -}
3918 -
3919 -qemu_python_install() {
3920 - python_domodule "${S}/scripts/qmp/qmp.py"
3921 -
3922 - python_doscript "${S}/scripts/kvm/kvm_stat"
3923 - python_doscript "${S}/scripts/kvm/vmxcap"
3924 - python_doscript "${S}/scripts/qmp/qmp-shell"
3925 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
3926 -}
3927 -
3928 -src_install() {
3929 - if [[ -n ${user_targets} ]]; then
3930 - cd "${S}/user-build"
3931 - emake DESTDIR="${ED}" install
3932 -
3933 - # Install binfmt handler init script for user targets
3934 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
3935 - fi
3936 -
3937 - if [[ -n ${softmmu_targets} ]]; then
3938 - cd "${S}/softmmu-build"
3939 - emake DESTDIR="${ED}" install
3940 -
3941 - # This might not exist if the test failed. #512010
3942 - [[ -e check-report.html ]] && dohtml check-report.html
3943 -
3944 - if use kernel_linux; then
3945 - udev_dorules "${FILESDIR}"/65-kvm.rules
3946 - fi
3947 -
3948 - if use python; then
3949 - python_foreach_impl qemu_python_install
3950 - fi
3951 - fi
3952 -
3953 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
3954 - pushd "${ED}"/usr/bin >/dev/null
3955 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
3956 - popd >/dev/null
3957 -
3958 - # Install config file example for qemu-bridge-helper
3959 - insinto "/etc/qemu"
3960 - doins "${FILESDIR}/bridge.conf"
3961 -
3962 - # Remove the docdir placed qmp-commands.txt
3963 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
3964 -
3965 - cd "${S}"
3966 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
3967 - newdoc pc-bios/README README.pc-bios
3968 - dodoc docs/qmp/*.txt
3969 -
3970 - if [[ -n ${softmmu_targets} ]]; then
3971 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
3972 - rm "${ED}/usr/share/qemu/bios.bin"
3973 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3974 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
3975 - fi
3976 -
3977 - # Remove vgabios since we're using the vgabios packaged one
3978 - rm "${ED}/usr/share/qemu/vgabios.bin"
3979 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
3980 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
3981 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
3982 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
3983 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3984 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
3985 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
3986 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
3987 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
3988 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
3989 - fi
3990 -
3991 - # Remove sgabios since we're using the sgabios packaged one
3992 - rm "${ED}/usr/share/qemu/sgabios.bin"
3993 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
3994 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
3995 - fi
3996 -
3997 - # Remove iPXE since we're using the iPXE packaged one
3998 - rm "${ED}"/usr/share/qemu/pxe-*.rom
3999 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
4000 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
4001 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
4002 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
4003 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
4004 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
4005 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
4006 - fi
4007 - fi
4008 -
4009 - qemu_support_kvm && readme.gentoo_create_doc
4010 -}
4011 -
4012 -pkg_postinst() {
4013 - if qemu_support_kvm; then
4014 - readme.gentoo_print_elog
4015 - ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
4016 - ewarn "save states has been removed starting with the 1.6.2 release"
4017 - ewarn
4018 - ewarn "It is recommended that you migrate any VMs that may be running"
4019 - ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
4020 - ewarn "any saved states with a newer qemu."
4021 - ewarn
4022 - ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
4023 -
4024 - if use x86 || use amd64; then
4025 - ewarn
4026 - ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
4027 - ewarn "installed. In order to use kvm acceleration, pass the flag"
4028 - ewarn "-enable-kvm when running your system target."
4029 - fi
4030 - fi
4031 -
4032 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
4033 - udev_reload
4034 - fi
4035 -
4036 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
4037 -}
4038 -
4039 -pkg_info() {
4040 - echo "Using:"
4041 - echo " $(best_version app-emulation/spice-protocol)"
4042 - echo " $(best_version sys-firmware/ipxe)"
4043 - echo " $(best_version sys-firmware/seabios)"
4044 - if has_version sys-firmware/seabios[binary]; then
4045 - echo " USE=binary"
4046 - else
4047 - echo " USE=''"
4048 - fi
4049 - echo " $(best_version sys-firmware/vgabios)"
4050 -}
4051
4052 diff --git a/app-emulation/qemu/qemu-2.3.1-r1.ebuild b/app-emulation/qemu/qemu-2.3.1-r1.ebuild
4053 deleted file mode 100644
4054 index d3349e4..0000000
4055 --- a/app-emulation/qemu/qemu-2.3.1-r1.ebuild
4056 +++ /dev/null
4057 @@ -1,598 +0,0 @@
4058 -# Copyright 1999-2015 Gentoo Foundation
4059 -# Distributed under the terms of the GNU General Public License v2
4060 -# $Id$
4061 -
4062 -EAPI=5
4063 -
4064 -PYTHON_COMPAT=( python2_7 )
4065 -PYTHON_REQ_USE="ncurses,readline"
4066 -
4067 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
4068 - user udev fcaps readme.gentoo pax-utils
4069 -
4070 -BACKPORTS=
4071 -
4072 -if [[ ${PV} = *9999* ]]; then
4073 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
4074 - inherit git-2
4075 - SRC_URI=""
4076 -else
4077 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
4078 - ${BACKPORTS:+
4079 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
4080 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
4081 -fi
4082 -
4083 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
4084 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
4085 -
4086 -LICENSE="GPL-2 LGPL-2 BSD-2"
4087 -SLOT="0"
4088 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
4089 -gtk gtk2 infiniband iscsi +jpeg \
4090 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
4091 -+png pulseaudio python \
4092 -rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
4093 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
4094 -virtfs +vnc xattr xen xfs"
4095 -
4096 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
4097 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
4098 -x86_64"
4099 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
4100 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
4101 -
4102 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
4103 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
4104 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
4105 -
4106 -# Require at least one softmmu or user target.
4107 -# Block USE flag configurations known to not work.
4108 -REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
4109 - ${PYTHON_REQUIRED_USE}
4110 - gtk2? ( gtk )
4111 - qemu_softmmu_targets_arm? ( fdt )
4112 - qemu_softmmu_targets_microblaze? ( fdt )
4113 - qemu_softmmu_targets_ppc? ( fdt )
4114 - qemu_softmmu_targets_ppc64? ( fdt )
4115 - static? ( static-softmmu static-user )
4116 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
4117 - virtfs? ( xattr )"
4118 -
4119 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
4120 -#
4121 -# The attr lib isn't always linked in (although the USE flag is always
4122 -# respected). This is because qemu supports using the C library's API
4123 -# when available rather than always using the extranl library.
4124 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
4125 - sys-libs/zlib[static-libs(+)]
4126 - xattr? ( sys-apps/attr[static-libs(+)] )"
4127 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
4128 - >=x11-libs/pixman-0.28.0[static-libs(+)]
4129 - aio? ( dev-libs/libaio[static-libs(+)] )
4130 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
4131 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
4132 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
4133 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
4134 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
4135 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
4136 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
4137 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
4138 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
4139 - numa? ( sys-process/numactl[static-libs(+)] )
4140 - png? ( media-libs/libpng:0=[static-libs(+)] )
4141 - rbd? ( sys-cluster/ceph[static-libs(+)] )
4142 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
4143 - sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
4144 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
4145 - snappy? ( app-arch/snappy[static-libs(+)] )
4146 - spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
4147 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
4148 - tls? ( net-libs/gnutls[static-libs(+)] )
4149 - usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
4150 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
4151 - vde? ( net-misc/vde[static-libs(+)] )
4152 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
4153 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
4154 -X86_FIRMWARE_DEPEND="
4155 - >=sys-firmware/ipxe-1.0.0_p20130624
4156 - pin-upstream-blobs? (
4157 - ~sys-firmware/seabios-1.7.5
4158 - ~sys-firmware/sgabios-0.1_pre8
4159 - ~sys-firmware/vgabios-0.7a
4160 - )
4161 - !pin-upstream-blobs? (
4162 - sys-firmware/seabios
4163 - sys-firmware/sgabios
4164 - sys-firmware/vgabios
4165 - )"
4166 -CDEPEND="
4167 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
4168 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
4169 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
4170 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
4171 - accessibility? ( app-accessibility/brltty )
4172 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
4173 - bluetooth? ( net-wireless/bluez )
4174 - gtk? (
4175 - gtk2? ( x11-libs/gtk+:2 )
4176 - !gtk2? ( x11-libs/gtk+:3 )
4177 - x11-libs/vte:2.90
4178 - )
4179 - iscsi? ( net-libs/libiscsi )
4180 - opengl? ( virtual/opengl )
4181 - pulseaudio? ( media-sound/pulseaudio )
4182 - python? ( ${PYTHON_DEPS} )
4183 - sdl? ( media-libs/libsdl[X] )
4184 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
4185 - spice? ( >=app-emulation/spice-protocol-0.12.3 )
4186 - systemtap? ( dev-util/systemtap )
4187 - usbredir? ( >=sys-apps/usbredir-0.6 )
4188 - virtfs? ( sys-libs/libcap )
4189 - xen? ( app-emulation/xen-tools:= )"
4190 -DEPEND="${CDEPEND}
4191 - dev-lang/perl
4192 - =dev-lang/python-2*
4193 - sys-apps/texinfo
4194 - virtual/pkgconfig
4195 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
4196 - gtk? ( nls? ( sys-devel/gettext ) )
4197 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
4198 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
4199 - test? (
4200 - dev-libs/glib[utils]
4201 - sys-devel/bc
4202 - )"
4203 -RDEPEND="${CDEPEND}
4204 - selinux? ( sec-policy/selinux-qemu )
4205 -"
4206 -
4207 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
4208 -
4209 -QA_PREBUILT="
4210 - usr/share/qemu/openbios-ppc
4211 - usr/share/qemu/openbios-sparc64
4212 - usr/share/qemu/openbios-sparc32
4213 - usr/share/qemu/palcode-clipper
4214 - usr/share/qemu/s390-ccw.img
4215 - usr/share/qemu/u-boot.e500
4216 -"
4217 -
4218 -QA_WX_LOAD="usr/bin/qemu-i386
4219 - usr/bin/qemu-x86_64
4220 - usr/bin/qemu-alpha
4221 - usr/bin/qemu-arm
4222 - usr/bin/qemu-cris
4223 - usr/bin/qemu-m68k
4224 - usr/bin/qemu-microblaze
4225 - usr/bin/qemu-microblazeel
4226 - usr/bin/qemu-mips
4227 - usr/bin/qemu-mipsel
4228 - usr/bin/qemu-or32
4229 - usr/bin/qemu-ppc
4230 - usr/bin/qemu-ppc64
4231 - usr/bin/qemu-ppc64abi32
4232 - usr/bin/qemu-sh4
4233 - usr/bin/qemu-sh4eb
4234 - usr/bin/qemu-sparc
4235 - usr/bin/qemu-sparc64
4236 - usr/bin/qemu-armeb
4237 - usr/bin/qemu-sparc32plus
4238 - usr/bin/qemu-s390x
4239 - usr/bin/qemu-unicore32"
4240 -
4241 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
4242 -you have the kernel module loaded before running kvm. The easiest way to
4243 -ensure that the kernel module is loaded is to load it on boot.\n
4244 -For AMD CPUs the module is called 'kvm-amd'\n
4245 -For Intel CPUs the module is called 'kvm-intel'\n
4246 -Please review /etc/conf.d/modules for how to load these\n\n
4247 -Make sure your user is in the 'kvm' group\n
4248 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
4249 -
4250 -qemu_support_kvm() {
4251 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
4252 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
4253 - use qemu_softmmu_targets_s390x; then
4254 - return 0
4255 - fi
4256 -
4257 - return 1
4258 -}
4259 -
4260 -pkg_pretend() {
4261 - if use kernel_linux && kernel_is lt 2 6 25; then
4262 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
4263 - elif use kernel_linux; then
4264 - if ! linux_config_exists; then
4265 - eerror "Unable to check your kernel for KVM support"
4266 - else
4267 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
4268 - ERROR_KVM="You must enable KVM in your kernel to continue"
4269 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
4270 - ERROR_KVM_AMD+=" your kernel configuration."
4271 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
4272 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
4273 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
4274 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
4275 - ERROR_TUN+=" virtual network device if using -net tap."
4276 - ERROR_BRIDGE="You will also need support for 802.1d"
4277 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
4278 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
4279 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
4280 - ERROR_VHOST_NET+=" support"
4281 -
4282 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
4283 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
4284 - fi
4285 -
4286 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
4287 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
4288 -
4289 - # Now do the actual checks setup above
4290 - check_extra_config
4291 - fi
4292 - fi
4293 -
4294 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
4295 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
4296 - eerror "instances are still pointing to it. Please update your"
4297 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
4298 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
4299 - die "update your virt configs to not use qemu-kvm"
4300 - fi
4301 -}
4302 -
4303 -pkg_setup() {
4304 - enewgroup kvm 78
4305 -}
4306 -
4307 -src_prepare() {
4308 - # Alter target makefiles to accept CFLAGS set via flag-o
4309 - sed -i -r \
4310 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
4311 - Makefile Makefile.target || die
4312 -
4313 - # Cheap hack to disable gettext .mo generation.
4314 - use nls || rm -f po/*.po
4315 -
4316 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
4317 - epatch "${FILESDIR}"/${PN}-2.3.0-CVE-2015-3209.patch #551752
4318 - epatch "${FILESDIR}"/${PN}-2.3.0-virtio-serial.patch #557206
4319 - [[ -n ${BACKPORTS} ]] && \
4320 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
4321 - epatch
4322 -
4323 - # Fix ld and objcopy being called directly
4324 - tc-export AR LD OBJCOPY
4325 -
4326 - # Verbose builds
4327 - MAKEOPTS+=" V=1"
4328 -
4329 - epatch_user
4330 -}
4331 -
4332 -##
4333 -# configures qemu based on the build directory and the build type
4334 -# we are using.
4335 -#
4336 -qemu_src_configure() {
4337 - debug-print-function ${FUNCNAME} "$@"
4338 -
4339 - local buildtype=$1
4340 - local builddir=$2
4341 - local static_flag="static-${buildtype}"
4342 -
4343 - # audio options
4344 - local audio_opts="oss"
4345 - use alsa && audio_opts="alsa,${audio_opts}"
4346 - use sdl && audio_opts="sdl,${audio_opts}"
4347 - use pulseaudio && audio_opts="pa,${audio_opts}"
4348 -
4349 - local conf_opts=(
4350 - --prefix=/usr
4351 - --sysconfdir=/etc
4352 - --libdir=/usr/$(get_libdir)
4353 - --docdir=/usr/share/doc/${PF}/html
4354 - --disable-bsd-user
4355 - --disable-guest-agent
4356 - --disable-strip
4357 - --disable-werror
4358 - --python="${PYTHON}"
4359 - --cc="$(tc-getCC)"
4360 - --cxx="$(tc-getCXX)"
4361 - --host-cc="$(tc-getBUILD_CC)"
4362 - $(use_enable debug debug-info)
4363 - $(use_enable debug debug-tcg)
4364 - --enable-docs
4365 - $(use_enable tci tcg-interpreter)
4366 - $(use_enable xattr attr)
4367 - )
4368 -
4369 - # Disable options not used by user targets as the default configure
4370 - # options will autoprobe and try to link in a bunch of unused junk.
4371 - conf_softmmu() {
4372 - if [[ ${buildtype} == "user" ]] ; then
4373 - echo "--disable-${2:-$1}"
4374 - else
4375 - use_enable "$@"
4376 - fi
4377 - }
4378 - conf_opts+=(
4379 - $(conf_softmmu accessibility brlapi)
4380 - $(conf_softmmu aio linux-aio)
4381 - $(conf_softmmu bluetooth bluez)
4382 - $(conf_softmmu caps cap-ng)
4383 - $(conf_softmmu curl)
4384 - $(conf_softmmu fdt)
4385 - $(conf_softmmu glusterfs)
4386 - $(conf_softmmu gtk)
4387 - $(conf_softmmu infiniband rdma)
4388 - $(conf_softmmu iscsi libiscsi)
4389 - $(conf_softmmu jpeg vnc-jpeg)
4390 - $(conf_softmmu kernel_linux kvm)
4391 - $(conf_softmmu lzo)
4392 - $(conf_softmmu ncurses curses)
4393 - $(conf_softmmu nfs libnfs)
4394 - $(conf_softmmu numa)
4395 - $(conf_softmmu opengl)
4396 - $(conf_softmmu png vnc-png)
4397 - $(conf_softmmu rbd)
4398 - $(conf_softmmu sasl vnc-sasl)
4399 - $(conf_softmmu sdl)
4400 - $(conf_softmmu seccomp)
4401 - $(conf_softmmu smartcard smartcard-nss)
4402 - $(conf_softmmu snappy)
4403 - $(conf_softmmu spice)
4404 - $(conf_softmmu ssh libssh2)
4405 - $(conf_softmmu tls quorum)
4406 - $(conf_softmmu tls vnc-tls)
4407 - $(conf_softmmu tls vnc-ws)
4408 - $(conf_softmmu usb libusb)
4409 - $(conf_softmmu usbredir usb-redir)
4410 - $(conf_softmmu uuid)
4411 - $(conf_softmmu vde)
4412 - $(conf_softmmu vhost-net)
4413 - $(conf_softmmu virtfs)
4414 - $(conf_softmmu vnc)
4415 - $(conf_softmmu xen)
4416 - $(conf_softmmu xen xen-pci-passthrough)
4417 - $(conf_softmmu xfs xfsctl)
4418 - )
4419 -
4420 - case ${buildtype} in
4421 - user)
4422 - conf_opts+=(
4423 - --enable-linux-user
4424 - --disable-system
4425 - --target-list="${user_targets}"
4426 - --disable-blobs
4427 - --disable-tools
4428 - )
4429 - ;;
4430 - softmmu)
4431 - conf_opts+=(
4432 - --disable-linux-user
4433 - --enable-system
4434 - --target-list="${softmmu_targets}"
4435 - --with-system-pixman
4436 - --audio-drv-list="${audio_opts}"
4437 - )
4438 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
4439 - ;;
4440 - esac
4441 -
4442 - # Add support for SystemTAP
4443 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
4444 -
4445 - # We always want to attempt to build with PIE support as it results
4446 - # in a more secure binary. But it doesn't work with static or if
4447 - # the current GCC doesn't have PIE support.
4448 - if use ${static_flag}; then
4449 - conf_opts+=( --static --disable-pie )
4450 - else
4451 - gcc-specs-pie && conf_opts+=( --enable-pie )
4452 - fi
4453 -
4454 - einfo "../configure ${conf_opts[*]}"
4455 - cd "${builddir}"
4456 - ../configure "${conf_opts[@]}" || die "configure failed"
4457 -
4458 - # FreeBSD's kernel does not support QEMU assigning/grabbing
4459 - # host USB devices yet
4460 - use kernel_FreeBSD && \
4461 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
4462 -}
4463 -
4464 -src_configure() {
4465 - local target
4466 -
4467 - python_setup
4468 -
4469 - softmmu_targets= softmmu_bins=()
4470 - user_targets= user_bins=()
4471 -
4472 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
4473 - if use "qemu_softmmu_targets_${target}"; then
4474 - softmmu_targets+=",${target}-softmmu"
4475 - softmmu_bins+=( "qemu-system-${target}" )
4476 - fi
4477 - done
4478 -
4479 - for target in ${IUSE_USER_TARGETS} ; do
4480 - if use "qemu_user_targets_${target}"; then
4481 - user_targets+=",${target}-linux-user"
4482 - user_bins+=( "qemu-${target}" )
4483 - fi
4484 - done
4485 -
4486 - [[ -n ${softmmu_targets} ]] && \
4487 - einfo "Building the following softmmu targets: ${softmmu_targets}"
4488 -
4489 - [[ -n ${user_targets} ]] && \
4490 - einfo "Building the following user targets: ${user_targets}"
4491 -
4492 - if [[ -n ${softmmu_targets} ]]; then
4493 - mkdir "${S}/softmmu-build"
4494 - qemu_src_configure "softmmu" "${S}/softmmu-build"
4495 - fi
4496 -
4497 - if [[ -n ${user_targets} ]]; then
4498 - mkdir "${S}/user-build"
4499 - qemu_src_configure "user" "${S}/user-build"
4500 - fi
4501 -}
4502 -
4503 -src_compile() {
4504 - if [[ -n ${user_targets} ]]; then
4505 - cd "${S}/user-build"
4506 - default
4507 - fi
4508 -
4509 - if [[ -n ${softmmu_targets} ]]; then
4510 - cd "${S}/softmmu-build"
4511 - default
4512 - fi
4513 -}
4514 -
4515 -src_test() {
4516 - if [[ -n ${softmmu_targets} ]]; then
4517 - cd "${S}/softmmu-build"
4518 - pax-mark m */qemu-system-* #515550
4519 - emake -j1 check
4520 - emake -j1 check-report.html
4521 - fi
4522 -}
4523 -
4524 -qemu_python_install() {
4525 - python_domodule "${S}/scripts/qmp/qmp.py"
4526 -
4527 - python_doscript "${S}/scripts/kvm/kvm_stat"
4528 - python_doscript "${S}/scripts/kvm/vmxcap"
4529 - python_doscript "${S}/scripts/qmp/qmp-shell"
4530 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
4531 -}
4532 -
4533 -src_install() {
4534 - if [[ -n ${user_targets} ]]; then
4535 - cd "${S}/user-build"
4536 - emake DESTDIR="${ED}" install
4537 -
4538 - # Install binfmt handler init script for user targets
4539 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
4540 - fi
4541 -
4542 - if [[ -n ${softmmu_targets} ]]; then
4543 - cd "${S}/softmmu-build"
4544 - emake DESTDIR="${ED}" install
4545 -
4546 - # This might not exist if the test failed. #512010
4547 - [[ -e check-report.html ]] && dohtml check-report.html
4548 -
4549 - if use kernel_linux; then
4550 - udev_dorules "${FILESDIR}"/65-kvm.rules
4551 - fi
4552 -
4553 - if use python; then
4554 - python_foreach_impl qemu_python_install
4555 - fi
4556 - fi
4557 -
4558 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
4559 - pushd "${ED}"/usr/bin >/dev/null
4560 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
4561 - popd >/dev/null
4562 -
4563 - # Install config file example for qemu-bridge-helper
4564 - insinto "/etc/qemu"
4565 - doins "${FILESDIR}/bridge.conf"
4566 -
4567 - # Remove the docdir placed qmp-commands.txt
4568 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
4569 -
4570 - cd "${S}"
4571 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
4572 - newdoc pc-bios/README README.pc-bios
4573 - dodoc docs/qmp/*.txt
4574 -
4575 - if [[ -n ${softmmu_targets} ]]; then
4576 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
4577 - rm "${ED}/usr/share/qemu/bios.bin"
4578 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
4579 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
4580 - fi
4581 -
4582 - # Remove vgabios since we're using the vgabios packaged one
4583 - rm "${ED}/usr/share/qemu/vgabios.bin"
4584 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
4585 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
4586 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
4587 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
4588 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
4589 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
4590 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
4591 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
4592 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
4593 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
4594 - fi
4595 -
4596 - # Remove sgabios since we're using the sgabios packaged one
4597 - rm "${ED}/usr/share/qemu/sgabios.bin"
4598 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
4599 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
4600 - fi
4601 -
4602 - # Remove iPXE since we're using the iPXE packaged one
4603 - rm "${ED}"/usr/share/qemu/pxe-*.rom
4604 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
4605 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
4606 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
4607 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
4608 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
4609 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
4610 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
4611 - fi
4612 - fi
4613 -
4614 - qemu_support_kvm && readme.gentoo_create_doc
4615 -}
4616 -
4617 -pkg_postinst() {
4618 - if qemu_support_kvm; then
4619 - readme.gentoo_print_elog
4620 - ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
4621 - ewarn "save states has been removed starting with the 1.6.2 release"
4622 - ewarn
4623 - ewarn "It is recommended that you migrate any VMs that may be running"
4624 - ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
4625 - ewarn "any saved states with a newer qemu."
4626 - ewarn
4627 - ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
4628 -
4629 - if use x86 || use amd64; then
4630 - ewarn
4631 - ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
4632 - ewarn "installed. In order to use kvm acceleration, pass the flag"
4633 - ewarn "-enable-kvm when running your system target."
4634 - fi
4635 - fi
4636 -
4637 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
4638 - udev_reload
4639 - fi
4640 -
4641 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
4642 -}
4643 -
4644 -pkg_info() {
4645 - echo "Using:"
4646 - echo " $(best_version app-emulation/spice-protocol)"
4647 - echo " $(best_version sys-firmware/ipxe)"
4648 - echo " $(best_version sys-firmware/seabios)"
4649 - if has_version sys-firmware/seabios[binary]; then
4650 - echo " USE=binary"
4651 - else
4652 - echo " USE=''"
4653 - fi
4654 - echo " $(best_version sys-firmware/vgabios)"
4655 -}
4656
4657 diff --git a/app-emulation/qemu/qemu-2.3.1.ebuild b/app-emulation/qemu/qemu-2.3.1.ebuild
4658 deleted file mode 100644
4659 index d3349e4..0000000
4660 --- a/app-emulation/qemu/qemu-2.3.1.ebuild
4661 +++ /dev/null
4662 @@ -1,598 +0,0 @@
4663 -# Copyright 1999-2015 Gentoo Foundation
4664 -# Distributed under the terms of the GNU General Public License v2
4665 -# $Id$
4666 -
4667 -EAPI=5
4668 -
4669 -PYTHON_COMPAT=( python2_7 )
4670 -PYTHON_REQ_USE="ncurses,readline"
4671 -
4672 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
4673 - user udev fcaps readme.gentoo pax-utils
4674 -
4675 -BACKPORTS=
4676 -
4677 -if [[ ${PV} = *9999* ]]; then
4678 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
4679 - inherit git-2
4680 - SRC_URI=""
4681 -else
4682 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
4683 - ${BACKPORTS:+
4684 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
4685 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
4686 -fi
4687 -
4688 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
4689 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
4690 -
4691 -LICENSE="GPL-2 LGPL-2 BSD-2"
4692 -SLOT="0"
4693 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
4694 -gtk gtk2 infiniband iscsi +jpeg \
4695 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
4696 -+png pulseaudio python \
4697 -rbd sasl +seccomp sdl selinux smartcard snappy spice ssh static static-softmmu \
4698 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
4699 -virtfs +vnc xattr xen xfs"
4700 -
4701 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
4702 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
4703 -x86_64"
4704 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb xtensa xtensaeb"
4705 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 sparc32plus"
4706 -
4707 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
4708 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
4709 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
4710 -
4711 -# Require at least one softmmu or user target.
4712 -# Block USE flag configurations known to not work.
4713 -REQUIRED_USE="|| ( ${use_softmmu_targets} ${use_user_targets} )
4714 - ${PYTHON_REQUIRED_USE}
4715 - gtk2? ( gtk )
4716 - qemu_softmmu_targets_arm? ( fdt )
4717 - qemu_softmmu_targets_microblaze? ( fdt )
4718 - qemu_softmmu_targets_ppc? ( fdt )
4719 - qemu_softmmu_targets_ppc64? ( fdt )
4720 - static? ( static-softmmu static-user )
4721 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
4722 - virtfs? ( xattr )"
4723 -
4724 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
4725 -#
4726 -# The attr lib isn't always linked in (although the USE flag is always
4727 -# respected). This is because qemu supports using the C library's API
4728 -# when available rather than always using the extranl library.
4729 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
4730 - sys-libs/zlib[static-libs(+)]
4731 - xattr? ( sys-apps/attr[static-libs(+)] )"
4732 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
4733 - >=x11-libs/pixman-0.28.0[static-libs(+)]
4734 - aio? ( dev-libs/libaio[static-libs(+)] )
4735 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
4736 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
4737 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
4738 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
4739 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
4740 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
4741 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
4742 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
4743 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
4744 - numa? ( sys-process/numactl[static-libs(+)] )
4745 - png? ( media-libs/libpng:0=[static-libs(+)] )
4746 - rbd? ( sys-cluster/ceph[static-libs(+)] )
4747 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
4748 - sdl? ( >=media-libs/libsdl-1.2.11[static-libs(+)] )
4749 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
4750 - snappy? ( app-arch/snappy[static-libs(+)] )
4751 - spice? ( >=app-emulation/spice-0.12.0[static-libs(+)] )
4752 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
4753 - tls? ( net-libs/gnutls[static-libs(+)] )
4754 - usb? ( >=virtual/libusb-1-r1[static-libs(+)] )
4755 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
4756 - vde? ( net-misc/vde[static-libs(+)] )
4757 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
4758 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
4759 -X86_FIRMWARE_DEPEND="
4760 - >=sys-firmware/ipxe-1.0.0_p20130624
4761 - pin-upstream-blobs? (
4762 - ~sys-firmware/seabios-1.7.5
4763 - ~sys-firmware/sgabios-0.1_pre8
4764 - ~sys-firmware/vgabios-0.7a
4765 - )
4766 - !pin-upstream-blobs? (
4767 - sys-firmware/seabios
4768 - sys-firmware/sgabios
4769 - sys-firmware/vgabios
4770 - )"
4771 -CDEPEND="
4772 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
4773 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
4774 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
4775 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
4776 - accessibility? ( app-accessibility/brltty )
4777 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
4778 - bluetooth? ( net-wireless/bluez )
4779 - gtk? (
4780 - gtk2? ( x11-libs/gtk+:2 )
4781 - !gtk2? ( x11-libs/gtk+:3 )
4782 - x11-libs/vte:2.90
4783 - )
4784 - iscsi? ( net-libs/libiscsi )
4785 - opengl? ( virtual/opengl )
4786 - pulseaudio? ( media-sound/pulseaudio )
4787 - python? ( ${PYTHON_DEPS} )
4788 - sdl? ( media-libs/libsdl[X] )
4789 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
4790 - spice? ( >=app-emulation/spice-protocol-0.12.3 )
4791 - systemtap? ( dev-util/systemtap )
4792 - usbredir? ( >=sys-apps/usbredir-0.6 )
4793 - virtfs? ( sys-libs/libcap )
4794 - xen? ( app-emulation/xen-tools:= )"
4795 -DEPEND="${CDEPEND}
4796 - dev-lang/perl
4797 - =dev-lang/python-2*
4798 - sys-apps/texinfo
4799 - virtual/pkgconfig
4800 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
4801 - gtk? ( nls? ( sys-devel/gettext ) )
4802 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
4803 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
4804 - test? (
4805 - dev-libs/glib[utils]
4806 - sys-devel/bc
4807 - )"
4808 -RDEPEND="${CDEPEND}
4809 - selinux? ( sec-policy/selinux-qemu )
4810 -"
4811 -
4812 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
4813 -
4814 -QA_PREBUILT="
4815 - usr/share/qemu/openbios-ppc
4816 - usr/share/qemu/openbios-sparc64
4817 - usr/share/qemu/openbios-sparc32
4818 - usr/share/qemu/palcode-clipper
4819 - usr/share/qemu/s390-ccw.img
4820 - usr/share/qemu/u-boot.e500
4821 -"
4822 -
4823 -QA_WX_LOAD="usr/bin/qemu-i386
4824 - usr/bin/qemu-x86_64
4825 - usr/bin/qemu-alpha
4826 - usr/bin/qemu-arm
4827 - usr/bin/qemu-cris
4828 - usr/bin/qemu-m68k
4829 - usr/bin/qemu-microblaze
4830 - usr/bin/qemu-microblazeel
4831 - usr/bin/qemu-mips
4832 - usr/bin/qemu-mipsel
4833 - usr/bin/qemu-or32
4834 - usr/bin/qemu-ppc
4835 - usr/bin/qemu-ppc64
4836 - usr/bin/qemu-ppc64abi32
4837 - usr/bin/qemu-sh4
4838 - usr/bin/qemu-sh4eb
4839 - usr/bin/qemu-sparc
4840 - usr/bin/qemu-sparc64
4841 - usr/bin/qemu-armeb
4842 - usr/bin/qemu-sparc32plus
4843 - usr/bin/qemu-s390x
4844 - usr/bin/qemu-unicore32"
4845 -
4846 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
4847 -you have the kernel module loaded before running kvm. The easiest way to
4848 -ensure that the kernel module is loaded is to load it on boot.\n
4849 -For AMD CPUs the module is called 'kvm-amd'\n
4850 -For Intel CPUs the module is called 'kvm-intel'\n
4851 -Please review /etc/conf.d/modules for how to load these\n\n
4852 -Make sure your user is in the 'kvm' group\n
4853 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
4854 -
4855 -qemu_support_kvm() {
4856 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
4857 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
4858 - use qemu_softmmu_targets_s390x; then
4859 - return 0
4860 - fi
4861 -
4862 - return 1
4863 -}
4864 -
4865 -pkg_pretend() {
4866 - if use kernel_linux && kernel_is lt 2 6 25; then
4867 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
4868 - elif use kernel_linux; then
4869 - if ! linux_config_exists; then
4870 - eerror "Unable to check your kernel for KVM support"
4871 - else
4872 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
4873 - ERROR_KVM="You must enable KVM in your kernel to continue"
4874 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
4875 - ERROR_KVM_AMD+=" your kernel configuration."
4876 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
4877 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
4878 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
4879 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
4880 - ERROR_TUN+=" virtual network device if using -net tap."
4881 - ERROR_BRIDGE="You will also need support for 802.1d"
4882 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
4883 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
4884 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
4885 - ERROR_VHOST_NET+=" support"
4886 -
4887 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
4888 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
4889 - fi
4890 -
4891 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
4892 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
4893 -
4894 - # Now do the actual checks setup above
4895 - check_extra_config
4896 - fi
4897 - fi
4898 -
4899 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
4900 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
4901 - eerror "instances are still pointing to it. Please update your"
4902 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
4903 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
4904 - die "update your virt configs to not use qemu-kvm"
4905 - fi
4906 -}
4907 -
4908 -pkg_setup() {
4909 - enewgroup kvm 78
4910 -}
4911 -
4912 -src_prepare() {
4913 - # Alter target makefiles to accept CFLAGS set via flag-o
4914 - sed -i -r \
4915 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
4916 - Makefile Makefile.target || die
4917 -
4918 - # Cheap hack to disable gettext .mo generation.
4919 - use nls || rm -f po/*.po
4920 -
4921 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
4922 - epatch "${FILESDIR}"/${PN}-2.3.0-CVE-2015-3209.patch #551752
4923 - epatch "${FILESDIR}"/${PN}-2.3.0-virtio-serial.patch #557206
4924 - [[ -n ${BACKPORTS} ]] && \
4925 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
4926 - epatch
4927 -
4928 - # Fix ld and objcopy being called directly
4929 - tc-export AR LD OBJCOPY
4930 -
4931 - # Verbose builds
4932 - MAKEOPTS+=" V=1"
4933 -
4934 - epatch_user
4935 -}
4936 -
4937 -##
4938 -# configures qemu based on the build directory and the build type
4939 -# we are using.
4940 -#
4941 -qemu_src_configure() {
4942 - debug-print-function ${FUNCNAME} "$@"
4943 -
4944 - local buildtype=$1
4945 - local builddir=$2
4946 - local static_flag="static-${buildtype}"
4947 -
4948 - # audio options
4949 - local audio_opts="oss"
4950 - use alsa && audio_opts="alsa,${audio_opts}"
4951 - use sdl && audio_opts="sdl,${audio_opts}"
4952 - use pulseaudio && audio_opts="pa,${audio_opts}"
4953 -
4954 - local conf_opts=(
4955 - --prefix=/usr
4956 - --sysconfdir=/etc
4957 - --libdir=/usr/$(get_libdir)
4958 - --docdir=/usr/share/doc/${PF}/html
4959 - --disable-bsd-user
4960 - --disable-guest-agent
4961 - --disable-strip
4962 - --disable-werror
4963 - --python="${PYTHON}"
4964 - --cc="$(tc-getCC)"
4965 - --cxx="$(tc-getCXX)"
4966 - --host-cc="$(tc-getBUILD_CC)"
4967 - $(use_enable debug debug-info)
4968 - $(use_enable debug debug-tcg)
4969 - --enable-docs
4970 - $(use_enable tci tcg-interpreter)
4971 - $(use_enable xattr attr)
4972 - )
4973 -
4974 - # Disable options not used by user targets as the default configure
4975 - # options will autoprobe and try to link in a bunch of unused junk.
4976 - conf_softmmu() {
4977 - if [[ ${buildtype} == "user" ]] ; then
4978 - echo "--disable-${2:-$1}"
4979 - else
4980 - use_enable "$@"
4981 - fi
4982 - }
4983 - conf_opts+=(
4984 - $(conf_softmmu accessibility brlapi)
4985 - $(conf_softmmu aio linux-aio)
4986 - $(conf_softmmu bluetooth bluez)
4987 - $(conf_softmmu caps cap-ng)
4988 - $(conf_softmmu curl)
4989 - $(conf_softmmu fdt)
4990 - $(conf_softmmu glusterfs)
4991 - $(conf_softmmu gtk)
4992 - $(conf_softmmu infiniband rdma)
4993 - $(conf_softmmu iscsi libiscsi)
4994 - $(conf_softmmu jpeg vnc-jpeg)
4995 - $(conf_softmmu kernel_linux kvm)
4996 - $(conf_softmmu lzo)
4997 - $(conf_softmmu ncurses curses)
4998 - $(conf_softmmu nfs libnfs)
4999 - $(conf_softmmu numa)
5000 - $(conf_softmmu opengl)
5001 - $(conf_softmmu png vnc-png)
5002 - $(conf_softmmu rbd)
5003 - $(conf_softmmu sasl vnc-sasl)
5004 - $(conf_softmmu sdl)
5005 - $(conf_softmmu seccomp)
5006 - $(conf_softmmu smartcard smartcard-nss)
5007 - $(conf_softmmu snappy)
5008 - $(conf_softmmu spice)
5009 - $(conf_softmmu ssh libssh2)
5010 - $(conf_softmmu tls quorum)
5011 - $(conf_softmmu tls vnc-tls)
5012 - $(conf_softmmu tls vnc-ws)
5013 - $(conf_softmmu usb libusb)
5014 - $(conf_softmmu usbredir usb-redir)
5015 - $(conf_softmmu uuid)
5016 - $(conf_softmmu vde)
5017 - $(conf_softmmu vhost-net)
5018 - $(conf_softmmu virtfs)
5019 - $(conf_softmmu vnc)
5020 - $(conf_softmmu xen)
5021 - $(conf_softmmu xen xen-pci-passthrough)
5022 - $(conf_softmmu xfs xfsctl)
5023 - )
5024 -
5025 - case ${buildtype} in
5026 - user)
5027 - conf_opts+=(
5028 - --enable-linux-user
5029 - --disable-system
5030 - --target-list="${user_targets}"
5031 - --disable-blobs
5032 - --disable-tools
5033 - )
5034 - ;;
5035 - softmmu)
5036 - conf_opts+=(
5037 - --disable-linux-user
5038 - --enable-system
5039 - --target-list="${softmmu_targets}"
5040 - --with-system-pixman
5041 - --audio-drv-list="${audio_opts}"
5042 - )
5043 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
5044 - ;;
5045 - esac
5046 -
5047 - # Add support for SystemTAP
5048 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
5049 -
5050 - # We always want to attempt to build with PIE support as it results
5051 - # in a more secure binary. But it doesn't work with static or if
5052 - # the current GCC doesn't have PIE support.
5053 - if use ${static_flag}; then
5054 - conf_opts+=( --static --disable-pie )
5055 - else
5056 - gcc-specs-pie && conf_opts+=( --enable-pie )
5057 - fi
5058 -
5059 - einfo "../configure ${conf_opts[*]}"
5060 - cd "${builddir}"
5061 - ../configure "${conf_opts[@]}" || die "configure failed"
5062 -
5063 - # FreeBSD's kernel does not support QEMU assigning/grabbing
5064 - # host USB devices yet
5065 - use kernel_FreeBSD && \
5066 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
5067 -}
5068 -
5069 -src_configure() {
5070 - local target
5071 -
5072 - python_setup
5073 -
5074 - softmmu_targets= softmmu_bins=()
5075 - user_targets= user_bins=()
5076 -
5077 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
5078 - if use "qemu_softmmu_targets_${target}"; then
5079 - softmmu_targets+=",${target}-softmmu"
5080 - softmmu_bins+=( "qemu-system-${target}" )
5081 - fi
5082 - done
5083 -
5084 - for target in ${IUSE_USER_TARGETS} ; do
5085 - if use "qemu_user_targets_${target}"; then
5086 - user_targets+=",${target}-linux-user"
5087 - user_bins+=( "qemu-${target}" )
5088 - fi
5089 - done
5090 -
5091 - [[ -n ${softmmu_targets} ]] && \
5092 - einfo "Building the following softmmu targets: ${softmmu_targets}"
5093 -
5094 - [[ -n ${user_targets} ]] && \
5095 - einfo "Building the following user targets: ${user_targets}"
5096 -
5097 - if [[ -n ${softmmu_targets} ]]; then
5098 - mkdir "${S}/softmmu-build"
5099 - qemu_src_configure "softmmu" "${S}/softmmu-build"
5100 - fi
5101 -
5102 - if [[ -n ${user_targets} ]]; then
5103 - mkdir "${S}/user-build"
5104 - qemu_src_configure "user" "${S}/user-build"
5105 - fi
5106 -}
5107 -
5108 -src_compile() {
5109 - if [[ -n ${user_targets} ]]; then
5110 - cd "${S}/user-build"
5111 - default
5112 - fi
5113 -
5114 - if [[ -n ${softmmu_targets} ]]; then
5115 - cd "${S}/softmmu-build"
5116 - default
5117 - fi
5118 -}
5119 -
5120 -src_test() {
5121 - if [[ -n ${softmmu_targets} ]]; then
5122 - cd "${S}/softmmu-build"
5123 - pax-mark m */qemu-system-* #515550
5124 - emake -j1 check
5125 - emake -j1 check-report.html
5126 - fi
5127 -}
5128 -
5129 -qemu_python_install() {
5130 - python_domodule "${S}/scripts/qmp/qmp.py"
5131 -
5132 - python_doscript "${S}/scripts/kvm/kvm_stat"
5133 - python_doscript "${S}/scripts/kvm/vmxcap"
5134 - python_doscript "${S}/scripts/qmp/qmp-shell"
5135 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
5136 -}
5137 -
5138 -src_install() {
5139 - if [[ -n ${user_targets} ]]; then
5140 - cd "${S}/user-build"
5141 - emake DESTDIR="${ED}" install
5142 -
5143 - # Install binfmt handler init script for user targets
5144 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
5145 - fi
5146 -
5147 - if [[ -n ${softmmu_targets} ]]; then
5148 - cd "${S}/softmmu-build"
5149 - emake DESTDIR="${ED}" install
5150 -
5151 - # This might not exist if the test failed. #512010
5152 - [[ -e check-report.html ]] && dohtml check-report.html
5153 -
5154 - if use kernel_linux; then
5155 - udev_dorules "${FILESDIR}"/65-kvm.rules
5156 - fi
5157 -
5158 - if use python; then
5159 - python_foreach_impl qemu_python_install
5160 - fi
5161 - fi
5162 -
5163 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
5164 - pushd "${ED}"/usr/bin >/dev/null
5165 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
5166 - popd >/dev/null
5167 -
5168 - # Install config file example for qemu-bridge-helper
5169 - insinto "/etc/qemu"
5170 - doins "${FILESDIR}/bridge.conf"
5171 -
5172 - # Remove the docdir placed qmp-commands.txt
5173 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
5174 -
5175 - cd "${S}"
5176 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
5177 - newdoc pc-bios/README README.pc-bios
5178 - dodoc docs/qmp/*.txt
5179 -
5180 - if [[ -n ${softmmu_targets} ]]; then
5181 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
5182 - rm "${ED}/usr/share/qemu/bios.bin"
5183 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5184 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
5185 - fi
5186 -
5187 - # Remove vgabios since we're using the vgabios packaged one
5188 - rm "${ED}/usr/share/qemu/vgabios.bin"
5189 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
5190 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
5191 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
5192 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
5193 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5194 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
5195 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
5196 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
5197 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
5198 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
5199 - fi
5200 -
5201 - # Remove sgabios since we're using the sgabios packaged one
5202 - rm "${ED}/usr/share/qemu/sgabios.bin"
5203 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5204 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
5205 - fi
5206 -
5207 - # Remove iPXE since we're using the iPXE packaged one
5208 - rm "${ED}"/usr/share/qemu/pxe-*.rom
5209 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5210 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
5211 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
5212 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
5213 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
5214 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
5215 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
5216 - fi
5217 - fi
5218 -
5219 - qemu_support_kvm && readme.gentoo_create_doc
5220 -}
5221 -
5222 -pkg_postinst() {
5223 - if qemu_support_kvm; then
5224 - readme.gentoo_print_elog
5225 - ewarn "Migration from qemu-kvm instances and loading qemu-kvm created"
5226 - ewarn "save states has been removed starting with the 1.6.2 release"
5227 - ewarn
5228 - ewarn "It is recommended that you migrate any VMs that may be running"
5229 - ewarn "on qemu-kvm to a host with a newer qemu and regenerate"
5230 - ewarn "any saved states with a newer qemu."
5231 - ewarn
5232 - ewarn "qemu-kvm was the primary qemu provider in Gentoo through 1.2.x"
5233 -
5234 - if use x86 || use amd64; then
5235 - ewarn
5236 - ewarn "The /usr/bin/kvm and /usr/bin/qemu-kvm wrappers are no longer"
5237 - ewarn "installed. In order to use kvm acceleration, pass the flag"
5238 - ewarn "-enable-kvm when running your system target."
5239 - fi
5240 - fi
5241 -
5242 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
5243 - udev_reload
5244 - fi
5245 -
5246 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
5247 -}
5248 -
5249 -pkg_info() {
5250 - echo "Using:"
5251 - echo " $(best_version app-emulation/spice-protocol)"
5252 - echo " $(best_version sys-firmware/ipxe)"
5253 - echo " $(best_version sys-firmware/seabios)"
5254 - if has_version sys-firmware/seabios[binary]; then
5255 - echo " USE=binary"
5256 - else
5257 - echo " USE=''"
5258 - fi
5259 - echo " $(best_version sys-firmware/vgabios)"
5260 -}
5261
5262 diff --git a/app-emulation/qemu/qemu-2.4.0-r1.ebuild b/app-emulation/qemu/qemu-2.4.0-r1.ebuild
5263 deleted file mode 100644
5264 index ad8c85d..0000000
5265 --- a/app-emulation/qemu/qemu-2.4.0-r1.ebuild
5266 +++ /dev/null
5267 @@ -1,640 +0,0 @@
5268 -# Copyright 1999-2015 Gentoo Foundation
5269 -# Distributed under the terms of the GNU General Public License v2
5270 -# $Id$
5271 -
5272 -EAPI=5
5273 -
5274 -PYTHON_COMPAT=( python2_7 )
5275 -PYTHON_REQ_USE="ncurses,readline"
5276 -
5277 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
5278 - user udev fcaps readme.gentoo pax-utils
5279 -
5280 -BACKPORTS=
5281 -
5282 -if [[ ${PV} = *9999* ]]; then
5283 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
5284 - inherit git-2
5285 - SRC_URI=""
5286 -else
5287 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
5288 - ${BACKPORTS:+
5289 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
5290 - KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
5291 -fi
5292 -
5293 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
5294 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
5295 -
5296 -LICENSE="GPL-2 LGPL-2 BSD-2"
5297 -SLOT="0"
5298 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
5299 -gtk gtk2 infiniband iscsi +jpeg \
5300 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
5301 -+png pulseaudio python \
5302 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
5303 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
5304 -virtfs +vnc vte xattr xen xfs"
5305 -
5306 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
5307 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
5308 -x86_64"
5309 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
5310 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
5311 -
5312 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
5313 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
5314 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
5315 -
5316 -# Allow no targets to be built so that people can get a tools-only build.
5317 -# Block USE flag configurations known to not work.
5318 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
5319 - gtk2? ( gtk )
5320 - qemu_softmmu_targets_arm? ( fdt )
5321 - qemu_softmmu_targets_microblaze? ( fdt )
5322 - qemu_softmmu_targets_ppc? ( fdt )
5323 - qemu_softmmu_targets_ppc64? ( fdt )
5324 - sdl2? ( sdl )
5325 - static? ( static-softmmu static-user )
5326 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
5327 - virtfs? ( xattr )
5328 - vte? ( gtk )"
5329 -
5330 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
5331 -#
5332 -# The attr lib isn't always linked in (although the USE flag is always
5333 -# respected). This is because qemu supports using the C library's API
5334 -# when available rather than always using the extranl library.
5335 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
5336 - sys-libs/zlib[static-libs(+)]
5337 - xattr? ( sys-apps/attr[static-libs(+)] )"
5338 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
5339 - >=x11-libs/pixman-0.28.0[static-libs(+)]
5340 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
5341 - aio? ( dev-libs/libaio[static-libs(+)] )
5342 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
5343 - bluetooth? ( net-wireless/bluez )
5344 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
5345 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
5346 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
5347 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
5348 - gtk? (
5349 - gtk2? (
5350 - x11-libs/gtk+:2
5351 - vte? ( x11-libs/vte:0 )
5352 - )
5353 - !gtk2? (
5354 - x11-libs/gtk+:3
5355 - vte? ( x11-libs/vte:2.90 )
5356 - )
5357 - )
5358 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
5359 - iscsi? ( net-libs/libiscsi )
5360 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
5361 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
5362 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
5363 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
5364 - numa? ( sys-process/numactl[static-libs(+)] )
5365 - opengl? (
5366 - virtual/opengl
5367 - media-libs/libepoxy[static-libs(+)]
5368 - media-libs/mesa[static-libs(+)]
5369 - media-libs/mesa[egl,gles2]
5370 - )
5371 - png? ( media-libs/libpng:0=[static-libs(+)] )
5372 - pulseaudio? ( media-sound/pulseaudio )
5373 - rbd? ( sys-cluster/ceph[static-libs(+)] )
5374 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
5375 - sdl? (
5376 - !sdl2? (
5377 - media-libs/libsdl[X]
5378 - >=media-libs/libsdl-1.2.11[static-libs(+)]
5379 - )
5380 - sdl2? (
5381 - media-libs/libsdl2[X]
5382 - media-libs/libsdl2[static-libs(+)]
5383 - )
5384 - )
5385 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
5386 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
5387 - snappy? ( app-arch/snappy[static-libs(+)] )
5388 - spice? (
5389 - >=app-emulation/spice-protocol-0.12.3
5390 - >=app-emulation/spice-0.12.0[static-libs(+)]
5391 - )
5392 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
5393 - tls? ( net-libs/gnutls[static-libs(+)] )
5394 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
5395 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
5396 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
5397 - vde? ( net-misc/vde[static-libs(+)] )
5398 - virtfs? ( sys-libs/libcap )
5399 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
5400 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
5401 -X86_FIRMWARE_DEPEND="
5402 - >=sys-firmware/ipxe-1.0.0_p20130624
5403 - pin-upstream-blobs? (
5404 - ~sys-firmware/seabios-1.8.2
5405 - ~sys-firmware/sgabios-0.1_pre8
5406 - ~sys-firmware/vgabios-0.7a
5407 - )
5408 - !pin-upstream-blobs? (
5409 - sys-firmware/seabios
5410 - sys-firmware/sgabios
5411 - sys-firmware/vgabios
5412 - )"
5413 -CDEPEND="
5414 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
5415 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
5416 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
5417 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
5418 - python? ( ${PYTHON_DEPS} )
5419 - systemtap? ( dev-util/systemtap )
5420 - xen? ( app-emulation/xen-tools:= )"
5421 -DEPEND="${CDEPEND}
5422 - dev-lang/perl
5423 - =dev-lang/python-2*
5424 - sys-apps/texinfo
5425 - virtual/pkgconfig
5426 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
5427 - gtk? ( nls? ( sys-devel/gettext ) )
5428 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
5429 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
5430 - test? (
5431 - dev-libs/glib[utils]
5432 - sys-devel/bc
5433 - )"
5434 -RDEPEND="${CDEPEND}
5435 - selinux? ( sec-policy/selinux-qemu )
5436 -"
5437 -
5438 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
5439 -
5440 -QA_PREBUILT="
5441 - usr/share/qemu/openbios-ppc
5442 - usr/share/qemu/openbios-sparc64
5443 - usr/share/qemu/openbios-sparc32
5444 - usr/share/qemu/palcode-clipper
5445 - usr/share/qemu/s390-ccw.img
5446 - usr/share/qemu/u-boot.e500
5447 -"
5448 -
5449 -QA_WX_LOAD="usr/bin/qemu-i386
5450 - usr/bin/qemu-x86_64
5451 - usr/bin/qemu-alpha
5452 - usr/bin/qemu-arm
5453 - usr/bin/qemu-cris
5454 - usr/bin/qemu-m68k
5455 - usr/bin/qemu-microblaze
5456 - usr/bin/qemu-microblazeel
5457 - usr/bin/qemu-mips
5458 - usr/bin/qemu-mipsel
5459 - usr/bin/qemu-or32
5460 - usr/bin/qemu-ppc
5461 - usr/bin/qemu-ppc64
5462 - usr/bin/qemu-ppc64abi32
5463 - usr/bin/qemu-sh4
5464 - usr/bin/qemu-sh4eb
5465 - usr/bin/qemu-sparc
5466 - usr/bin/qemu-sparc64
5467 - usr/bin/qemu-armeb
5468 - usr/bin/qemu-sparc32plus
5469 - usr/bin/qemu-s390x
5470 - usr/bin/qemu-unicore32"
5471 -
5472 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
5473 -you have the kernel module loaded before running kvm. The easiest way to
5474 -ensure that the kernel module is loaded is to load it on boot.\n
5475 -For AMD CPUs the module is called 'kvm-amd'\n
5476 -For Intel CPUs the module is called 'kvm-intel'\n
5477 -Please review /etc/conf.d/modules for how to load these\n\n
5478 -Make sure your user is in the 'kvm' group\n
5479 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
5480 -
5481 -qemu_support_kvm() {
5482 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
5483 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
5484 - use qemu_softmmu_targets_s390x; then
5485 - return 0
5486 - fi
5487 -
5488 - return 1
5489 -}
5490 -
5491 -pkg_pretend() {
5492 - if use kernel_linux && kernel_is lt 2 6 25; then
5493 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
5494 - elif use kernel_linux; then
5495 - if ! linux_config_exists; then
5496 - eerror "Unable to check your kernel for KVM support"
5497 - else
5498 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
5499 - ERROR_KVM="You must enable KVM in your kernel to continue"
5500 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
5501 - ERROR_KVM_AMD+=" your kernel configuration."
5502 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
5503 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
5504 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
5505 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
5506 - ERROR_TUN+=" virtual network device if using -net tap."
5507 - ERROR_BRIDGE="You will also need support for 802.1d"
5508 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
5509 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
5510 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
5511 - ERROR_VHOST_NET+=" support"
5512 -
5513 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
5514 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
5515 - fi
5516 -
5517 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
5518 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
5519 -
5520 - # Now do the actual checks setup above
5521 - check_extra_config
5522 - fi
5523 - fi
5524 -
5525 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
5526 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
5527 - eerror "instances are still pointing to it. Please update your"
5528 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
5529 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
5530 - die "update your virt configs to not use qemu-kvm"
5531 - fi
5532 -}
5533 -
5534 -pkg_setup() {
5535 - enewgroup kvm 78
5536 -}
5537 -
5538 -# Sanity check to make sure target lists are kept up-to-date.
5539 -check_targets() {
5540 - local var=$1 mak=$2
5541 - local detected sorted
5542 -
5543 - pushd "${S}"/default-configs >/dev/null || die
5544 -
5545 - # Force C locale until glibc is updated. #564936
5546 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
5547 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
5548 - if [[ ${sorted} != "${detected}" ]] ; then
5549 - eerror "The ebuild needs to be kept in sync."
5550 - eerror "${var}: ${sorted}"
5551 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
5552 - die "sync ${var} to the list of targets"
5553 - fi
5554 -
5555 - popd >/dev/null
5556 -}
5557 -
5558 -src_prepare() {
5559 - check_targets IUSE_SOFTMMU_TARGETS softmmu
5560 - check_targets IUSE_USER_TARGETS linux-user
5561 -
5562 - # Alter target makefiles to accept CFLAGS set via flag-o
5563 - sed -i -r \
5564 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
5565 - Makefile Makefile.target || die
5566 -
5567 - # Cheap hack to disable gettext .mo generation.
5568 - use nls || rm -f po/*.po
5569 -
5570 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
5571 - epatch "${FILESDIR}"/${P}-block-mirror-crash.patch #558396
5572 - epatch "${FILESDIR}"/${P}-CVE-2015-5225.patch #558416
5573 - epatch "${FILESDIR}"/${PN}-2.4.0-e1000-loop.patch #559656
5574 - [[ -n ${BACKPORTS} ]] && \
5575 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
5576 - epatch
5577 -
5578 - # Fix ld and objcopy being called directly
5579 - tc-export AR LD OBJCOPY
5580 -
5581 - # Verbose builds
5582 - MAKEOPTS+=" V=1"
5583 -
5584 - epatch_user
5585 -}
5586 -
5587 -##
5588 -# configures qemu based on the build directory and the build type
5589 -# we are using.
5590 -#
5591 -qemu_src_configure() {
5592 - debug-print-function ${FUNCNAME} "$@"
5593 -
5594 - local buildtype=$1
5595 - local builddir="${S}/${buildtype}-build"
5596 - local static_flag="static-${buildtype}"
5597 -
5598 - mkdir "${builddir}"
5599 -
5600 - local conf_opts=(
5601 - --prefix=/usr
5602 - --sysconfdir=/etc
5603 - --libdir=/usr/$(get_libdir)
5604 - --docdir=/usr/share/doc/${PF}/html
5605 - --disable-bsd-user
5606 - --disable-guest-agent
5607 - --disable-strip
5608 - --disable-werror
5609 - --python="${PYTHON}"
5610 - --cc="$(tc-getCC)"
5611 - --cxx="$(tc-getCXX)"
5612 - --host-cc="$(tc-getBUILD_CC)"
5613 - $(use_enable debug debug-info)
5614 - $(use_enable debug debug-tcg)
5615 - --enable-docs
5616 - $(use_enable tci tcg-interpreter)
5617 - $(use_enable xattr attr)
5618 - )
5619 -
5620 - # Disable options not used by user targets as the default configure
5621 - # options will autoprobe and try to link in a bunch of unused junk.
5622 - conf_softmmu() {
5623 - if [[ ${buildtype} == "user" ]] ; then
5624 - echo "--disable-${2:-$1}"
5625 - else
5626 - use_enable "$@"
5627 - fi
5628 - }
5629 - conf_opts+=(
5630 - $(conf_softmmu accessibility brlapi)
5631 - $(conf_softmmu aio linux-aio)
5632 - $(conf_softmmu bluetooth bluez)
5633 - $(conf_softmmu caps cap-ng)
5634 - $(conf_softmmu curl)
5635 - $(conf_softmmu fdt)
5636 - $(conf_softmmu glusterfs)
5637 - $(conf_softmmu gtk)
5638 - $(conf_softmmu infiniband rdma)
5639 - $(conf_softmmu iscsi libiscsi)
5640 - $(conf_softmmu jpeg vnc-jpeg)
5641 - $(conf_softmmu kernel_linux kvm)
5642 - $(conf_softmmu lzo)
5643 - $(conf_softmmu ncurses curses)
5644 - $(conf_softmmu nfs libnfs)
5645 - $(conf_softmmu numa)
5646 - $(conf_softmmu opengl)
5647 - $(conf_softmmu png vnc-png)
5648 - $(conf_softmmu rbd)
5649 - $(conf_softmmu sasl vnc-sasl)
5650 - $(conf_softmmu sdl)
5651 - $(conf_softmmu seccomp)
5652 - $(conf_softmmu smartcard smartcard-nss)
5653 - $(conf_softmmu snappy)
5654 - $(conf_softmmu spice)
5655 - $(conf_softmmu ssh libssh2)
5656 - $(conf_softmmu tls vnc-tls)
5657 - $(conf_softmmu usb libusb)
5658 - $(conf_softmmu usbredir usb-redir)
5659 - $(conf_softmmu uuid)
5660 - $(conf_softmmu vde)
5661 - $(conf_softmmu vhost-net)
5662 - $(conf_softmmu virtfs)
5663 - $(conf_softmmu vnc)
5664 - $(conf_softmmu vte)
5665 - $(conf_softmmu xen)
5666 - $(conf_softmmu xen xen-pci-passthrough)
5667 - $(conf_softmmu xfs xfsctl)
5668 - )
5669 -
5670 - case ${buildtype} in
5671 - user)
5672 - conf_opts+=(
5673 - --enable-linux-user
5674 - --disable-system
5675 - --disable-blobs
5676 - --disable-tools
5677 - )
5678 - ;;
5679 - softmmu)
5680 - # audio options
5681 - local audio_opts="oss"
5682 - use alsa && audio_opts="alsa,${audio_opts}"
5683 - use sdl && audio_opts="sdl,${audio_opts}"
5684 - use pulseaudio && audio_opts="pa,${audio_opts}"
5685 -
5686 - conf_opts+=(
5687 - --disable-linux-user
5688 - --enable-system
5689 - --with-system-pixman
5690 - --audio-drv-list="${audio_opts}"
5691 - )
5692 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
5693 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
5694 - ;;
5695 - tools)
5696 - conf_opts+=(
5697 - --disable-linux-user
5698 - --disable-system
5699 - --disable-blobs
5700 - )
5701 - static_flag="static"
5702 - ;;
5703 - esac
5704 -
5705 - local targets="${buildtype}_targets"
5706 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
5707 -
5708 - # Add support for SystemTAP
5709 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
5710 -
5711 - # We always want to attempt to build with PIE support as it results
5712 - # in a more secure binary. But it doesn't work with static or if
5713 - # the current GCC doesn't have PIE support.
5714 - if use ${static_flag}; then
5715 - conf_opts+=( --static --disable-pie )
5716 - else
5717 - gcc-specs-pie && conf_opts+=( --enable-pie )
5718 - fi
5719 -
5720 - echo "../configure ${conf_opts[*]}"
5721 - cd "${builddir}"
5722 - ../configure "${conf_opts[@]}" || die "configure failed"
5723 -
5724 - # FreeBSD's kernel does not support QEMU assigning/grabbing
5725 - # host USB devices yet
5726 - use kernel_FreeBSD && \
5727 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
5728 -}
5729 -
5730 -src_configure() {
5731 - local target
5732 -
5733 - python_setup
5734 -
5735 - softmmu_targets= softmmu_bins=()
5736 - user_targets= user_bins=()
5737 -
5738 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
5739 - if use "qemu_softmmu_targets_${target}"; then
5740 - softmmu_targets+=",${target}-softmmu"
5741 - softmmu_bins+=( "qemu-system-${target}" )
5742 - fi
5743 - done
5744 -
5745 - for target in ${IUSE_USER_TARGETS} ; do
5746 - if use "qemu_user_targets_${target}"; then
5747 - user_targets+=",${target}-linux-user"
5748 - user_bins+=( "qemu-${target}" )
5749 - fi
5750 - done
5751 -
5752 - softmmu_targets=${softmmu_targets#,}
5753 - user_targets=${user_targets#,}
5754 -
5755 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
5756 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
5757 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
5758 -}
5759 -
5760 -src_compile() {
5761 - if [[ -n ${user_targets} ]]; then
5762 - cd "${S}/user-build"
5763 - default
5764 - fi
5765 -
5766 - if [[ -n ${softmmu_targets} ]]; then
5767 - cd "${S}/softmmu-build"
5768 - default
5769 - fi
5770 -
5771 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
5772 - cd "${S}/tools-build"
5773 - default
5774 - fi
5775 -}
5776 -
5777 -src_test() {
5778 - if [[ -n ${softmmu_targets} ]]; then
5779 - cd "${S}/softmmu-build"
5780 - pax-mark m */qemu-system-* #515550
5781 - emake -j1 check
5782 - emake -j1 check-report.html
5783 - fi
5784 -}
5785 -
5786 -qemu_python_install() {
5787 - python_domodule "${S}/scripts/qmp/qmp.py"
5788 -
5789 - python_doscript "${S}/scripts/kvm/kvm_stat"
5790 - python_doscript "${S}/scripts/kvm/vmxcap"
5791 - python_doscript "${S}/scripts/qmp/qmp-shell"
5792 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
5793 -}
5794 -
5795 -src_install() {
5796 - if [[ -n ${user_targets} ]]; then
5797 - cd "${S}/user-build"
5798 - emake DESTDIR="${ED}" install
5799 -
5800 - # Install binfmt handler init script for user targets
5801 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
5802 - fi
5803 -
5804 - if [[ -n ${softmmu_targets} ]]; then
5805 - cd "${S}/softmmu-build"
5806 - emake DESTDIR="${ED}" install
5807 -
5808 - # This might not exist if the test failed. #512010
5809 - [[ -e check-report.html ]] && dohtml check-report.html
5810 -
5811 - if use kernel_linux; then
5812 - udev_dorules "${FILESDIR}"/65-kvm.rules
5813 - fi
5814 -
5815 - if use python; then
5816 - python_foreach_impl qemu_python_install
5817 - fi
5818 - fi
5819 -
5820 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
5821 - cd "${S}/tools-build"
5822 - emake DESTDIR="${ED}" install
5823 - fi
5824 -
5825 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
5826 - pushd "${ED}"/usr/bin >/dev/null
5827 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
5828 - popd >/dev/null
5829 -
5830 - # Install config file example for qemu-bridge-helper
5831 - insinto "/etc/qemu"
5832 - doins "${FILESDIR}/bridge.conf"
5833 -
5834 - # Remove the docdir placed qmp-commands.txt
5835 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
5836 -
5837 - cd "${S}"
5838 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
5839 - newdoc pc-bios/README README.pc-bios
5840 - dodoc docs/qmp/*.txt
5841 -
5842 - if [[ -n ${softmmu_targets} ]]; then
5843 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
5844 - rm "${ED}/usr/share/qemu/bios.bin"
5845 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5846 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
5847 - fi
5848 -
5849 - # Remove vgabios since we're using the vgabios packaged one
5850 - rm "${ED}/usr/share/qemu/vgabios.bin"
5851 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
5852 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
5853 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
5854 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
5855 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5856 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
5857 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
5858 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
5859 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
5860 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
5861 - fi
5862 -
5863 - # Remove sgabios since we're using the sgabios packaged one
5864 - rm "${ED}/usr/share/qemu/sgabios.bin"
5865 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5866 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
5867 - fi
5868 -
5869 - # Remove iPXE since we're using the iPXE packaged one
5870 - rm "${ED}"/usr/share/qemu/pxe-*.rom
5871 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
5872 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
5873 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
5874 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
5875 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
5876 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
5877 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
5878 - fi
5879 - fi
5880 -
5881 - qemu_support_kvm && readme.gentoo_create_doc
5882 -}
5883 -
5884 -pkg_postinst() {
5885 - if qemu_support_kvm; then
5886 - readme.gentoo_print_elog
5887 - fi
5888 -
5889 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
5890 - udev_reload
5891 - fi
5892 -
5893 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
5894 -}
5895 -
5896 -pkg_info() {
5897 - echo "Using:"
5898 - echo " $(best_version app-emulation/spice-protocol)"
5899 - echo " $(best_version sys-firmware/ipxe)"
5900 - echo " $(best_version sys-firmware/seabios)"
5901 - if has_version 'sys-firmware/seabios[binary]'; then
5902 - echo " USE=binary"
5903 - else
5904 - echo " USE=''"
5905 - fi
5906 - echo " $(best_version sys-firmware/vgabios)"
5907 -}
5908
5909 diff --git a/app-emulation/qemu/qemu-2.4.0-r2.ebuild b/app-emulation/qemu/qemu-2.4.0-r2.ebuild
5910 deleted file mode 100644
5911 index ad8c85d..0000000
5912 --- a/app-emulation/qemu/qemu-2.4.0-r2.ebuild
5913 +++ /dev/null
5914 @@ -1,640 +0,0 @@
5915 -# Copyright 1999-2015 Gentoo Foundation
5916 -# Distributed under the terms of the GNU General Public License v2
5917 -# $Id$
5918 -
5919 -EAPI=5
5920 -
5921 -PYTHON_COMPAT=( python2_7 )
5922 -PYTHON_REQ_USE="ncurses,readline"
5923 -
5924 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
5925 - user udev fcaps readme.gentoo pax-utils
5926 -
5927 -BACKPORTS=
5928 -
5929 -if [[ ${PV} = *9999* ]]; then
5930 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
5931 - inherit git-2
5932 - SRC_URI=""
5933 -else
5934 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
5935 - ${BACKPORTS:+
5936 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
5937 - KEYWORDS="amd64 ~ppc ~ppc64 x86 ~x86-fbsd"
5938 -fi
5939 -
5940 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
5941 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
5942 -
5943 -LICENSE="GPL-2 LGPL-2 BSD-2"
5944 -SLOT="0"
5945 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
5946 -gtk gtk2 infiniband iscsi +jpeg \
5947 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
5948 -+png pulseaudio python \
5949 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
5950 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
5951 -virtfs +vnc vte xattr xen xfs"
5952 -
5953 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
5954 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
5955 -x86_64"
5956 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
5957 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
5958 -
5959 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
5960 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
5961 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
5962 -
5963 -# Allow no targets to be built so that people can get a tools-only build.
5964 -# Block USE flag configurations known to not work.
5965 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
5966 - gtk2? ( gtk )
5967 - qemu_softmmu_targets_arm? ( fdt )
5968 - qemu_softmmu_targets_microblaze? ( fdt )
5969 - qemu_softmmu_targets_ppc? ( fdt )
5970 - qemu_softmmu_targets_ppc64? ( fdt )
5971 - sdl2? ( sdl )
5972 - static? ( static-softmmu static-user )
5973 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
5974 - virtfs? ( xattr )
5975 - vte? ( gtk )"
5976 -
5977 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
5978 -#
5979 -# The attr lib isn't always linked in (although the USE flag is always
5980 -# respected). This is because qemu supports using the C library's API
5981 -# when available rather than always using the extranl library.
5982 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
5983 - sys-libs/zlib[static-libs(+)]
5984 - xattr? ( sys-apps/attr[static-libs(+)] )"
5985 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
5986 - >=x11-libs/pixman-0.28.0[static-libs(+)]
5987 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
5988 - aio? ( dev-libs/libaio[static-libs(+)] )
5989 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
5990 - bluetooth? ( net-wireless/bluez )
5991 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
5992 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
5993 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
5994 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
5995 - gtk? (
5996 - gtk2? (
5997 - x11-libs/gtk+:2
5998 - vte? ( x11-libs/vte:0 )
5999 - )
6000 - !gtk2? (
6001 - x11-libs/gtk+:3
6002 - vte? ( x11-libs/vte:2.90 )
6003 - )
6004 - )
6005 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
6006 - iscsi? ( net-libs/libiscsi )
6007 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
6008 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
6009 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
6010 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
6011 - numa? ( sys-process/numactl[static-libs(+)] )
6012 - opengl? (
6013 - virtual/opengl
6014 - media-libs/libepoxy[static-libs(+)]
6015 - media-libs/mesa[static-libs(+)]
6016 - media-libs/mesa[egl,gles2]
6017 - )
6018 - png? ( media-libs/libpng:0=[static-libs(+)] )
6019 - pulseaudio? ( media-sound/pulseaudio )
6020 - rbd? ( sys-cluster/ceph[static-libs(+)] )
6021 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
6022 - sdl? (
6023 - !sdl2? (
6024 - media-libs/libsdl[X]
6025 - >=media-libs/libsdl-1.2.11[static-libs(+)]
6026 - )
6027 - sdl2? (
6028 - media-libs/libsdl2[X]
6029 - media-libs/libsdl2[static-libs(+)]
6030 - )
6031 - )
6032 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
6033 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
6034 - snappy? ( app-arch/snappy[static-libs(+)] )
6035 - spice? (
6036 - >=app-emulation/spice-protocol-0.12.3
6037 - >=app-emulation/spice-0.12.0[static-libs(+)]
6038 - )
6039 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
6040 - tls? ( net-libs/gnutls[static-libs(+)] )
6041 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
6042 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
6043 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
6044 - vde? ( net-misc/vde[static-libs(+)] )
6045 - virtfs? ( sys-libs/libcap )
6046 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
6047 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
6048 -X86_FIRMWARE_DEPEND="
6049 - >=sys-firmware/ipxe-1.0.0_p20130624
6050 - pin-upstream-blobs? (
6051 - ~sys-firmware/seabios-1.8.2
6052 - ~sys-firmware/sgabios-0.1_pre8
6053 - ~sys-firmware/vgabios-0.7a
6054 - )
6055 - !pin-upstream-blobs? (
6056 - sys-firmware/seabios
6057 - sys-firmware/sgabios
6058 - sys-firmware/vgabios
6059 - )"
6060 -CDEPEND="
6061 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
6062 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
6063 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
6064 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
6065 - python? ( ${PYTHON_DEPS} )
6066 - systemtap? ( dev-util/systemtap )
6067 - xen? ( app-emulation/xen-tools:= )"
6068 -DEPEND="${CDEPEND}
6069 - dev-lang/perl
6070 - =dev-lang/python-2*
6071 - sys-apps/texinfo
6072 - virtual/pkgconfig
6073 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
6074 - gtk? ( nls? ( sys-devel/gettext ) )
6075 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
6076 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
6077 - test? (
6078 - dev-libs/glib[utils]
6079 - sys-devel/bc
6080 - )"
6081 -RDEPEND="${CDEPEND}
6082 - selinux? ( sec-policy/selinux-qemu )
6083 -"
6084 -
6085 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
6086 -
6087 -QA_PREBUILT="
6088 - usr/share/qemu/openbios-ppc
6089 - usr/share/qemu/openbios-sparc64
6090 - usr/share/qemu/openbios-sparc32
6091 - usr/share/qemu/palcode-clipper
6092 - usr/share/qemu/s390-ccw.img
6093 - usr/share/qemu/u-boot.e500
6094 -"
6095 -
6096 -QA_WX_LOAD="usr/bin/qemu-i386
6097 - usr/bin/qemu-x86_64
6098 - usr/bin/qemu-alpha
6099 - usr/bin/qemu-arm
6100 - usr/bin/qemu-cris
6101 - usr/bin/qemu-m68k
6102 - usr/bin/qemu-microblaze
6103 - usr/bin/qemu-microblazeel
6104 - usr/bin/qemu-mips
6105 - usr/bin/qemu-mipsel
6106 - usr/bin/qemu-or32
6107 - usr/bin/qemu-ppc
6108 - usr/bin/qemu-ppc64
6109 - usr/bin/qemu-ppc64abi32
6110 - usr/bin/qemu-sh4
6111 - usr/bin/qemu-sh4eb
6112 - usr/bin/qemu-sparc
6113 - usr/bin/qemu-sparc64
6114 - usr/bin/qemu-armeb
6115 - usr/bin/qemu-sparc32plus
6116 - usr/bin/qemu-s390x
6117 - usr/bin/qemu-unicore32"
6118 -
6119 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
6120 -you have the kernel module loaded before running kvm. The easiest way to
6121 -ensure that the kernel module is loaded is to load it on boot.\n
6122 -For AMD CPUs the module is called 'kvm-amd'\n
6123 -For Intel CPUs the module is called 'kvm-intel'\n
6124 -Please review /etc/conf.d/modules for how to load these\n\n
6125 -Make sure your user is in the 'kvm' group\n
6126 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
6127 -
6128 -qemu_support_kvm() {
6129 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
6130 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
6131 - use qemu_softmmu_targets_s390x; then
6132 - return 0
6133 - fi
6134 -
6135 - return 1
6136 -}
6137 -
6138 -pkg_pretend() {
6139 - if use kernel_linux && kernel_is lt 2 6 25; then
6140 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
6141 - elif use kernel_linux; then
6142 - if ! linux_config_exists; then
6143 - eerror "Unable to check your kernel for KVM support"
6144 - else
6145 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
6146 - ERROR_KVM="You must enable KVM in your kernel to continue"
6147 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
6148 - ERROR_KVM_AMD+=" your kernel configuration."
6149 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
6150 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
6151 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
6152 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
6153 - ERROR_TUN+=" virtual network device if using -net tap."
6154 - ERROR_BRIDGE="You will also need support for 802.1d"
6155 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
6156 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
6157 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
6158 - ERROR_VHOST_NET+=" support"
6159 -
6160 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
6161 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
6162 - fi
6163 -
6164 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
6165 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
6166 -
6167 - # Now do the actual checks setup above
6168 - check_extra_config
6169 - fi
6170 - fi
6171 -
6172 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
6173 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
6174 - eerror "instances are still pointing to it. Please update your"
6175 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
6176 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
6177 - die "update your virt configs to not use qemu-kvm"
6178 - fi
6179 -}
6180 -
6181 -pkg_setup() {
6182 - enewgroup kvm 78
6183 -}
6184 -
6185 -# Sanity check to make sure target lists are kept up-to-date.
6186 -check_targets() {
6187 - local var=$1 mak=$2
6188 - local detected sorted
6189 -
6190 - pushd "${S}"/default-configs >/dev/null || die
6191 -
6192 - # Force C locale until glibc is updated. #564936
6193 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
6194 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
6195 - if [[ ${sorted} != "${detected}" ]] ; then
6196 - eerror "The ebuild needs to be kept in sync."
6197 - eerror "${var}: ${sorted}"
6198 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
6199 - die "sync ${var} to the list of targets"
6200 - fi
6201 -
6202 - popd >/dev/null
6203 -}
6204 -
6205 -src_prepare() {
6206 - check_targets IUSE_SOFTMMU_TARGETS softmmu
6207 - check_targets IUSE_USER_TARGETS linux-user
6208 -
6209 - # Alter target makefiles to accept CFLAGS set via flag-o
6210 - sed -i -r \
6211 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
6212 - Makefile Makefile.target || die
6213 -
6214 - # Cheap hack to disable gettext .mo generation.
6215 - use nls || rm -f po/*.po
6216 -
6217 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
6218 - epatch "${FILESDIR}"/${P}-block-mirror-crash.patch #558396
6219 - epatch "${FILESDIR}"/${P}-CVE-2015-5225.patch #558416
6220 - epatch "${FILESDIR}"/${PN}-2.4.0-e1000-loop.patch #559656
6221 - [[ -n ${BACKPORTS} ]] && \
6222 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
6223 - epatch
6224 -
6225 - # Fix ld and objcopy being called directly
6226 - tc-export AR LD OBJCOPY
6227 -
6228 - # Verbose builds
6229 - MAKEOPTS+=" V=1"
6230 -
6231 - epatch_user
6232 -}
6233 -
6234 -##
6235 -# configures qemu based on the build directory and the build type
6236 -# we are using.
6237 -#
6238 -qemu_src_configure() {
6239 - debug-print-function ${FUNCNAME} "$@"
6240 -
6241 - local buildtype=$1
6242 - local builddir="${S}/${buildtype}-build"
6243 - local static_flag="static-${buildtype}"
6244 -
6245 - mkdir "${builddir}"
6246 -
6247 - local conf_opts=(
6248 - --prefix=/usr
6249 - --sysconfdir=/etc
6250 - --libdir=/usr/$(get_libdir)
6251 - --docdir=/usr/share/doc/${PF}/html
6252 - --disable-bsd-user
6253 - --disable-guest-agent
6254 - --disable-strip
6255 - --disable-werror
6256 - --python="${PYTHON}"
6257 - --cc="$(tc-getCC)"
6258 - --cxx="$(tc-getCXX)"
6259 - --host-cc="$(tc-getBUILD_CC)"
6260 - $(use_enable debug debug-info)
6261 - $(use_enable debug debug-tcg)
6262 - --enable-docs
6263 - $(use_enable tci tcg-interpreter)
6264 - $(use_enable xattr attr)
6265 - )
6266 -
6267 - # Disable options not used by user targets as the default configure
6268 - # options will autoprobe and try to link in a bunch of unused junk.
6269 - conf_softmmu() {
6270 - if [[ ${buildtype} == "user" ]] ; then
6271 - echo "--disable-${2:-$1}"
6272 - else
6273 - use_enable "$@"
6274 - fi
6275 - }
6276 - conf_opts+=(
6277 - $(conf_softmmu accessibility brlapi)
6278 - $(conf_softmmu aio linux-aio)
6279 - $(conf_softmmu bluetooth bluez)
6280 - $(conf_softmmu caps cap-ng)
6281 - $(conf_softmmu curl)
6282 - $(conf_softmmu fdt)
6283 - $(conf_softmmu glusterfs)
6284 - $(conf_softmmu gtk)
6285 - $(conf_softmmu infiniband rdma)
6286 - $(conf_softmmu iscsi libiscsi)
6287 - $(conf_softmmu jpeg vnc-jpeg)
6288 - $(conf_softmmu kernel_linux kvm)
6289 - $(conf_softmmu lzo)
6290 - $(conf_softmmu ncurses curses)
6291 - $(conf_softmmu nfs libnfs)
6292 - $(conf_softmmu numa)
6293 - $(conf_softmmu opengl)
6294 - $(conf_softmmu png vnc-png)
6295 - $(conf_softmmu rbd)
6296 - $(conf_softmmu sasl vnc-sasl)
6297 - $(conf_softmmu sdl)
6298 - $(conf_softmmu seccomp)
6299 - $(conf_softmmu smartcard smartcard-nss)
6300 - $(conf_softmmu snappy)
6301 - $(conf_softmmu spice)
6302 - $(conf_softmmu ssh libssh2)
6303 - $(conf_softmmu tls vnc-tls)
6304 - $(conf_softmmu usb libusb)
6305 - $(conf_softmmu usbredir usb-redir)
6306 - $(conf_softmmu uuid)
6307 - $(conf_softmmu vde)
6308 - $(conf_softmmu vhost-net)
6309 - $(conf_softmmu virtfs)
6310 - $(conf_softmmu vnc)
6311 - $(conf_softmmu vte)
6312 - $(conf_softmmu xen)
6313 - $(conf_softmmu xen xen-pci-passthrough)
6314 - $(conf_softmmu xfs xfsctl)
6315 - )
6316 -
6317 - case ${buildtype} in
6318 - user)
6319 - conf_opts+=(
6320 - --enable-linux-user
6321 - --disable-system
6322 - --disable-blobs
6323 - --disable-tools
6324 - )
6325 - ;;
6326 - softmmu)
6327 - # audio options
6328 - local audio_opts="oss"
6329 - use alsa && audio_opts="alsa,${audio_opts}"
6330 - use sdl && audio_opts="sdl,${audio_opts}"
6331 - use pulseaudio && audio_opts="pa,${audio_opts}"
6332 -
6333 - conf_opts+=(
6334 - --disable-linux-user
6335 - --enable-system
6336 - --with-system-pixman
6337 - --audio-drv-list="${audio_opts}"
6338 - )
6339 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
6340 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
6341 - ;;
6342 - tools)
6343 - conf_opts+=(
6344 - --disable-linux-user
6345 - --disable-system
6346 - --disable-blobs
6347 - )
6348 - static_flag="static"
6349 - ;;
6350 - esac
6351 -
6352 - local targets="${buildtype}_targets"
6353 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
6354 -
6355 - # Add support for SystemTAP
6356 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
6357 -
6358 - # We always want to attempt to build with PIE support as it results
6359 - # in a more secure binary. But it doesn't work with static or if
6360 - # the current GCC doesn't have PIE support.
6361 - if use ${static_flag}; then
6362 - conf_opts+=( --static --disable-pie )
6363 - else
6364 - gcc-specs-pie && conf_opts+=( --enable-pie )
6365 - fi
6366 -
6367 - echo "../configure ${conf_opts[*]}"
6368 - cd "${builddir}"
6369 - ../configure "${conf_opts[@]}" || die "configure failed"
6370 -
6371 - # FreeBSD's kernel does not support QEMU assigning/grabbing
6372 - # host USB devices yet
6373 - use kernel_FreeBSD && \
6374 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
6375 -}
6376 -
6377 -src_configure() {
6378 - local target
6379 -
6380 - python_setup
6381 -
6382 - softmmu_targets= softmmu_bins=()
6383 - user_targets= user_bins=()
6384 -
6385 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
6386 - if use "qemu_softmmu_targets_${target}"; then
6387 - softmmu_targets+=",${target}-softmmu"
6388 - softmmu_bins+=( "qemu-system-${target}" )
6389 - fi
6390 - done
6391 -
6392 - for target in ${IUSE_USER_TARGETS} ; do
6393 - if use "qemu_user_targets_${target}"; then
6394 - user_targets+=",${target}-linux-user"
6395 - user_bins+=( "qemu-${target}" )
6396 - fi
6397 - done
6398 -
6399 - softmmu_targets=${softmmu_targets#,}
6400 - user_targets=${user_targets#,}
6401 -
6402 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
6403 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
6404 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
6405 -}
6406 -
6407 -src_compile() {
6408 - if [[ -n ${user_targets} ]]; then
6409 - cd "${S}/user-build"
6410 - default
6411 - fi
6412 -
6413 - if [[ -n ${softmmu_targets} ]]; then
6414 - cd "${S}/softmmu-build"
6415 - default
6416 - fi
6417 -
6418 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
6419 - cd "${S}/tools-build"
6420 - default
6421 - fi
6422 -}
6423 -
6424 -src_test() {
6425 - if [[ -n ${softmmu_targets} ]]; then
6426 - cd "${S}/softmmu-build"
6427 - pax-mark m */qemu-system-* #515550
6428 - emake -j1 check
6429 - emake -j1 check-report.html
6430 - fi
6431 -}
6432 -
6433 -qemu_python_install() {
6434 - python_domodule "${S}/scripts/qmp/qmp.py"
6435 -
6436 - python_doscript "${S}/scripts/kvm/kvm_stat"
6437 - python_doscript "${S}/scripts/kvm/vmxcap"
6438 - python_doscript "${S}/scripts/qmp/qmp-shell"
6439 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
6440 -}
6441 -
6442 -src_install() {
6443 - if [[ -n ${user_targets} ]]; then
6444 - cd "${S}/user-build"
6445 - emake DESTDIR="${ED}" install
6446 -
6447 - # Install binfmt handler init script for user targets
6448 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
6449 - fi
6450 -
6451 - if [[ -n ${softmmu_targets} ]]; then
6452 - cd "${S}/softmmu-build"
6453 - emake DESTDIR="${ED}" install
6454 -
6455 - # This might not exist if the test failed. #512010
6456 - [[ -e check-report.html ]] && dohtml check-report.html
6457 -
6458 - if use kernel_linux; then
6459 - udev_dorules "${FILESDIR}"/65-kvm.rules
6460 - fi
6461 -
6462 - if use python; then
6463 - python_foreach_impl qemu_python_install
6464 - fi
6465 - fi
6466 -
6467 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
6468 - cd "${S}/tools-build"
6469 - emake DESTDIR="${ED}" install
6470 - fi
6471 -
6472 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
6473 - pushd "${ED}"/usr/bin >/dev/null
6474 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
6475 - popd >/dev/null
6476 -
6477 - # Install config file example for qemu-bridge-helper
6478 - insinto "/etc/qemu"
6479 - doins "${FILESDIR}/bridge.conf"
6480 -
6481 - # Remove the docdir placed qmp-commands.txt
6482 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
6483 -
6484 - cd "${S}"
6485 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
6486 - newdoc pc-bios/README README.pc-bios
6487 - dodoc docs/qmp/*.txt
6488 -
6489 - if [[ -n ${softmmu_targets} ]]; then
6490 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
6491 - rm "${ED}/usr/share/qemu/bios.bin"
6492 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
6493 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
6494 - fi
6495 -
6496 - # Remove vgabios since we're using the vgabios packaged one
6497 - rm "${ED}/usr/share/qemu/vgabios.bin"
6498 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
6499 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
6500 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
6501 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
6502 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
6503 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
6504 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
6505 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
6506 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
6507 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
6508 - fi
6509 -
6510 - # Remove sgabios since we're using the sgabios packaged one
6511 - rm "${ED}/usr/share/qemu/sgabios.bin"
6512 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
6513 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
6514 - fi
6515 -
6516 - # Remove iPXE since we're using the iPXE packaged one
6517 - rm "${ED}"/usr/share/qemu/pxe-*.rom
6518 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
6519 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
6520 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
6521 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
6522 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
6523 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
6524 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
6525 - fi
6526 - fi
6527 -
6528 - qemu_support_kvm && readme.gentoo_create_doc
6529 -}
6530 -
6531 -pkg_postinst() {
6532 - if qemu_support_kvm; then
6533 - readme.gentoo_print_elog
6534 - fi
6535 -
6536 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
6537 - udev_reload
6538 - fi
6539 -
6540 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
6541 -}
6542 -
6543 -pkg_info() {
6544 - echo "Using:"
6545 - echo " $(best_version app-emulation/spice-protocol)"
6546 - echo " $(best_version sys-firmware/ipxe)"
6547 - echo " $(best_version sys-firmware/seabios)"
6548 - if has_version 'sys-firmware/seabios[binary]'; then
6549 - echo " USE=binary"
6550 - else
6551 - echo " USE=''"
6552 - fi
6553 - echo " $(best_version sys-firmware/vgabios)"
6554 -}
6555
6556 diff --git a/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild b/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild
6557 deleted file mode 100644
6558 index 1e99f54..0000000
6559 --- a/app-emulation/qemu/qemu-2.4.0.1-r1.ebuild
6560 +++ /dev/null
6561 @@ -1,645 +0,0 @@
6562 -# Copyright 1999-2015 Gentoo Foundation
6563 -# Distributed under the terms of the GNU General Public License v2
6564 -# $Id$
6565 -
6566 -EAPI=5
6567 -
6568 -PYTHON_COMPAT=( python2_7 )
6569 -PYTHON_REQ_USE="ncurses,readline"
6570 -
6571 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
6572 - user udev fcaps readme.gentoo pax-utils
6573 -
6574 -BACKPORTS=
6575 -
6576 -if [[ ${PV} = *9999* ]]; then
6577 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
6578 - inherit git-2
6579 - SRC_URI=""
6580 -else
6581 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
6582 - ${BACKPORTS:+
6583 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
6584 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
6585 -fi
6586 -
6587 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
6588 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
6589 -
6590 -LICENSE="GPL-2 LGPL-2 BSD-2"
6591 -SLOT="0"
6592 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
6593 -gtk gtk2 infiniband iscsi +jpeg \
6594 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
6595 -+png pulseaudio python \
6596 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
6597 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
6598 -virtfs +vnc vte xattr xen xfs"
6599 -
6600 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
6601 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
6602 -x86_64"
6603 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
6604 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
6605 -
6606 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
6607 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
6608 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
6609 -
6610 -# Allow no targets to be built so that people can get a tools-only build.
6611 -# Block USE flag configurations known to not work.
6612 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
6613 - gtk2? ( gtk )
6614 - qemu_softmmu_targets_arm? ( fdt )
6615 - qemu_softmmu_targets_microblaze? ( fdt )
6616 - qemu_softmmu_targets_ppc? ( fdt )
6617 - qemu_softmmu_targets_ppc64? ( fdt )
6618 - sdl2? ( sdl )
6619 - static? ( static-softmmu static-user )
6620 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
6621 - virtfs? ( xattr )
6622 - vte? ( gtk )"
6623 -
6624 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
6625 -#
6626 -# The attr lib isn't always linked in (although the USE flag is always
6627 -# respected). This is because qemu supports using the C library's API
6628 -# when available rather than always using the extranl library.
6629 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
6630 - sys-libs/zlib[static-libs(+)]
6631 - xattr? ( sys-apps/attr[static-libs(+)] )"
6632 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
6633 - >=x11-libs/pixman-0.28.0[static-libs(+)]
6634 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
6635 - aio? ( dev-libs/libaio[static-libs(+)] )
6636 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
6637 - bluetooth? ( net-wireless/bluez )
6638 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
6639 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
6640 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
6641 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
6642 - gtk? (
6643 - gtk2? (
6644 - x11-libs/gtk+:2
6645 - vte? ( x11-libs/vte:0 )
6646 - )
6647 - !gtk2? (
6648 - x11-libs/gtk+:3
6649 - vte? ( x11-libs/vte:2.90 )
6650 - )
6651 - )
6652 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
6653 - iscsi? ( net-libs/libiscsi )
6654 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
6655 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
6656 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
6657 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
6658 - numa? ( sys-process/numactl[static-libs(+)] )
6659 - opengl? (
6660 - virtual/opengl
6661 - media-libs/libepoxy[static-libs(+)]
6662 - media-libs/mesa[static-libs(+)]
6663 - media-libs/mesa[egl,gles2]
6664 - )
6665 - png? ( media-libs/libpng:0=[static-libs(+)] )
6666 - pulseaudio? ( media-sound/pulseaudio )
6667 - rbd? ( sys-cluster/ceph[static-libs(+)] )
6668 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
6669 - sdl? (
6670 - !sdl2? (
6671 - media-libs/libsdl[X]
6672 - >=media-libs/libsdl-1.2.11[static-libs(+)]
6673 - )
6674 - sdl2? (
6675 - media-libs/libsdl2[X]
6676 - media-libs/libsdl2[static-libs(+)]
6677 - )
6678 - )
6679 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
6680 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
6681 - snappy? ( app-arch/snappy[static-libs(+)] )
6682 - spice? (
6683 - >=app-emulation/spice-protocol-0.12.3
6684 - >=app-emulation/spice-0.12.0[static-libs(+)]
6685 - )
6686 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
6687 - tls? ( net-libs/gnutls[static-libs(+)] )
6688 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
6689 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
6690 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
6691 - vde? ( net-misc/vde[static-libs(+)] )
6692 - virtfs? ( sys-libs/libcap )
6693 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
6694 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
6695 -X86_FIRMWARE_DEPEND="
6696 - >=sys-firmware/ipxe-1.0.0_p20130624
6697 - pin-upstream-blobs? (
6698 - ~sys-firmware/seabios-1.8.2
6699 - ~sys-firmware/sgabios-0.1_pre8
6700 - ~sys-firmware/vgabios-0.7a
6701 - )
6702 - !pin-upstream-blobs? (
6703 - sys-firmware/seabios
6704 - sys-firmware/sgabios
6705 - sys-firmware/vgabios
6706 - )"
6707 -CDEPEND="
6708 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
6709 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
6710 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
6711 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
6712 - python? ( ${PYTHON_DEPS} )
6713 - systemtap? ( dev-util/systemtap )
6714 - xen? ( app-emulation/xen-tools:= )"
6715 -DEPEND="${CDEPEND}
6716 - dev-lang/perl
6717 - =dev-lang/python-2*
6718 - sys-apps/texinfo
6719 - virtual/pkgconfig
6720 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
6721 - gtk? ( nls? ( sys-devel/gettext ) )
6722 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
6723 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
6724 - test? (
6725 - dev-libs/glib[utils]
6726 - sys-devel/bc
6727 - )"
6728 -RDEPEND="${CDEPEND}
6729 - selinux? ( sec-policy/selinux-qemu )
6730 -"
6731 -
6732 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
6733 -
6734 -QA_PREBUILT="
6735 - usr/share/qemu/openbios-ppc
6736 - usr/share/qemu/openbios-sparc64
6737 - usr/share/qemu/openbios-sparc32
6738 - usr/share/qemu/palcode-clipper
6739 - usr/share/qemu/s390-ccw.img
6740 - usr/share/qemu/u-boot.e500
6741 -"
6742 -
6743 -QA_WX_LOAD="usr/bin/qemu-i386
6744 - usr/bin/qemu-x86_64
6745 - usr/bin/qemu-alpha
6746 - usr/bin/qemu-arm
6747 - usr/bin/qemu-cris
6748 - usr/bin/qemu-m68k
6749 - usr/bin/qemu-microblaze
6750 - usr/bin/qemu-microblazeel
6751 - usr/bin/qemu-mips
6752 - usr/bin/qemu-mipsel
6753 - usr/bin/qemu-or32
6754 - usr/bin/qemu-ppc
6755 - usr/bin/qemu-ppc64
6756 - usr/bin/qemu-ppc64abi32
6757 - usr/bin/qemu-sh4
6758 - usr/bin/qemu-sh4eb
6759 - usr/bin/qemu-sparc
6760 - usr/bin/qemu-sparc64
6761 - usr/bin/qemu-armeb
6762 - usr/bin/qemu-sparc32plus
6763 - usr/bin/qemu-s390x
6764 - usr/bin/qemu-unicore32"
6765 -
6766 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
6767 -you have the kernel module loaded before running kvm. The easiest way to
6768 -ensure that the kernel module is loaded is to load it on boot.\n
6769 -For AMD CPUs the module is called 'kvm-amd'\n
6770 -For Intel CPUs the module is called 'kvm-intel'\n
6771 -Please review /etc/conf.d/modules for how to load these\n\n
6772 -Make sure your user is in the 'kvm' group\n
6773 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
6774 -
6775 -qemu_support_kvm() {
6776 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
6777 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
6778 - use qemu_softmmu_targets_s390x; then
6779 - return 0
6780 - fi
6781 -
6782 - return 1
6783 -}
6784 -
6785 -pkg_pretend() {
6786 - if use kernel_linux && kernel_is lt 2 6 25; then
6787 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
6788 - elif use kernel_linux; then
6789 - if ! linux_config_exists; then
6790 - eerror "Unable to check your kernel for KVM support"
6791 - else
6792 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
6793 - ERROR_KVM="You must enable KVM in your kernel to continue"
6794 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
6795 - ERROR_KVM_AMD+=" your kernel configuration."
6796 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
6797 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
6798 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
6799 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
6800 - ERROR_TUN+=" virtual network device if using -net tap."
6801 - ERROR_BRIDGE="You will also need support for 802.1d"
6802 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
6803 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
6804 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
6805 - ERROR_VHOST_NET+=" support"
6806 -
6807 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
6808 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
6809 - fi
6810 -
6811 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
6812 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
6813 -
6814 - # Now do the actual checks setup above
6815 - check_extra_config
6816 - fi
6817 - fi
6818 -
6819 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
6820 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
6821 - eerror "instances are still pointing to it. Please update your"
6822 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
6823 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
6824 - die "update your virt configs to not use qemu-kvm"
6825 - fi
6826 -}
6827 -
6828 -pkg_setup() {
6829 - enewgroup kvm 78
6830 -}
6831 -
6832 -# Sanity check to make sure target lists are kept up-to-date.
6833 -check_targets() {
6834 - local var=$1 mak=$2
6835 - local detected sorted
6836 -
6837 - pushd "${S}"/default-configs >/dev/null || die
6838 -
6839 - # Force C locale until glibc is updated. #564936
6840 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
6841 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
6842 - if [[ ${sorted} != "${detected}" ]] ; then
6843 - eerror "The ebuild needs to be kept in sync."
6844 - eerror "${var}: ${sorted}"
6845 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
6846 - die "sync ${var} to the list of targets"
6847 - fi
6848 -
6849 - popd >/dev/null
6850 -}
6851 -
6852 -src_prepare() {
6853 - check_targets IUSE_SOFTMMU_TARGETS softmmu
6854 - check_targets IUSE_USER_TARGETS linux-user
6855 -
6856 - # Alter target makefiles to accept CFLAGS set via flag-o
6857 - sed -i -r \
6858 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
6859 - Makefile Makefile.target || die
6860 -
6861 - # Cheap hack to disable gettext .mo generation.
6862 - use nls || rm -f po/*.po
6863 -
6864 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
6865 - epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
6866 - epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
6867 - epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
6868 - [[ -n ${BACKPORTS} ]] && \
6869 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
6870 - epatch
6871 -
6872 - # MIPS specific fixes. Bug #563162
6873 - for x in "${FILESDIR}"/${PN}-2.4-mips-*; do
6874 - epatch "${x}"
6875 - done
6876 -
6877 - # Fix ld and objcopy being called directly
6878 - tc-export AR LD OBJCOPY
6879 -
6880 - # Verbose builds
6881 - MAKEOPTS+=" V=1"
6882 -
6883 - epatch_user
6884 -}
6885 -
6886 -##
6887 -# configures qemu based on the build directory and the build type
6888 -# we are using.
6889 -#
6890 -qemu_src_configure() {
6891 - debug-print-function ${FUNCNAME} "$@"
6892 -
6893 - local buildtype=$1
6894 - local builddir="${S}/${buildtype}-build"
6895 - local static_flag="static-${buildtype}"
6896 -
6897 - mkdir "${builddir}"
6898 -
6899 - local conf_opts=(
6900 - --prefix=/usr
6901 - --sysconfdir=/etc
6902 - --libdir=/usr/$(get_libdir)
6903 - --docdir=/usr/share/doc/${PF}/html
6904 - --disable-bsd-user
6905 - --disable-guest-agent
6906 - --disable-strip
6907 - --disable-werror
6908 - --python="${PYTHON}"
6909 - --cc="$(tc-getCC)"
6910 - --cxx="$(tc-getCXX)"
6911 - --host-cc="$(tc-getBUILD_CC)"
6912 - $(use_enable debug debug-info)
6913 - $(use_enable debug debug-tcg)
6914 - --enable-docs
6915 - $(use_enable tci tcg-interpreter)
6916 - $(use_enable xattr attr)
6917 - )
6918 -
6919 - # Disable options not used by user targets as the default configure
6920 - # options will autoprobe and try to link in a bunch of unused junk.
6921 - conf_softmmu() {
6922 - if [[ ${buildtype} == "user" ]] ; then
6923 - echo "--disable-${2:-$1}"
6924 - else
6925 - use_enable "$@"
6926 - fi
6927 - }
6928 - conf_opts+=(
6929 - $(conf_softmmu accessibility brlapi)
6930 - $(conf_softmmu aio linux-aio)
6931 - $(conf_softmmu bluetooth bluez)
6932 - $(conf_softmmu caps cap-ng)
6933 - $(conf_softmmu curl)
6934 - $(conf_softmmu fdt)
6935 - $(conf_softmmu glusterfs)
6936 - $(conf_softmmu gtk)
6937 - $(conf_softmmu infiniband rdma)
6938 - $(conf_softmmu iscsi libiscsi)
6939 - $(conf_softmmu jpeg vnc-jpeg)
6940 - $(conf_softmmu kernel_linux kvm)
6941 - $(conf_softmmu lzo)
6942 - $(conf_softmmu ncurses curses)
6943 - $(conf_softmmu nfs libnfs)
6944 - $(conf_softmmu numa)
6945 - $(conf_softmmu opengl)
6946 - $(conf_softmmu png vnc-png)
6947 - $(conf_softmmu rbd)
6948 - $(conf_softmmu sasl vnc-sasl)
6949 - $(conf_softmmu sdl)
6950 - $(conf_softmmu seccomp)
6951 - $(conf_softmmu smartcard smartcard-nss)
6952 - $(conf_softmmu snappy)
6953 - $(conf_softmmu spice)
6954 - $(conf_softmmu ssh libssh2)
6955 - $(conf_softmmu tls vnc-tls)
6956 - $(conf_softmmu usb libusb)
6957 - $(conf_softmmu usbredir usb-redir)
6958 - $(conf_softmmu uuid)
6959 - $(conf_softmmu vde)
6960 - $(conf_softmmu vhost-net)
6961 - $(conf_softmmu virtfs)
6962 - $(conf_softmmu vnc)
6963 - $(conf_softmmu vte)
6964 - $(conf_softmmu xen)
6965 - $(conf_softmmu xen xen-pci-passthrough)
6966 - $(conf_softmmu xfs xfsctl)
6967 - )
6968 -
6969 - case ${buildtype} in
6970 - user)
6971 - conf_opts+=(
6972 - --enable-linux-user
6973 - --disable-system
6974 - --disable-blobs
6975 - --disable-tools
6976 - )
6977 - ;;
6978 - softmmu)
6979 - # audio options
6980 - local audio_opts="oss"
6981 - use alsa && audio_opts="alsa,${audio_opts}"
6982 - use sdl && audio_opts="sdl,${audio_opts}"
6983 - use pulseaudio && audio_opts="pa,${audio_opts}"
6984 -
6985 - conf_opts+=(
6986 - --disable-linux-user
6987 - --enable-system
6988 - --with-system-pixman
6989 - --audio-drv-list="${audio_opts}"
6990 - )
6991 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
6992 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
6993 - ;;
6994 - tools)
6995 - conf_opts+=(
6996 - --disable-linux-user
6997 - --disable-system
6998 - --disable-blobs
6999 - )
7000 - static_flag="static"
7001 - ;;
7002 - esac
7003 -
7004 - local targets="${buildtype}_targets"
7005 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
7006 -
7007 - # Add support for SystemTAP
7008 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
7009 -
7010 - # We always want to attempt to build with PIE support as it results
7011 - # in a more secure binary. But it doesn't work with static or if
7012 - # the current GCC doesn't have PIE support.
7013 - if use ${static_flag}; then
7014 - conf_opts+=( --static --disable-pie )
7015 - else
7016 - gcc-specs-pie && conf_opts+=( --enable-pie )
7017 - fi
7018 -
7019 - echo "../configure ${conf_opts[*]}"
7020 - cd "${builddir}"
7021 - ../configure "${conf_opts[@]}" || die "configure failed"
7022 -
7023 - # FreeBSD's kernel does not support QEMU assigning/grabbing
7024 - # host USB devices yet
7025 - use kernel_FreeBSD && \
7026 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
7027 -}
7028 -
7029 -src_configure() {
7030 - local target
7031 -
7032 - python_setup
7033 -
7034 - softmmu_targets= softmmu_bins=()
7035 - user_targets= user_bins=()
7036 -
7037 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
7038 - if use "qemu_softmmu_targets_${target}"; then
7039 - softmmu_targets+=",${target}-softmmu"
7040 - softmmu_bins+=( "qemu-system-${target}" )
7041 - fi
7042 - done
7043 -
7044 - for target in ${IUSE_USER_TARGETS} ; do
7045 - if use "qemu_user_targets_${target}"; then
7046 - user_targets+=",${target}-linux-user"
7047 - user_bins+=( "qemu-${target}" )
7048 - fi
7049 - done
7050 -
7051 - softmmu_targets=${softmmu_targets#,}
7052 - user_targets=${user_targets#,}
7053 -
7054 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
7055 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
7056 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
7057 -}
7058 -
7059 -src_compile() {
7060 - if [[ -n ${user_targets} ]]; then
7061 - cd "${S}/user-build"
7062 - default
7063 - fi
7064 -
7065 - if [[ -n ${softmmu_targets} ]]; then
7066 - cd "${S}/softmmu-build"
7067 - default
7068 - fi
7069 -
7070 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
7071 - cd "${S}/tools-build"
7072 - default
7073 - fi
7074 -}
7075 -
7076 -src_test() {
7077 - if [[ -n ${softmmu_targets} ]]; then
7078 - cd "${S}/softmmu-build"
7079 - pax-mark m */qemu-system-* #515550
7080 - emake -j1 check
7081 - emake -j1 check-report.html
7082 - fi
7083 -}
7084 -
7085 -qemu_python_install() {
7086 - python_domodule "${S}/scripts/qmp/qmp.py"
7087 -
7088 - python_doscript "${S}/scripts/kvm/kvm_stat"
7089 - python_doscript "${S}/scripts/kvm/vmxcap"
7090 - python_doscript "${S}/scripts/qmp/qmp-shell"
7091 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
7092 -}
7093 -
7094 -src_install() {
7095 - if [[ -n ${user_targets} ]]; then
7096 - cd "${S}/user-build"
7097 - emake DESTDIR="${ED}" install
7098 -
7099 - # Install binfmt handler init script for user targets
7100 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
7101 - fi
7102 -
7103 - if [[ -n ${softmmu_targets} ]]; then
7104 - cd "${S}/softmmu-build"
7105 - emake DESTDIR="${ED}" install
7106 -
7107 - # This might not exist if the test failed. #512010
7108 - [[ -e check-report.html ]] && dohtml check-report.html
7109 -
7110 - if use kernel_linux; then
7111 - udev_dorules "${FILESDIR}"/65-kvm.rules
7112 - fi
7113 -
7114 - if use python; then
7115 - python_foreach_impl qemu_python_install
7116 - fi
7117 - fi
7118 -
7119 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
7120 - cd "${S}/tools-build"
7121 - emake DESTDIR="${ED}" install
7122 - fi
7123 -
7124 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
7125 - pushd "${ED}"/usr/bin >/dev/null
7126 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
7127 - popd >/dev/null
7128 -
7129 - # Install config file example for qemu-bridge-helper
7130 - insinto "/etc/qemu"
7131 - doins "${FILESDIR}/bridge.conf"
7132 -
7133 - # Remove the docdir placed qmp-commands.txt
7134 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
7135 -
7136 - cd "${S}"
7137 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
7138 - newdoc pc-bios/README README.pc-bios
7139 - dodoc docs/qmp/*.txt
7140 -
7141 - if [[ -n ${softmmu_targets} ]]; then
7142 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
7143 - rm "${ED}/usr/share/qemu/bios.bin"
7144 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7145 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
7146 - fi
7147 -
7148 - # Remove vgabios since we're using the vgabios packaged one
7149 - rm "${ED}/usr/share/qemu/vgabios.bin"
7150 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
7151 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
7152 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
7153 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
7154 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7155 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
7156 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
7157 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
7158 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
7159 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
7160 - fi
7161 -
7162 - # Remove sgabios since we're using the sgabios packaged one
7163 - rm "${ED}/usr/share/qemu/sgabios.bin"
7164 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7165 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
7166 - fi
7167 -
7168 - # Remove iPXE since we're using the iPXE packaged one
7169 - rm "${ED}"/usr/share/qemu/pxe-*.rom
7170 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7171 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
7172 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
7173 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
7174 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
7175 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
7176 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
7177 - fi
7178 - fi
7179 -
7180 - qemu_support_kvm && readme.gentoo_create_doc
7181 -}
7182 -
7183 -pkg_postinst() {
7184 - if qemu_support_kvm; then
7185 - readme.gentoo_print_elog
7186 - fi
7187 -
7188 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
7189 - udev_reload
7190 - fi
7191 -
7192 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
7193 -}
7194 -
7195 -pkg_info() {
7196 - echo "Using:"
7197 - echo " $(best_version app-emulation/spice-protocol)"
7198 - echo " $(best_version sys-firmware/ipxe)"
7199 - echo " $(best_version sys-firmware/seabios)"
7200 - if has_version 'sys-firmware/seabios[binary]'; then
7201 - echo " USE=binary"
7202 - else
7203 - echo " USE=''"
7204 - fi
7205 - echo " $(best_version sys-firmware/vgabios)"
7206 -}
7207
7208 diff --git a/app-emulation/qemu/qemu-2.4.0.1-r2.ebuild b/app-emulation/qemu/qemu-2.4.0.1-r2.ebuild
7209 deleted file mode 100644
7210 index 1e99f54..0000000
7211 --- a/app-emulation/qemu/qemu-2.4.0.1-r2.ebuild
7212 +++ /dev/null
7213 @@ -1,645 +0,0 @@
7214 -# Copyright 1999-2015 Gentoo Foundation
7215 -# Distributed under the terms of the GNU General Public License v2
7216 -# $Id$
7217 -
7218 -EAPI=5
7219 -
7220 -PYTHON_COMPAT=( python2_7 )
7221 -PYTHON_REQ_USE="ncurses,readline"
7222 -
7223 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
7224 - user udev fcaps readme.gentoo pax-utils
7225 -
7226 -BACKPORTS=
7227 -
7228 -if [[ ${PV} = *9999* ]]; then
7229 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
7230 - inherit git-2
7231 - SRC_URI=""
7232 -else
7233 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
7234 - ${BACKPORTS:+
7235 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
7236 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
7237 -fi
7238 -
7239 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
7240 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
7241 -
7242 -LICENSE="GPL-2 LGPL-2 BSD-2"
7243 -SLOT="0"
7244 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
7245 -gtk gtk2 infiniband iscsi +jpeg \
7246 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
7247 -+png pulseaudio python \
7248 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
7249 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
7250 -virtfs +vnc vte xattr xen xfs"
7251 -
7252 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
7253 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
7254 -x86_64"
7255 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
7256 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
7257 -
7258 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
7259 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
7260 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
7261 -
7262 -# Allow no targets to be built so that people can get a tools-only build.
7263 -# Block USE flag configurations known to not work.
7264 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
7265 - gtk2? ( gtk )
7266 - qemu_softmmu_targets_arm? ( fdt )
7267 - qemu_softmmu_targets_microblaze? ( fdt )
7268 - qemu_softmmu_targets_ppc? ( fdt )
7269 - qemu_softmmu_targets_ppc64? ( fdt )
7270 - sdl2? ( sdl )
7271 - static? ( static-softmmu static-user )
7272 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
7273 - virtfs? ( xattr )
7274 - vte? ( gtk )"
7275 -
7276 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
7277 -#
7278 -# The attr lib isn't always linked in (although the USE flag is always
7279 -# respected). This is because qemu supports using the C library's API
7280 -# when available rather than always using the extranl library.
7281 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
7282 - sys-libs/zlib[static-libs(+)]
7283 - xattr? ( sys-apps/attr[static-libs(+)] )"
7284 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
7285 - >=x11-libs/pixman-0.28.0[static-libs(+)]
7286 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
7287 - aio? ( dev-libs/libaio[static-libs(+)] )
7288 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
7289 - bluetooth? ( net-wireless/bluez )
7290 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
7291 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
7292 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
7293 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
7294 - gtk? (
7295 - gtk2? (
7296 - x11-libs/gtk+:2
7297 - vte? ( x11-libs/vte:0 )
7298 - )
7299 - !gtk2? (
7300 - x11-libs/gtk+:3
7301 - vte? ( x11-libs/vte:2.90 )
7302 - )
7303 - )
7304 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
7305 - iscsi? ( net-libs/libiscsi )
7306 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
7307 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
7308 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
7309 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
7310 - numa? ( sys-process/numactl[static-libs(+)] )
7311 - opengl? (
7312 - virtual/opengl
7313 - media-libs/libepoxy[static-libs(+)]
7314 - media-libs/mesa[static-libs(+)]
7315 - media-libs/mesa[egl,gles2]
7316 - )
7317 - png? ( media-libs/libpng:0=[static-libs(+)] )
7318 - pulseaudio? ( media-sound/pulseaudio )
7319 - rbd? ( sys-cluster/ceph[static-libs(+)] )
7320 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
7321 - sdl? (
7322 - !sdl2? (
7323 - media-libs/libsdl[X]
7324 - >=media-libs/libsdl-1.2.11[static-libs(+)]
7325 - )
7326 - sdl2? (
7327 - media-libs/libsdl2[X]
7328 - media-libs/libsdl2[static-libs(+)]
7329 - )
7330 - )
7331 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
7332 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
7333 - snappy? ( app-arch/snappy[static-libs(+)] )
7334 - spice? (
7335 - >=app-emulation/spice-protocol-0.12.3
7336 - >=app-emulation/spice-0.12.0[static-libs(+)]
7337 - )
7338 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
7339 - tls? ( net-libs/gnutls[static-libs(+)] )
7340 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
7341 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
7342 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
7343 - vde? ( net-misc/vde[static-libs(+)] )
7344 - virtfs? ( sys-libs/libcap )
7345 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
7346 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
7347 -X86_FIRMWARE_DEPEND="
7348 - >=sys-firmware/ipxe-1.0.0_p20130624
7349 - pin-upstream-blobs? (
7350 - ~sys-firmware/seabios-1.8.2
7351 - ~sys-firmware/sgabios-0.1_pre8
7352 - ~sys-firmware/vgabios-0.7a
7353 - )
7354 - !pin-upstream-blobs? (
7355 - sys-firmware/seabios
7356 - sys-firmware/sgabios
7357 - sys-firmware/vgabios
7358 - )"
7359 -CDEPEND="
7360 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
7361 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
7362 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
7363 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
7364 - python? ( ${PYTHON_DEPS} )
7365 - systemtap? ( dev-util/systemtap )
7366 - xen? ( app-emulation/xen-tools:= )"
7367 -DEPEND="${CDEPEND}
7368 - dev-lang/perl
7369 - =dev-lang/python-2*
7370 - sys-apps/texinfo
7371 - virtual/pkgconfig
7372 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
7373 - gtk? ( nls? ( sys-devel/gettext ) )
7374 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
7375 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
7376 - test? (
7377 - dev-libs/glib[utils]
7378 - sys-devel/bc
7379 - )"
7380 -RDEPEND="${CDEPEND}
7381 - selinux? ( sec-policy/selinux-qemu )
7382 -"
7383 -
7384 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
7385 -
7386 -QA_PREBUILT="
7387 - usr/share/qemu/openbios-ppc
7388 - usr/share/qemu/openbios-sparc64
7389 - usr/share/qemu/openbios-sparc32
7390 - usr/share/qemu/palcode-clipper
7391 - usr/share/qemu/s390-ccw.img
7392 - usr/share/qemu/u-boot.e500
7393 -"
7394 -
7395 -QA_WX_LOAD="usr/bin/qemu-i386
7396 - usr/bin/qemu-x86_64
7397 - usr/bin/qemu-alpha
7398 - usr/bin/qemu-arm
7399 - usr/bin/qemu-cris
7400 - usr/bin/qemu-m68k
7401 - usr/bin/qemu-microblaze
7402 - usr/bin/qemu-microblazeel
7403 - usr/bin/qemu-mips
7404 - usr/bin/qemu-mipsel
7405 - usr/bin/qemu-or32
7406 - usr/bin/qemu-ppc
7407 - usr/bin/qemu-ppc64
7408 - usr/bin/qemu-ppc64abi32
7409 - usr/bin/qemu-sh4
7410 - usr/bin/qemu-sh4eb
7411 - usr/bin/qemu-sparc
7412 - usr/bin/qemu-sparc64
7413 - usr/bin/qemu-armeb
7414 - usr/bin/qemu-sparc32plus
7415 - usr/bin/qemu-s390x
7416 - usr/bin/qemu-unicore32"
7417 -
7418 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
7419 -you have the kernel module loaded before running kvm. The easiest way to
7420 -ensure that the kernel module is loaded is to load it on boot.\n
7421 -For AMD CPUs the module is called 'kvm-amd'\n
7422 -For Intel CPUs the module is called 'kvm-intel'\n
7423 -Please review /etc/conf.d/modules for how to load these\n\n
7424 -Make sure your user is in the 'kvm' group\n
7425 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
7426 -
7427 -qemu_support_kvm() {
7428 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
7429 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
7430 - use qemu_softmmu_targets_s390x; then
7431 - return 0
7432 - fi
7433 -
7434 - return 1
7435 -}
7436 -
7437 -pkg_pretend() {
7438 - if use kernel_linux && kernel_is lt 2 6 25; then
7439 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
7440 - elif use kernel_linux; then
7441 - if ! linux_config_exists; then
7442 - eerror "Unable to check your kernel for KVM support"
7443 - else
7444 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
7445 - ERROR_KVM="You must enable KVM in your kernel to continue"
7446 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
7447 - ERROR_KVM_AMD+=" your kernel configuration."
7448 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
7449 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
7450 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
7451 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
7452 - ERROR_TUN+=" virtual network device if using -net tap."
7453 - ERROR_BRIDGE="You will also need support for 802.1d"
7454 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
7455 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
7456 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
7457 - ERROR_VHOST_NET+=" support"
7458 -
7459 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
7460 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
7461 - fi
7462 -
7463 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
7464 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
7465 -
7466 - # Now do the actual checks setup above
7467 - check_extra_config
7468 - fi
7469 - fi
7470 -
7471 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
7472 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
7473 - eerror "instances are still pointing to it. Please update your"
7474 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
7475 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
7476 - die "update your virt configs to not use qemu-kvm"
7477 - fi
7478 -}
7479 -
7480 -pkg_setup() {
7481 - enewgroup kvm 78
7482 -}
7483 -
7484 -# Sanity check to make sure target lists are kept up-to-date.
7485 -check_targets() {
7486 - local var=$1 mak=$2
7487 - local detected sorted
7488 -
7489 - pushd "${S}"/default-configs >/dev/null || die
7490 -
7491 - # Force C locale until glibc is updated. #564936
7492 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
7493 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
7494 - if [[ ${sorted} != "${detected}" ]] ; then
7495 - eerror "The ebuild needs to be kept in sync."
7496 - eerror "${var}: ${sorted}"
7497 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
7498 - die "sync ${var} to the list of targets"
7499 - fi
7500 -
7501 - popd >/dev/null
7502 -}
7503 -
7504 -src_prepare() {
7505 - check_targets IUSE_SOFTMMU_TARGETS softmmu
7506 - check_targets IUSE_USER_TARGETS linux-user
7507 -
7508 - # Alter target makefiles to accept CFLAGS set via flag-o
7509 - sed -i -r \
7510 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
7511 - Makefile Makefile.target || die
7512 -
7513 - # Cheap hack to disable gettext .mo generation.
7514 - use nls || rm -f po/*.po
7515 -
7516 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
7517 - epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
7518 - epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
7519 - epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
7520 - [[ -n ${BACKPORTS} ]] && \
7521 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
7522 - epatch
7523 -
7524 - # MIPS specific fixes. Bug #563162
7525 - for x in "${FILESDIR}"/${PN}-2.4-mips-*; do
7526 - epatch "${x}"
7527 - done
7528 -
7529 - # Fix ld and objcopy being called directly
7530 - tc-export AR LD OBJCOPY
7531 -
7532 - # Verbose builds
7533 - MAKEOPTS+=" V=1"
7534 -
7535 - epatch_user
7536 -}
7537 -
7538 -##
7539 -# configures qemu based on the build directory and the build type
7540 -# we are using.
7541 -#
7542 -qemu_src_configure() {
7543 - debug-print-function ${FUNCNAME} "$@"
7544 -
7545 - local buildtype=$1
7546 - local builddir="${S}/${buildtype}-build"
7547 - local static_flag="static-${buildtype}"
7548 -
7549 - mkdir "${builddir}"
7550 -
7551 - local conf_opts=(
7552 - --prefix=/usr
7553 - --sysconfdir=/etc
7554 - --libdir=/usr/$(get_libdir)
7555 - --docdir=/usr/share/doc/${PF}/html
7556 - --disable-bsd-user
7557 - --disable-guest-agent
7558 - --disable-strip
7559 - --disable-werror
7560 - --python="${PYTHON}"
7561 - --cc="$(tc-getCC)"
7562 - --cxx="$(tc-getCXX)"
7563 - --host-cc="$(tc-getBUILD_CC)"
7564 - $(use_enable debug debug-info)
7565 - $(use_enable debug debug-tcg)
7566 - --enable-docs
7567 - $(use_enable tci tcg-interpreter)
7568 - $(use_enable xattr attr)
7569 - )
7570 -
7571 - # Disable options not used by user targets as the default configure
7572 - # options will autoprobe and try to link in a bunch of unused junk.
7573 - conf_softmmu() {
7574 - if [[ ${buildtype} == "user" ]] ; then
7575 - echo "--disable-${2:-$1}"
7576 - else
7577 - use_enable "$@"
7578 - fi
7579 - }
7580 - conf_opts+=(
7581 - $(conf_softmmu accessibility brlapi)
7582 - $(conf_softmmu aio linux-aio)
7583 - $(conf_softmmu bluetooth bluez)
7584 - $(conf_softmmu caps cap-ng)
7585 - $(conf_softmmu curl)
7586 - $(conf_softmmu fdt)
7587 - $(conf_softmmu glusterfs)
7588 - $(conf_softmmu gtk)
7589 - $(conf_softmmu infiniband rdma)
7590 - $(conf_softmmu iscsi libiscsi)
7591 - $(conf_softmmu jpeg vnc-jpeg)
7592 - $(conf_softmmu kernel_linux kvm)
7593 - $(conf_softmmu lzo)
7594 - $(conf_softmmu ncurses curses)
7595 - $(conf_softmmu nfs libnfs)
7596 - $(conf_softmmu numa)
7597 - $(conf_softmmu opengl)
7598 - $(conf_softmmu png vnc-png)
7599 - $(conf_softmmu rbd)
7600 - $(conf_softmmu sasl vnc-sasl)
7601 - $(conf_softmmu sdl)
7602 - $(conf_softmmu seccomp)
7603 - $(conf_softmmu smartcard smartcard-nss)
7604 - $(conf_softmmu snappy)
7605 - $(conf_softmmu spice)
7606 - $(conf_softmmu ssh libssh2)
7607 - $(conf_softmmu tls vnc-tls)
7608 - $(conf_softmmu usb libusb)
7609 - $(conf_softmmu usbredir usb-redir)
7610 - $(conf_softmmu uuid)
7611 - $(conf_softmmu vde)
7612 - $(conf_softmmu vhost-net)
7613 - $(conf_softmmu virtfs)
7614 - $(conf_softmmu vnc)
7615 - $(conf_softmmu vte)
7616 - $(conf_softmmu xen)
7617 - $(conf_softmmu xen xen-pci-passthrough)
7618 - $(conf_softmmu xfs xfsctl)
7619 - )
7620 -
7621 - case ${buildtype} in
7622 - user)
7623 - conf_opts+=(
7624 - --enable-linux-user
7625 - --disable-system
7626 - --disable-blobs
7627 - --disable-tools
7628 - )
7629 - ;;
7630 - softmmu)
7631 - # audio options
7632 - local audio_opts="oss"
7633 - use alsa && audio_opts="alsa,${audio_opts}"
7634 - use sdl && audio_opts="sdl,${audio_opts}"
7635 - use pulseaudio && audio_opts="pa,${audio_opts}"
7636 -
7637 - conf_opts+=(
7638 - --disable-linux-user
7639 - --enable-system
7640 - --with-system-pixman
7641 - --audio-drv-list="${audio_opts}"
7642 - )
7643 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
7644 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
7645 - ;;
7646 - tools)
7647 - conf_opts+=(
7648 - --disable-linux-user
7649 - --disable-system
7650 - --disable-blobs
7651 - )
7652 - static_flag="static"
7653 - ;;
7654 - esac
7655 -
7656 - local targets="${buildtype}_targets"
7657 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
7658 -
7659 - # Add support for SystemTAP
7660 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
7661 -
7662 - # We always want to attempt to build with PIE support as it results
7663 - # in a more secure binary. But it doesn't work with static or if
7664 - # the current GCC doesn't have PIE support.
7665 - if use ${static_flag}; then
7666 - conf_opts+=( --static --disable-pie )
7667 - else
7668 - gcc-specs-pie && conf_opts+=( --enable-pie )
7669 - fi
7670 -
7671 - echo "../configure ${conf_opts[*]}"
7672 - cd "${builddir}"
7673 - ../configure "${conf_opts[@]}" || die "configure failed"
7674 -
7675 - # FreeBSD's kernel does not support QEMU assigning/grabbing
7676 - # host USB devices yet
7677 - use kernel_FreeBSD && \
7678 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
7679 -}
7680 -
7681 -src_configure() {
7682 - local target
7683 -
7684 - python_setup
7685 -
7686 - softmmu_targets= softmmu_bins=()
7687 - user_targets= user_bins=()
7688 -
7689 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
7690 - if use "qemu_softmmu_targets_${target}"; then
7691 - softmmu_targets+=",${target}-softmmu"
7692 - softmmu_bins+=( "qemu-system-${target}" )
7693 - fi
7694 - done
7695 -
7696 - for target in ${IUSE_USER_TARGETS} ; do
7697 - if use "qemu_user_targets_${target}"; then
7698 - user_targets+=",${target}-linux-user"
7699 - user_bins+=( "qemu-${target}" )
7700 - fi
7701 - done
7702 -
7703 - softmmu_targets=${softmmu_targets#,}
7704 - user_targets=${user_targets#,}
7705 -
7706 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
7707 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
7708 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
7709 -}
7710 -
7711 -src_compile() {
7712 - if [[ -n ${user_targets} ]]; then
7713 - cd "${S}/user-build"
7714 - default
7715 - fi
7716 -
7717 - if [[ -n ${softmmu_targets} ]]; then
7718 - cd "${S}/softmmu-build"
7719 - default
7720 - fi
7721 -
7722 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
7723 - cd "${S}/tools-build"
7724 - default
7725 - fi
7726 -}
7727 -
7728 -src_test() {
7729 - if [[ -n ${softmmu_targets} ]]; then
7730 - cd "${S}/softmmu-build"
7731 - pax-mark m */qemu-system-* #515550
7732 - emake -j1 check
7733 - emake -j1 check-report.html
7734 - fi
7735 -}
7736 -
7737 -qemu_python_install() {
7738 - python_domodule "${S}/scripts/qmp/qmp.py"
7739 -
7740 - python_doscript "${S}/scripts/kvm/kvm_stat"
7741 - python_doscript "${S}/scripts/kvm/vmxcap"
7742 - python_doscript "${S}/scripts/qmp/qmp-shell"
7743 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
7744 -}
7745 -
7746 -src_install() {
7747 - if [[ -n ${user_targets} ]]; then
7748 - cd "${S}/user-build"
7749 - emake DESTDIR="${ED}" install
7750 -
7751 - # Install binfmt handler init script for user targets
7752 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
7753 - fi
7754 -
7755 - if [[ -n ${softmmu_targets} ]]; then
7756 - cd "${S}/softmmu-build"
7757 - emake DESTDIR="${ED}" install
7758 -
7759 - # This might not exist if the test failed. #512010
7760 - [[ -e check-report.html ]] && dohtml check-report.html
7761 -
7762 - if use kernel_linux; then
7763 - udev_dorules "${FILESDIR}"/65-kvm.rules
7764 - fi
7765 -
7766 - if use python; then
7767 - python_foreach_impl qemu_python_install
7768 - fi
7769 - fi
7770 -
7771 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
7772 - cd "${S}/tools-build"
7773 - emake DESTDIR="${ED}" install
7774 - fi
7775 -
7776 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
7777 - pushd "${ED}"/usr/bin >/dev/null
7778 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
7779 - popd >/dev/null
7780 -
7781 - # Install config file example for qemu-bridge-helper
7782 - insinto "/etc/qemu"
7783 - doins "${FILESDIR}/bridge.conf"
7784 -
7785 - # Remove the docdir placed qmp-commands.txt
7786 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
7787 -
7788 - cd "${S}"
7789 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
7790 - newdoc pc-bios/README README.pc-bios
7791 - dodoc docs/qmp/*.txt
7792 -
7793 - if [[ -n ${softmmu_targets} ]]; then
7794 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
7795 - rm "${ED}/usr/share/qemu/bios.bin"
7796 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7797 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
7798 - fi
7799 -
7800 - # Remove vgabios since we're using the vgabios packaged one
7801 - rm "${ED}/usr/share/qemu/vgabios.bin"
7802 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
7803 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
7804 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
7805 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
7806 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7807 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
7808 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
7809 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
7810 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
7811 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
7812 - fi
7813 -
7814 - # Remove sgabios since we're using the sgabios packaged one
7815 - rm "${ED}/usr/share/qemu/sgabios.bin"
7816 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7817 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
7818 - fi
7819 -
7820 - # Remove iPXE since we're using the iPXE packaged one
7821 - rm "${ED}"/usr/share/qemu/pxe-*.rom
7822 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
7823 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
7824 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
7825 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
7826 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
7827 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
7828 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
7829 - fi
7830 - fi
7831 -
7832 - qemu_support_kvm && readme.gentoo_create_doc
7833 -}
7834 -
7835 -pkg_postinst() {
7836 - if qemu_support_kvm; then
7837 - readme.gentoo_print_elog
7838 - fi
7839 -
7840 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
7841 - udev_reload
7842 - fi
7843 -
7844 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
7845 -}
7846 -
7847 -pkg_info() {
7848 - echo "Using:"
7849 - echo " $(best_version app-emulation/spice-protocol)"
7850 - echo " $(best_version sys-firmware/ipxe)"
7851 - echo " $(best_version sys-firmware/seabios)"
7852 - if has_version 'sys-firmware/seabios[binary]'; then
7853 - echo " USE=binary"
7854 - else
7855 - echo " USE=''"
7856 - fi
7857 - echo " $(best_version sys-firmware/vgabios)"
7858 -}
7859
7860 diff --git a/app-emulation/qemu/qemu-2.4.0.1.ebuild b/app-emulation/qemu/qemu-2.4.0.1.ebuild
7861 deleted file mode 100644
7862 index e57f5ea..0000000
7863 --- a/app-emulation/qemu/qemu-2.4.0.1.ebuild
7864 +++ /dev/null
7865 @@ -1,640 +0,0 @@
7866 -# Copyright 1999-2015 Gentoo Foundation
7867 -# Distributed under the terms of the GNU General Public License v2
7868 -# $Id$
7869 -
7870 -EAPI=5
7871 -
7872 -PYTHON_COMPAT=( python2_7 )
7873 -PYTHON_REQ_USE="ncurses,readline"
7874 -
7875 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
7876 - user udev fcaps readme.gentoo pax-utils
7877 -
7878 -BACKPORTS=
7879 -
7880 -if [[ ${PV} = *9999* ]]; then
7881 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
7882 - inherit git-2
7883 - SRC_URI=""
7884 -else
7885 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
7886 - ${BACKPORTS:+
7887 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
7888 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
7889 -fi
7890 -
7891 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
7892 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
7893 -
7894 -LICENSE="GPL-2 LGPL-2 BSD-2"
7895 -SLOT="0"
7896 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
7897 -gtk gtk2 infiniband iscsi +jpeg \
7898 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
7899 -+png pulseaudio python \
7900 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
7901 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
7902 -virtfs +vnc vte xattr xen xfs"
7903 -
7904 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
7905 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
7906 -x86_64"
7907 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
7908 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
7909 -
7910 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
7911 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
7912 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
7913 -
7914 -# Allow no targets to be built so that people can get a tools-only build.
7915 -# Block USE flag configurations known to not work.
7916 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
7917 - gtk2? ( gtk )
7918 - qemu_softmmu_targets_arm? ( fdt )
7919 - qemu_softmmu_targets_microblaze? ( fdt )
7920 - qemu_softmmu_targets_ppc? ( fdt )
7921 - qemu_softmmu_targets_ppc64? ( fdt )
7922 - sdl2? ( sdl )
7923 - static? ( static-softmmu static-user )
7924 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
7925 - virtfs? ( xattr )
7926 - vte? ( gtk )"
7927 -
7928 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
7929 -#
7930 -# The attr lib isn't always linked in (although the USE flag is always
7931 -# respected). This is because qemu supports using the C library's API
7932 -# when available rather than always using the extranl library.
7933 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
7934 - sys-libs/zlib[static-libs(+)]
7935 - xattr? ( sys-apps/attr[static-libs(+)] )"
7936 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
7937 - >=x11-libs/pixman-0.28.0[static-libs(+)]
7938 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
7939 - aio? ( dev-libs/libaio[static-libs(+)] )
7940 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
7941 - bluetooth? ( net-wireless/bluez )
7942 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
7943 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
7944 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
7945 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
7946 - gtk? (
7947 - gtk2? (
7948 - x11-libs/gtk+:2
7949 - vte? ( x11-libs/vte:0 )
7950 - )
7951 - !gtk2? (
7952 - x11-libs/gtk+:3
7953 - vte? ( x11-libs/vte:2.90 )
7954 - )
7955 - )
7956 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
7957 - iscsi? ( net-libs/libiscsi )
7958 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
7959 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
7960 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
7961 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
7962 - numa? ( sys-process/numactl[static-libs(+)] )
7963 - opengl? (
7964 - virtual/opengl
7965 - media-libs/libepoxy[static-libs(+)]
7966 - media-libs/mesa[static-libs(+)]
7967 - media-libs/mesa[egl,gles2]
7968 - )
7969 - png? ( media-libs/libpng:0=[static-libs(+)] )
7970 - pulseaudio? ( media-sound/pulseaudio )
7971 - rbd? ( sys-cluster/ceph[static-libs(+)] )
7972 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
7973 - sdl? (
7974 - !sdl2? (
7975 - media-libs/libsdl[X]
7976 - >=media-libs/libsdl-1.2.11[static-libs(+)]
7977 - )
7978 - sdl2? (
7979 - media-libs/libsdl2[X]
7980 - media-libs/libsdl2[static-libs(+)]
7981 - )
7982 - )
7983 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
7984 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
7985 - snappy? ( app-arch/snappy[static-libs(+)] )
7986 - spice? (
7987 - >=app-emulation/spice-protocol-0.12.3
7988 - >=app-emulation/spice-0.12.0[static-libs(+)]
7989 - )
7990 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
7991 - tls? ( net-libs/gnutls[static-libs(+)] )
7992 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
7993 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
7994 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
7995 - vde? ( net-misc/vde[static-libs(+)] )
7996 - virtfs? ( sys-libs/libcap )
7997 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
7998 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
7999 -X86_FIRMWARE_DEPEND="
8000 - >=sys-firmware/ipxe-1.0.0_p20130624
8001 - pin-upstream-blobs? (
8002 - ~sys-firmware/seabios-1.8.2
8003 - ~sys-firmware/sgabios-0.1_pre8
8004 - ~sys-firmware/vgabios-0.7a
8005 - )
8006 - !pin-upstream-blobs? (
8007 - sys-firmware/seabios
8008 - sys-firmware/sgabios
8009 - sys-firmware/vgabios
8010 - )"
8011 -CDEPEND="
8012 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
8013 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
8014 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
8015 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
8016 - python? ( ${PYTHON_DEPS} )
8017 - systemtap? ( dev-util/systemtap )
8018 - xen? ( app-emulation/xen-tools:= )"
8019 -DEPEND="${CDEPEND}
8020 - dev-lang/perl
8021 - =dev-lang/python-2*
8022 - sys-apps/texinfo
8023 - virtual/pkgconfig
8024 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
8025 - gtk? ( nls? ( sys-devel/gettext ) )
8026 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
8027 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
8028 - test? (
8029 - dev-libs/glib[utils]
8030 - sys-devel/bc
8031 - )"
8032 -RDEPEND="${CDEPEND}
8033 - selinux? ( sec-policy/selinux-qemu )
8034 -"
8035 -
8036 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
8037 -
8038 -QA_PREBUILT="
8039 - usr/share/qemu/openbios-ppc
8040 - usr/share/qemu/openbios-sparc64
8041 - usr/share/qemu/openbios-sparc32
8042 - usr/share/qemu/palcode-clipper
8043 - usr/share/qemu/s390-ccw.img
8044 - usr/share/qemu/u-boot.e500
8045 -"
8046 -
8047 -QA_WX_LOAD="usr/bin/qemu-i386
8048 - usr/bin/qemu-x86_64
8049 - usr/bin/qemu-alpha
8050 - usr/bin/qemu-arm
8051 - usr/bin/qemu-cris
8052 - usr/bin/qemu-m68k
8053 - usr/bin/qemu-microblaze
8054 - usr/bin/qemu-microblazeel
8055 - usr/bin/qemu-mips
8056 - usr/bin/qemu-mipsel
8057 - usr/bin/qemu-or32
8058 - usr/bin/qemu-ppc
8059 - usr/bin/qemu-ppc64
8060 - usr/bin/qemu-ppc64abi32
8061 - usr/bin/qemu-sh4
8062 - usr/bin/qemu-sh4eb
8063 - usr/bin/qemu-sparc
8064 - usr/bin/qemu-sparc64
8065 - usr/bin/qemu-armeb
8066 - usr/bin/qemu-sparc32plus
8067 - usr/bin/qemu-s390x
8068 - usr/bin/qemu-unicore32"
8069 -
8070 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
8071 -you have the kernel module loaded before running kvm. The easiest way to
8072 -ensure that the kernel module is loaded is to load it on boot.\n
8073 -For AMD CPUs the module is called 'kvm-amd'\n
8074 -For Intel CPUs the module is called 'kvm-intel'\n
8075 -Please review /etc/conf.d/modules for how to load these\n\n
8076 -Make sure your user is in the 'kvm' group\n
8077 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
8078 -
8079 -qemu_support_kvm() {
8080 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
8081 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
8082 - use qemu_softmmu_targets_s390x; then
8083 - return 0
8084 - fi
8085 -
8086 - return 1
8087 -}
8088 -
8089 -pkg_pretend() {
8090 - if use kernel_linux && kernel_is lt 2 6 25; then
8091 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
8092 - elif use kernel_linux; then
8093 - if ! linux_config_exists; then
8094 - eerror "Unable to check your kernel for KVM support"
8095 - else
8096 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
8097 - ERROR_KVM="You must enable KVM in your kernel to continue"
8098 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
8099 - ERROR_KVM_AMD+=" your kernel configuration."
8100 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
8101 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
8102 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
8103 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
8104 - ERROR_TUN+=" virtual network device if using -net tap."
8105 - ERROR_BRIDGE="You will also need support for 802.1d"
8106 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
8107 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
8108 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
8109 - ERROR_VHOST_NET+=" support"
8110 -
8111 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
8112 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
8113 - fi
8114 -
8115 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
8116 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
8117 -
8118 - # Now do the actual checks setup above
8119 - check_extra_config
8120 - fi
8121 - fi
8122 -
8123 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
8124 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
8125 - eerror "instances are still pointing to it. Please update your"
8126 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
8127 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
8128 - die "update your virt configs to not use qemu-kvm"
8129 - fi
8130 -}
8131 -
8132 -pkg_setup() {
8133 - enewgroup kvm 78
8134 -}
8135 -
8136 -# Sanity check to make sure target lists are kept up-to-date.
8137 -check_targets() {
8138 - local var=$1 mak=$2
8139 - local detected sorted
8140 -
8141 - pushd "${S}"/default-configs >/dev/null || die
8142 -
8143 - # Force C locale until glibc is updated. #564936
8144 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
8145 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
8146 - if [[ ${sorted} != "${detected}" ]] ; then
8147 - eerror "The ebuild needs to be kept in sync."
8148 - eerror "${var}: ${sorted}"
8149 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
8150 - die "sync ${var} to the list of targets"
8151 - fi
8152 -
8153 - popd >/dev/null
8154 -}
8155 -
8156 -src_prepare() {
8157 - check_targets IUSE_SOFTMMU_TARGETS softmmu
8158 - check_targets IUSE_USER_TARGETS linux-user
8159 -
8160 - # Alter target makefiles to accept CFLAGS set via flag-o
8161 - sed -i -r \
8162 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
8163 - Makefile Makefile.target || die
8164 -
8165 - # Cheap hack to disable gettext .mo generation.
8166 - use nls || rm -f po/*.po
8167 -
8168 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
8169 - epatch "${FILESDIR}"/${PN}-2.4.0-block-mirror-crash.patch #558396
8170 - epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-7295-{1,2,3}.patch #560760
8171 - epatch "${FILESDIR}"/${PN}-2.4.0-CVE-2015-6855.patch #560422
8172 - [[ -n ${BACKPORTS} ]] && \
8173 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
8174 - epatch
8175 -
8176 - # Fix ld and objcopy being called directly
8177 - tc-export AR LD OBJCOPY
8178 -
8179 - # Verbose builds
8180 - MAKEOPTS+=" V=1"
8181 -
8182 - epatch_user
8183 -}
8184 -
8185 -##
8186 -# configures qemu based on the build directory and the build type
8187 -# we are using.
8188 -#
8189 -qemu_src_configure() {
8190 - debug-print-function ${FUNCNAME} "$@"
8191 -
8192 - local buildtype=$1
8193 - local builddir="${S}/${buildtype}-build"
8194 - local static_flag="static-${buildtype}"
8195 -
8196 - mkdir "${builddir}"
8197 -
8198 - local conf_opts=(
8199 - --prefix=/usr
8200 - --sysconfdir=/etc
8201 - --libdir=/usr/$(get_libdir)
8202 - --docdir=/usr/share/doc/${PF}/html
8203 - --disable-bsd-user
8204 - --disable-guest-agent
8205 - --disable-strip
8206 - --disable-werror
8207 - --python="${PYTHON}"
8208 - --cc="$(tc-getCC)"
8209 - --cxx="$(tc-getCXX)"
8210 - --host-cc="$(tc-getBUILD_CC)"
8211 - $(use_enable debug debug-info)
8212 - $(use_enable debug debug-tcg)
8213 - --enable-docs
8214 - $(use_enable tci tcg-interpreter)
8215 - $(use_enable xattr attr)
8216 - )
8217 -
8218 - # Disable options not used by user targets as the default configure
8219 - # options will autoprobe and try to link in a bunch of unused junk.
8220 - conf_softmmu() {
8221 - if [[ ${buildtype} == "user" ]] ; then
8222 - echo "--disable-${2:-$1}"
8223 - else
8224 - use_enable "$@"
8225 - fi
8226 - }
8227 - conf_opts+=(
8228 - $(conf_softmmu accessibility brlapi)
8229 - $(conf_softmmu aio linux-aio)
8230 - $(conf_softmmu bluetooth bluez)
8231 - $(conf_softmmu caps cap-ng)
8232 - $(conf_softmmu curl)
8233 - $(conf_softmmu fdt)
8234 - $(conf_softmmu glusterfs)
8235 - $(conf_softmmu gtk)
8236 - $(conf_softmmu infiniband rdma)
8237 - $(conf_softmmu iscsi libiscsi)
8238 - $(conf_softmmu jpeg vnc-jpeg)
8239 - $(conf_softmmu kernel_linux kvm)
8240 - $(conf_softmmu lzo)
8241 - $(conf_softmmu ncurses curses)
8242 - $(conf_softmmu nfs libnfs)
8243 - $(conf_softmmu numa)
8244 - $(conf_softmmu opengl)
8245 - $(conf_softmmu png vnc-png)
8246 - $(conf_softmmu rbd)
8247 - $(conf_softmmu sasl vnc-sasl)
8248 - $(conf_softmmu sdl)
8249 - $(conf_softmmu seccomp)
8250 - $(conf_softmmu smartcard smartcard-nss)
8251 - $(conf_softmmu snappy)
8252 - $(conf_softmmu spice)
8253 - $(conf_softmmu ssh libssh2)
8254 - $(conf_softmmu tls vnc-tls)
8255 - $(conf_softmmu usb libusb)
8256 - $(conf_softmmu usbredir usb-redir)
8257 - $(conf_softmmu uuid)
8258 - $(conf_softmmu vde)
8259 - $(conf_softmmu vhost-net)
8260 - $(conf_softmmu virtfs)
8261 - $(conf_softmmu vnc)
8262 - $(conf_softmmu vte)
8263 - $(conf_softmmu xen)
8264 - $(conf_softmmu xen xen-pci-passthrough)
8265 - $(conf_softmmu xfs xfsctl)
8266 - )
8267 -
8268 - case ${buildtype} in
8269 - user)
8270 - conf_opts+=(
8271 - --enable-linux-user
8272 - --disable-system
8273 - --disable-blobs
8274 - --disable-tools
8275 - )
8276 - ;;
8277 - softmmu)
8278 - # audio options
8279 - local audio_opts="oss"
8280 - use alsa && audio_opts="alsa,${audio_opts}"
8281 - use sdl && audio_opts="sdl,${audio_opts}"
8282 - use pulseaudio && audio_opts="pa,${audio_opts}"
8283 -
8284 - conf_opts+=(
8285 - --disable-linux-user
8286 - --enable-system
8287 - --with-system-pixman
8288 - --audio-drv-list="${audio_opts}"
8289 - )
8290 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
8291 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
8292 - ;;
8293 - tools)
8294 - conf_opts+=(
8295 - --disable-linux-user
8296 - --disable-system
8297 - --disable-blobs
8298 - )
8299 - static_flag="static"
8300 - ;;
8301 - esac
8302 -
8303 - local targets="${buildtype}_targets"
8304 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
8305 -
8306 - # Add support for SystemTAP
8307 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
8308 -
8309 - # We always want to attempt to build with PIE support as it results
8310 - # in a more secure binary. But it doesn't work with static or if
8311 - # the current GCC doesn't have PIE support.
8312 - if use ${static_flag}; then
8313 - conf_opts+=( --static --disable-pie )
8314 - else
8315 - gcc-specs-pie && conf_opts+=( --enable-pie )
8316 - fi
8317 -
8318 - echo "../configure ${conf_opts[*]}"
8319 - cd "${builddir}"
8320 - ../configure "${conf_opts[@]}" || die "configure failed"
8321 -
8322 - # FreeBSD's kernel does not support QEMU assigning/grabbing
8323 - # host USB devices yet
8324 - use kernel_FreeBSD && \
8325 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
8326 -}
8327 -
8328 -src_configure() {
8329 - local target
8330 -
8331 - python_setup
8332 -
8333 - softmmu_targets= softmmu_bins=()
8334 - user_targets= user_bins=()
8335 -
8336 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
8337 - if use "qemu_softmmu_targets_${target}"; then
8338 - softmmu_targets+=",${target}-softmmu"
8339 - softmmu_bins+=( "qemu-system-${target}" )
8340 - fi
8341 - done
8342 -
8343 - for target in ${IUSE_USER_TARGETS} ; do
8344 - if use "qemu_user_targets_${target}"; then
8345 - user_targets+=",${target}-linux-user"
8346 - user_bins+=( "qemu-${target}" )
8347 - fi
8348 - done
8349 -
8350 - softmmu_targets=${softmmu_targets#,}
8351 - user_targets=${user_targets#,}
8352 -
8353 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
8354 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
8355 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
8356 -}
8357 -
8358 -src_compile() {
8359 - if [[ -n ${user_targets} ]]; then
8360 - cd "${S}/user-build"
8361 - default
8362 - fi
8363 -
8364 - if [[ -n ${softmmu_targets} ]]; then
8365 - cd "${S}/softmmu-build"
8366 - default
8367 - fi
8368 -
8369 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
8370 - cd "${S}/tools-build"
8371 - default
8372 - fi
8373 -}
8374 -
8375 -src_test() {
8376 - if [[ -n ${softmmu_targets} ]]; then
8377 - cd "${S}/softmmu-build"
8378 - pax-mark m */qemu-system-* #515550
8379 - emake -j1 check
8380 - emake -j1 check-report.html
8381 - fi
8382 -}
8383 -
8384 -qemu_python_install() {
8385 - python_domodule "${S}/scripts/qmp/qmp.py"
8386 -
8387 - python_doscript "${S}/scripts/kvm/kvm_stat"
8388 - python_doscript "${S}/scripts/kvm/vmxcap"
8389 - python_doscript "${S}/scripts/qmp/qmp-shell"
8390 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
8391 -}
8392 -
8393 -src_install() {
8394 - if [[ -n ${user_targets} ]]; then
8395 - cd "${S}/user-build"
8396 - emake DESTDIR="${ED}" install
8397 -
8398 - # Install binfmt handler init script for user targets
8399 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
8400 - fi
8401 -
8402 - if [[ -n ${softmmu_targets} ]]; then
8403 - cd "${S}/softmmu-build"
8404 - emake DESTDIR="${ED}" install
8405 -
8406 - # This might not exist if the test failed. #512010
8407 - [[ -e check-report.html ]] && dohtml check-report.html
8408 -
8409 - if use kernel_linux; then
8410 - udev_dorules "${FILESDIR}"/65-kvm.rules
8411 - fi
8412 -
8413 - if use python; then
8414 - python_foreach_impl qemu_python_install
8415 - fi
8416 - fi
8417 -
8418 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
8419 - cd "${S}/tools-build"
8420 - emake DESTDIR="${ED}" install
8421 - fi
8422 -
8423 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
8424 - pushd "${ED}"/usr/bin >/dev/null
8425 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
8426 - popd >/dev/null
8427 -
8428 - # Install config file example for qemu-bridge-helper
8429 - insinto "/etc/qemu"
8430 - doins "${FILESDIR}/bridge.conf"
8431 -
8432 - # Remove the docdir placed qmp-commands.txt
8433 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
8434 -
8435 - cd "${S}"
8436 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
8437 - newdoc pc-bios/README README.pc-bios
8438 - dodoc docs/qmp/*.txt
8439 -
8440 - if [[ -n ${softmmu_targets} ]]; then
8441 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
8442 - rm "${ED}/usr/share/qemu/bios.bin"
8443 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
8444 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
8445 - fi
8446 -
8447 - # Remove vgabios since we're using the vgabios packaged one
8448 - rm "${ED}/usr/share/qemu/vgabios.bin"
8449 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
8450 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
8451 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
8452 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
8453 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
8454 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
8455 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
8456 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
8457 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
8458 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
8459 - fi
8460 -
8461 - # Remove sgabios since we're using the sgabios packaged one
8462 - rm "${ED}/usr/share/qemu/sgabios.bin"
8463 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
8464 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
8465 - fi
8466 -
8467 - # Remove iPXE since we're using the iPXE packaged one
8468 - rm "${ED}"/usr/share/qemu/pxe-*.rom
8469 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
8470 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
8471 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
8472 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
8473 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
8474 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
8475 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
8476 - fi
8477 - fi
8478 -
8479 - qemu_support_kvm && readme.gentoo_create_doc
8480 -}
8481 -
8482 -pkg_postinst() {
8483 - if qemu_support_kvm; then
8484 - readme.gentoo_print_elog
8485 - fi
8486 -
8487 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
8488 - udev_reload
8489 - fi
8490 -
8491 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
8492 -}
8493 -
8494 -pkg_info() {
8495 - echo "Using:"
8496 - echo " $(best_version app-emulation/spice-protocol)"
8497 - echo " $(best_version sys-firmware/ipxe)"
8498 - echo " $(best_version sys-firmware/seabios)"
8499 - if has_version 'sys-firmware/seabios[binary]'; then
8500 - echo " USE=binary"
8501 - else
8502 - echo " USE=''"
8503 - fi
8504 - echo " $(best_version sys-firmware/vgabios)"
8505 -}
8506
8507 diff --git a/app-emulation/qemu/qemu-2.4.1-r1.ebuild b/app-emulation/qemu/qemu-2.4.1-r1.ebuild
8508 deleted file mode 100644
8509 index 32539dd..0000000
8510 --- a/app-emulation/qemu/qemu-2.4.1-r1.ebuild
8511 +++ /dev/null
8512 @@ -1,640 +0,0 @@
8513 -# Copyright 1999-2015 Gentoo Foundation
8514 -# Distributed under the terms of the GNU General Public License v2
8515 -# $Id$
8516 -
8517 -EAPI=5
8518 -
8519 -PYTHON_COMPAT=( python2_7 )
8520 -PYTHON_REQ_USE="ncurses,readline"
8521 -
8522 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
8523 - user udev fcaps readme.gentoo pax-utils
8524 -
8525 -BACKPORTS=
8526 -
8527 -if [[ ${PV} = *9999* ]]; then
8528 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
8529 - inherit git-2
8530 - SRC_URI=""
8531 -else
8532 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
8533 - ${BACKPORTS:+
8534 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
8535 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
8536 -fi
8537 -
8538 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
8539 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
8540 -
8541 -LICENSE="GPL-2 LGPL-2 BSD-2"
8542 -SLOT="0"
8543 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
8544 -gtk gtk2 infiniband iscsi +jpeg \
8545 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
8546 -+png pulseaudio python \
8547 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
8548 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
8549 -virtfs +vnc vte xattr xen xfs"
8550 -
8551 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
8552 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
8553 -x86_64"
8554 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
8555 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
8556 -
8557 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
8558 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
8559 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
8560 -
8561 -# Allow no targets to be built so that people can get a tools-only build.
8562 -# Block USE flag configurations known to not work.
8563 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
8564 - gtk2? ( gtk )
8565 - qemu_softmmu_targets_arm? ( fdt )
8566 - qemu_softmmu_targets_microblaze? ( fdt )
8567 - qemu_softmmu_targets_ppc? ( fdt )
8568 - qemu_softmmu_targets_ppc64? ( fdt )
8569 - sdl2? ( sdl )
8570 - static? ( static-softmmu static-user )
8571 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
8572 - virtfs? ( xattr )
8573 - vte? ( gtk )"
8574 -
8575 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
8576 -#
8577 -# The attr lib isn't always linked in (although the USE flag is always
8578 -# respected). This is because qemu supports using the C library's API
8579 -# when available rather than always using the extranl library.
8580 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
8581 - sys-libs/zlib[static-libs(+)]
8582 - xattr? ( sys-apps/attr[static-libs(+)] )"
8583 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
8584 - >=x11-libs/pixman-0.28.0[static-libs(+)]
8585 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
8586 - aio? ( dev-libs/libaio[static-libs(+)] )
8587 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
8588 - bluetooth? ( net-wireless/bluez )
8589 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
8590 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
8591 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
8592 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
8593 - gtk? (
8594 - gtk2? (
8595 - x11-libs/gtk+:2
8596 - vte? ( x11-libs/vte:0 )
8597 - )
8598 - !gtk2? (
8599 - x11-libs/gtk+:3
8600 - vte? ( x11-libs/vte:2.90 )
8601 - )
8602 - )
8603 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
8604 - iscsi? ( net-libs/libiscsi )
8605 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
8606 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
8607 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
8608 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
8609 - numa? ( sys-process/numactl[static-libs(+)] )
8610 - opengl? (
8611 - virtual/opengl
8612 - media-libs/libepoxy[static-libs(+)]
8613 - media-libs/mesa[static-libs(+)]
8614 - media-libs/mesa[egl,gles2]
8615 - )
8616 - png? ( media-libs/libpng:0=[static-libs(+)] )
8617 - pulseaudio? ( media-sound/pulseaudio )
8618 - rbd? ( sys-cluster/ceph[static-libs(+)] )
8619 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
8620 - sdl? (
8621 - !sdl2? (
8622 - media-libs/libsdl[X]
8623 - >=media-libs/libsdl-1.2.11[static-libs(+)]
8624 - )
8625 - sdl2? (
8626 - media-libs/libsdl2[X]
8627 - media-libs/libsdl2[static-libs(+)]
8628 - )
8629 - )
8630 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
8631 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
8632 - snappy? ( app-arch/snappy[static-libs(+)] )
8633 - spice? (
8634 - >=app-emulation/spice-protocol-0.12.3
8635 - >=app-emulation/spice-0.12.0[static-libs(+)]
8636 - )
8637 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
8638 - tls? ( net-libs/gnutls[static-libs(+)] )
8639 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
8640 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
8641 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
8642 - vde? ( net-misc/vde[static-libs(+)] )
8643 - virtfs? ( sys-libs/libcap )
8644 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
8645 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
8646 -X86_FIRMWARE_DEPEND="
8647 - >=sys-firmware/ipxe-1.0.0_p20130624
8648 - pin-upstream-blobs? (
8649 - ~sys-firmware/seabios-1.8.2
8650 - ~sys-firmware/sgabios-0.1_pre8
8651 - ~sys-firmware/vgabios-0.7a
8652 - )
8653 - !pin-upstream-blobs? (
8654 - sys-firmware/seabios
8655 - sys-firmware/sgabios
8656 - sys-firmware/vgabios
8657 - )"
8658 -CDEPEND="
8659 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
8660 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
8661 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
8662 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
8663 - python? ( ${PYTHON_DEPS} )
8664 - systemtap? ( dev-util/systemtap )
8665 - xen? ( app-emulation/xen-tools:= )"
8666 -DEPEND="${CDEPEND}
8667 - dev-lang/perl
8668 - =dev-lang/python-2*
8669 - sys-apps/texinfo
8670 - virtual/pkgconfig
8671 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
8672 - gtk? ( nls? ( sys-devel/gettext ) )
8673 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
8674 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
8675 - test? (
8676 - dev-libs/glib[utils]
8677 - sys-devel/bc
8678 - )"
8679 -RDEPEND="${CDEPEND}
8680 - selinux? ( sec-policy/selinux-qemu )
8681 -"
8682 -
8683 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
8684 -
8685 -QA_PREBUILT="
8686 - usr/share/qemu/openbios-ppc
8687 - usr/share/qemu/openbios-sparc64
8688 - usr/share/qemu/openbios-sparc32
8689 - usr/share/qemu/palcode-clipper
8690 - usr/share/qemu/s390-ccw.img
8691 - usr/share/qemu/u-boot.e500
8692 -"
8693 -
8694 -QA_WX_LOAD="usr/bin/qemu-i386
8695 - usr/bin/qemu-x86_64
8696 - usr/bin/qemu-alpha
8697 - usr/bin/qemu-arm
8698 - usr/bin/qemu-cris
8699 - usr/bin/qemu-m68k
8700 - usr/bin/qemu-microblaze
8701 - usr/bin/qemu-microblazeel
8702 - usr/bin/qemu-mips
8703 - usr/bin/qemu-mipsel
8704 - usr/bin/qemu-or32
8705 - usr/bin/qemu-ppc
8706 - usr/bin/qemu-ppc64
8707 - usr/bin/qemu-ppc64abi32
8708 - usr/bin/qemu-sh4
8709 - usr/bin/qemu-sh4eb
8710 - usr/bin/qemu-sparc
8711 - usr/bin/qemu-sparc64
8712 - usr/bin/qemu-armeb
8713 - usr/bin/qemu-sparc32plus
8714 - usr/bin/qemu-s390x
8715 - usr/bin/qemu-unicore32"
8716 -
8717 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
8718 -you have the kernel module loaded before running kvm. The easiest way to
8719 -ensure that the kernel module is loaded is to load it on boot.\n
8720 -For AMD CPUs the module is called 'kvm-amd'\n
8721 -For Intel CPUs the module is called 'kvm-intel'\n
8722 -Please review /etc/conf.d/modules for how to load these\n\n
8723 -Make sure your user is in the 'kvm' group\n
8724 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
8725 -
8726 -qemu_support_kvm() {
8727 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
8728 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
8729 - use qemu_softmmu_targets_s390x; then
8730 - return 0
8731 - fi
8732 -
8733 - return 1
8734 -}
8735 -
8736 -pkg_pretend() {
8737 - if use kernel_linux && kernel_is lt 2 6 25; then
8738 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
8739 - elif use kernel_linux; then
8740 - if ! linux_config_exists; then
8741 - eerror "Unable to check your kernel for KVM support"
8742 - else
8743 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
8744 - ERROR_KVM="You must enable KVM in your kernel to continue"
8745 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
8746 - ERROR_KVM_AMD+=" your kernel configuration."
8747 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
8748 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
8749 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
8750 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
8751 - ERROR_TUN+=" virtual network device if using -net tap."
8752 - ERROR_BRIDGE="You will also need support for 802.1d"
8753 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
8754 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
8755 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
8756 - ERROR_VHOST_NET+=" support"
8757 -
8758 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
8759 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
8760 - fi
8761 -
8762 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
8763 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
8764 -
8765 - # Now do the actual checks setup above
8766 - check_extra_config
8767 - fi
8768 - fi
8769 -
8770 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
8771 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
8772 - eerror "instances are still pointing to it. Please update your"
8773 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
8774 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
8775 - die "update your virt configs to not use qemu-kvm"
8776 - fi
8777 -}
8778 -
8779 -pkg_setup() {
8780 - enewgroup kvm 78
8781 -}
8782 -
8783 -# Sanity check to make sure target lists are kept up-to-date.
8784 -check_targets() {
8785 - local var=$1 mak=$2
8786 - local detected sorted
8787 -
8788 - pushd "${S}"/default-configs >/dev/null || die
8789 -
8790 - # Force C locale until glibc is updated. #564936
8791 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
8792 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
8793 - if [[ ${sorted} != "${detected}" ]] ; then
8794 - eerror "The ebuild needs to be kept in sync."
8795 - eerror "${var}: ${sorted}"
8796 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
8797 - die "sync ${var} to the list of targets"
8798 - fi
8799 -
8800 - popd >/dev/null
8801 -}
8802 -
8803 -src_prepare() {
8804 - check_targets IUSE_SOFTMMU_TARGETS softmmu
8805 - check_targets IUSE_USER_TARGETS linux-user
8806 -
8807 - # Alter target makefiles to accept CFLAGS set via flag-o
8808 - sed -i -r \
8809 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
8810 - Makefile Makefile.target || die
8811 -
8812 - # Cheap hack to disable gettext .mo generation.
8813 - use nls || rm -f po/*.po
8814 -
8815 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
8816 - epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-{7504,7512}.patch #567144
8817 - epatch "${FILESDIR}"/${PN}-2.4.1-CVE-2015-8345.patch #566792
8818 - epatch "${FILESDIR}"/${PN}-2.4-mips-* #563162
8819 - [[ -n ${BACKPORTS} ]] && \
8820 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
8821 - epatch
8822 -
8823 - # Fix ld and objcopy being called directly
8824 - tc-export AR LD OBJCOPY
8825 -
8826 - # Verbose builds
8827 - MAKEOPTS+=" V=1"
8828 -
8829 - epatch_user
8830 -}
8831 -
8832 -##
8833 -# configures qemu based on the build directory and the build type
8834 -# we are using.
8835 -#
8836 -qemu_src_configure() {
8837 - debug-print-function ${FUNCNAME} "$@"
8838 -
8839 - local buildtype=$1
8840 - local builddir="${S}/${buildtype}-build"
8841 - local static_flag="static-${buildtype}"
8842 -
8843 - mkdir "${builddir}"
8844 -
8845 - local conf_opts=(
8846 - --prefix=/usr
8847 - --sysconfdir=/etc
8848 - --libdir=/usr/$(get_libdir)
8849 - --docdir=/usr/share/doc/${PF}/html
8850 - --disable-bsd-user
8851 - --disable-guest-agent
8852 - --disable-strip
8853 - --disable-werror
8854 - --python="${PYTHON}"
8855 - --cc="$(tc-getCC)"
8856 - --cxx="$(tc-getCXX)"
8857 - --host-cc="$(tc-getBUILD_CC)"
8858 - $(use_enable debug debug-info)
8859 - $(use_enable debug debug-tcg)
8860 - --enable-docs
8861 - $(use_enable tci tcg-interpreter)
8862 - $(use_enable xattr attr)
8863 - )
8864 -
8865 - # Disable options not used by user targets as the default configure
8866 - # options will autoprobe and try to link in a bunch of unused junk.
8867 - conf_softmmu() {
8868 - if [[ ${buildtype} == "user" ]] ; then
8869 - echo "--disable-${2:-$1}"
8870 - else
8871 - use_enable "$@"
8872 - fi
8873 - }
8874 - conf_opts+=(
8875 - $(conf_softmmu accessibility brlapi)
8876 - $(conf_softmmu aio linux-aio)
8877 - $(conf_softmmu bluetooth bluez)
8878 - $(conf_softmmu caps cap-ng)
8879 - $(conf_softmmu curl)
8880 - $(conf_softmmu fdt)
8881 - $(conf_softmmu glusterfs)
8882 - $(conf_softmmu gtk)
8883 - $(conf_softmmu infiniband rdma)
8884 - $(conf_softmmu iscsi libiscsi)
8885 - $(conf_softmmu jpeg vnc-jpeg)
8886 - $(conf_softmmu kernel_linux kvm)
8887 - $(conf_softmmu lzo)
8888 - $(conf_softmmu ncurses curses)
8889 - $(conf_softmmu nfs libnfs)
8890 - $(conf_softmmu numa)
8891 - $(conf_softmmu opengl)
8892 - $(conf_softmmu png vnc-png)
8893 - $(conf_softmmu rbd)
8894 - $(conf_softmmu sasl vnc-sasl)
8895 - $(conf_softmmu sdl)
8896 - $(conf_softmmu seccomp)
8897 - $(conf_softmmu smartcard smartcard-nss)
8898 - $(conf_softmmu snappy)
8899 - $(conf_softmmu spice)
8900 - $(conf_softmmu ssh libssh2)
8901 - $(conf_softmmu tls vnc-tls)
8902 - $(conf_softmmu usb libusb)
8903 - $(conf_softmmu usbredir usb-redir)
8904 - $(conf_softmmu uuid)
8905 - $(conf_softmmu vde)
8906 - $(conf_softmmu vhost-net)
8907 - $(conf_softmmu virtfs)
8908 - $(conf_softmmu vnc)
8909 - $(conf_softmmu vte)
8910 - $(conf_softmmu xen)
8911 - $(conf_softmmu xen xen-pci-passthrough)
8912 - $(conf_softmmu xfs xfsctl)
8913 - )
8914 -
8915 - case ${buildtype} in
8916 - user)
8917 - conf_opts+=(
8918 - --enable-linux-user
8919 - --disable-system
8920 - --disable-blobs
8921 - --disable-tools
8922 - )
8923 - ;;
8924 - softmmu)
8925 - # audio options
8926 - local audio_opts="oss"
8927 - use alsa && audio_opts="alsa,${audio_opts}"
8928 - use sdl && audio_opts="sdl,${audio_opts}"
8929 - use pulseaudio && audio_opts="pa,${audio_opts}"
8930 -
8931 - conf_opts+=(
8932 - --disable-linux-user
8933 - --enable-system
8934 - --with-system-pixman
8935 - --audio-drv-list="${audio_opts}"
8936 - )
8937 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
8938 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
8939 - ;;
8940 - tools)
8941 - conf_opts+=(
8942 - --disable-linux-user
8943 - --disable-system
8944 - --disable-blobs
8945 - )
8946 - static_flag="static"
8947 - ;;
8948 - esac
8949 -
8950 - local targets="${buildtype}_targets"
8951 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
8952 -
8953 - # Add support for SystemTAP
8954 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
8955 -
8956 - # We always want to attempt to build with PIE support as it results
8957 - # in a more secure binary. But it doesn't work with static or if
8958 - # the current GCC doesn't have PIE support.
8959 - if use ${static_flag}; then
8960 - conf_opts+=( --static --disable-pie )
8961 - else
8962 - gcc-specs-pie && conf_opts+=( --enable-pie )
8963 - fi
8964 -
8965 - echo "../configure ${conf_opts[*]}"
8966 - cd "${builddir}"
8967 - ../configure "${conf_opts[@]}" || die "configure failed"
8968 -
8969 - # FreeBSD's kernel does not support QEMU assigning/grabbing
8970 - # host USB devices yet
8971 - use kernel_FreeBSD && \
8972 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
8973 -}
8974 -
8975 -src_configure() {
8976 - local target
8977 -
8978 - python_setup
8979 -
8980 - softmmu_targets= softmmu_bins=()
8981 - user_targets= user_bins=()
8982 -
8983 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
8984 - if use "qemu_softmmu_targets_${target}"; then
8985 - softmmu_targets+=",${target}-softmmu"
8986 - softmmu_bins+=( "qemu-system-${target}" )
8987 - fi
8988 - done
8989 -
8990 - for target in ${IUSE_USER_TARGETS} ; do
8991 - if use "qemu_user_targets_${target}"; then
8992 - user_targets+=",${target}-linux-user"
8993 - user_bins+=( "qemu-${target}" )
8994 - fi
8995 - done
8996 -
8997 - softmmu_targets=${softmmu_targets#,}
8998 - user_targets=${user_targets#,}
8999 -
9000 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
9001 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
9002 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
9003 -}
9004 -
9005 -src_compile() {
9006 - if [[ -n ${user_targets} ]]; then
9007 - cd "${S}/user-build"
9008 - default
9009 - fi
9010 -
9011 - if [[ -n ${softmmu_targets} ]]; then
9012 - cd "${S}/softmmu-build"
9013 - default
9014 - fi
9015 -
9016 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
9017 - cd "${S}/tools-build"
9018 - default
9019 - fi
9020 -}
9021 -
9022 -src_test() {
9023 - if [[ -n ${softmmu_targets} ]]; then
9024 - cd "${S}/softmmu-build"
9025 - pax-mark m */qemu-system-* #515550
9026 - emake -j1 check
9027 - emake -j1 check-report.html
9028 - fi
9029 -}
9030 -
9031 -qemu_python_install() {
9032 - python_domodule "${S}/scripts/qmp/qmp.py"
9033 -
9034 - python_doscript "${S}/scripts/kvm/kvm_stat"
9035 - python_doscript "${S}/scripts/kvm/vmxcap"
9036 - python_doscript "${S}/scripts/qmp/qmp-shell"
9037 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
9038 -}
9039 -
9040 -src_install() {
9041 - if [[ -n ${user_targets} ]]; then
9042 - cd "${S}/user-build"
9043 - emake DESTDIR="${ED}" install
9044 -
9045 - # Install binfmt handler init script for user targets
9046 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
9047 - fi
9048 -
9049 - if [[ -n ${softmmu_targets} ]]; then
9050 - cd "${S}/softmmu-build"
9051 - emake DESTDIR="${ED}" install
9052 -
9053 - # This might not exist if the test failed. #512010
9054 - [[ -e check-report.html ]] && dohtml check-report.html
9055 -
9056 - if use kernel_linux; then
9057 - udev_dorules "${FILESDIR}"/65-kvm.rules
9058 - fi
9059 -
9060 - if use python; then
9061 - python_foreach_impl qemu_python_install
9062 - fi
9063 - fi
9064 -
9065 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
9066 - cd "${S}/tools-build"
9067 - emake DESTDIR="${ED}" install
9068 - fi
9069 -
9070 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
9071 - pushd "${ED}"/usr/bin >/dev/null
9072 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
9073 - popd >/dev/null
9074 -
9075 - # Install config file example for qemu-bridge-helper
9076 - insinto "/etc/qemu"
9077 - doins "${FILESDIR}/bridge.conf"
9078 -
9079 - # Remove the docdir placed qmp-commands.txt
9080 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
9081 -
9082 - cd "${S}"
9083 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
9084 - newdoc pc-bios/README README.pc-bios
9085 - dodoc docs/qmp/*.txt
9086 -
9087 - if [[ -n ${softmmu_targets} ]]; then
9088 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
9089 - rm "${ED}/usr/share/qemu/bios.bin"
9090 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9091 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
9092 - fi
9093 -
9094 - # Remove vgabios since we're using the vgabios packaged one
9095 - rm "${ED}/usr/share/qemu/vgabios.bin"
9096 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
9097 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
9098 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
9099 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
9100 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9101 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
9102 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
9103 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
9104 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
9105 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
9106 - fi
9107 -
9108 - # Remove sgabios since we're using the sgabios packaged one
9109 - rm "${ED}/usr/share/qemu/sgabios.bin"
9110 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9111 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
9112 - fi
9113 -
9114 - # Remove iPXE since we're using the iPXE packaged one
9115 - rm "${ED}"/usr/share/qemu/pxe-*.rom
9116 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9117 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
9118 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
9119 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
9120 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
9121 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
9122 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
9123 - fi
9124 - fi
9125 -
9126 - qemu_support_kvm && readme.gentoo_create_doc
9127 -}
9128 -
9129 -pkg_postinst() {
9130 - if qemu_support_kvm; then
9131 - readme.gentoo_print_elog
9132 - fi
9133 -
9134 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
9135 - udev_reload
9136 - fi
9137 -
9138 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
9139 -}
9140 -
9141 -pkg_info() {
9142 - echo "Using:"
9143 - echo " $(best_version app-emulation/spice-protocol)"
9144 - echo " $(best_version sys-firmware/ipxe)"
9145 - echo " $(best_version sys-firmware/seabios)"
9146 - if has_version 'sys-firmware/seabios[binary]'; then
9147 - echo " USE=binary"
9148 - else
9149 - echo " USE=''"
9150 - fi
9151 - echo " $(best_version sys-firmware/vgabios)"
9152 -}
9153
9154 diff --git a/app-emulation/qemu/qemu-2.4.1.ebuild b/app-emulation/qemu/qemu-2.4.1.ebuild
9155 deleted file mode 100644
9156 index e535a10..0000000
9157 --- a/app-emulation/qemu/qemu-2.4.1.ebuild
9158 +++ /dev/null
9159 @@ -1,638 +0,0 @@
9160 -# Copyright 1999-2015 Gentoo Foundation
9161 -# Distributed under the terms of the GNU General Public License v2
9162 -# $Id$
9163 -
9164 -EAPI=5
9165 -
9166 -PYTHON_COMPAT=( python2_7 )
9167 -PYTHON_REQ_USE="ncurses,readline"
9168 -
9169 -inherit eutils flag-o-matic linux-info toolchain-funcs multilib python-r1 \
9170 - user udev fcaps readme.gentoo pax-utils
9171 -
9172 -BACKPORTS=
9173 -
9174 -if [[ ${PV} = *9999* ]]; then
9175 - EGIT_REPO_URI="git://git.qemu.org/qemu.git"
9176 - inherit git-2
9177 - SRC_URI=""
9178 -else
9179 - SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.bz2
9180 - ${BACKPORTS:+
9181 - https://dev.gentoo.org/~cardoe/distfiles/${P}-${BACKPORTS}.tar.xz}"
9182 - KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
9183 -fi
9184 -
9185 -DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
9186 -HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
9187 -
9188 -LICENSE="GPL-2 LGPL-2 BSD-2"
9189 -SLOT="0"
9190 -IUSE="accessibility +aio alsa bluetooth +caps +curl debug +fdt glusterfs \
9191 -gtk gtk2 infiniband iscsi +jpeg \
9192 -kernel_linux kernel_FreeBSD lzo ncurses nfs nls numa opengl +pin-upstream-blobs
9193 -+png pulseaudio python \
9194 -rbd sasl +seccomp sdl sdl2 selinux smartcard snappy spice ssh static static-softmmu
9195 -static-user systemtap tci test +threads tls usb usbredir +uuid vde +vhost-net \
9196 -virtfs +vnc vte xattr xen xfs"
9197 -
9198 -COMMON_TARGETS="aarch64 alpha arm cris i386 m68k microblaze microblazeel mips
9199 -mips64 mips64el mipsel or32 ppc ppc64 s390x sh4 sh4eb sparc sparc64 unicore32
9200 -x86_64"
9201 -IUSE_SOFTMMU_TARGETS="${COMMON_TARGETS} lm32 moxie ppcemb tricore xtensa xtensaeb"
9202 -IUSE_USER_TARGETS="${COMMON_TARGETS} armeb mipsn32 mipsn32el ppc64abi32 ppc64le sparc32plus"
9203 -
9204 -use_softmmu_targets=$(printf ' qemu_softmmu_targets_%s' ${IUSE_SOFTMMU_TARGETS})
9205 -use_user_targets=$(printf ' qemu_user_targets_%s' ${IUSE_USER_TARGETS})
9206 -IUSE+=" ${use_softmmu_targets} ${use_user_targets}"
9207 -
9208 -# Allow no targets to be built so that people can get a tools-only build.
9209 -# Block USE flag configurations known to not work.
9210 -REQUIRED_USE="${PYTHON_REQUIRED_USE}
9211 - gtk2? ( gtk )
9212 - qemu_softmmu_targets_arm? ( fdt )
9213 - qemu_softmmu_targets_microblaze? ( fdt )
9214 - qemu_softmmu_targets_ppc? ( fdt )
9215 - qemu_softmmu_targets_ppc64? ( fdt )
9216 - sdl2? ( sdl )
9217 - static? ( static-softmmu static-user )
9218 - static-softmmu? ( !alsa !pulseaudio !bluetooth !opengl !gtk !gtk2 )
9219 - virtfs? ( xattr )
9220 - vte? ( gtk )"
9221 -
9222 -# Yep, you need both libcap and libcap-ng since virtfs only uses libcap.
9223 -#
9224 -# The attr lib isn't always linked in (although the USE flag is always
9225 -# respected). This is because qemu supports using the C library's API
9226 -# when available rather than always using the extranl library.
9227 -COMMON_LIB_DEPEND=">=dev-libs/glib-2.0[static-libs(+)]
9228 - sys-libs/zlib[static-libs(+)]
9229 - xattr? ( sys-apps/attr[static-libs(+)] )"
9230 -SOFTMMU_LIB_DEPEND="${COMMON_LIB_DEPEND}
9231 - >=x11-libs/pixman-0.28.0[static-libs(+)]
9232 - accessibility? ( app-accessibility/brltty[static-libs(+)] )
9233 - aio? ( dev-libs/libaio[static-libs(+)] )
9234 - alsa? ( >=media-libs/alsa-lib-1.0.13 )
9235 - bluetooth? ( net-wireless/bluez )
9236 - caps? ( sys-libs/libcap-ng[static-libs(+)] )
9237 - curl? ( >=net-misc/curl-7.15.4[static-libs(+)] )
9238 - fdt? ( >=sys-apps/dtc-1.4.0[static-libs(+)] )
9239 - glusterfs? ( >=sys-cluster/glusterfs-3.4.0[static-libs(+)] )
9240 - gtk? (
9241 - gtk2? (
9242 - x11-libs/gtk+:2
9243 - vte? ( x11-libs/vte:0 )
9244 - )
9245 - !gtk2? (
9246 - x11-libs/gtk+:3
9247 - vte? ( x11-libs/vte:2.90 )
9248 - )
9249 - )
9250 - infiniband? ( sys-infiniband/librdmacm:=[static-libs(+)] )
9251 - iscsi? ( net-libs/libiscsi )
9252 - jpeg? ( virtual/jpeg:=[static-libs(+)] )
9253 - lzo? ( dev-libs/lzo:2[static-libs(+)] )
9254 - ncurses? ( sys-libs/ncurses:0=[static-libs(+)] )
9255 - nfs? ( >=net-fs/libnfs-1.9.3[static-libs(+)] )
9256 - numa? ( sys-process/numactl[static-libs(+)] )
9257 - opengl? (
9258 - virtual/opengl
9259 - media-libs/libepoxy[static-libs(+)]
9260 - media-libs/mesa[static-libs(+)]
9261 - media-libs/mesa[egl,gles2]
9262 - )
9263 - png? ( media-libs/libpng:0=[static-libs(+)] )
9264 - pulseaudio? ( media-sound/pulseaudio )
9265 - rbd? ( sys-cluster/ceph[static-libs(+)] )
9266 - sasl? ( dev-libs/cyrus-sasl[static-libs(+)] )
9267 - sdl? (
9268 - !sdl2? (
9269 - media-libs/libsdl[X]
9270 - >=media-libs/libsdl-1.2.11[static-libs(+)]
9271 - )
9272 - sdl2? (
9273 - media-libs/libsdl2[X]
9274 - media-libs/libsdl2[static-libs(+)]
9275 - )
9276 - )
9277 - seccomp? ( >=sys-libs/libseccomp-2.1.0[static-libs(+)] )
9278 - smartcard? ( dev-libs/nss !app-emulation/libcacard )
9279 - snappy? ( app-arch/snappy[static-libs(+)] )
9280 - spice? (
9281 - >=app-emulation/spice-protocol-0.12.3
9282 - >=app-emulation/spice-0.12.0[static-libs(+)]
9283 - )
9284 - ssh? ( >=net-libs/libssh2-1.2.8[static-libs(+)] )
9285 - tls? ( net-libs/gnutls[static-libs(+)] )
9286 - usb? ( >=virtual/libusb-1-r2[static-libs(+)] )
9287 - usbredir? ( >=sys-apps/usbredir-0.6[static-libs(+)] )
9288 - uuid? ( >=sys-apps/util-linux-2.16.0[static-libs(+)] )
9289 - vde? ( net-misc/vde[static-libs(+)] )
9290 - virtfs? ( sys-libs/libcap )
9291 - xfs? ( sys-fs/xfsprogs[static-libs(+)] )"
9292 -USER_LIB_DEPEND="${COMMON_LIB_DEPEND}"
9293 -X86_FIRMWARE_DEPEND="
9294 - >=sys-firmware/ipxe-1.0.0_p20130624
9295 - pin-upstream-blobs? (
9296 - ~sys-firmware/seabios-1.8.2
9297 - ~sys-firmware/sgabios-0.1_pre8
9298 - ~sys-firmware/vgabios-0.7a
9299 - )
9300 - !pin-upstream-blobs? (
9301 - sys-firmware/seabios
9302 - sys-firmware/sgabios
9303 - sys-firmware/vgabios
9304 - )"
9305 -CDEPEND="
9306 - !static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND//\[static-libs(+)]} ) " ${use_softmmu_targets}) )
9307 - !static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND//\[static-libs(+)]} ) " ${use_user_targets}) )
9308 - qemu_softmmu_targets_i386? ( ${X86_FIRMWARE_DEPEND} )
9309 - qemu_softmmu_targets_x86_64? ( ${X86_FIRMWARE_DEPEND} )
9310 - python? ( ${PYTHON_DEPS} )
9311 - systemtap? ( dev-util/systemtap )
9312 - xen? ( app-emulation/xen-tools:= )"
9313 -DEPEND="${CDEPEND}
9314 - dev-lang/perl
9315 - =dev-lang/python-2*
9316 - sys-apps/texinfo
9317 - virtual/pkgconfig
9318 - kernel_linux? ( >=sys-kernel/linux-headers-2.6.35 )
9319 - gtk? ( nls? ( sys-devel/gettext ) )
9320 - static-softmmu? ( $(printf "%s? ( ${SOFTMMU_LIB_DEPEND} ) " ${use_softmmu_targets}) )
9321 - static-user? ( $(printf "%s? ( ${USER_LIB_DEPEND} ) " ${use_user_targets}) )
9322 - test? (
9323 - dev-libs/glib[utils]
9324 - sys-devel/bc
9325 - )"
9326 -RDEPEND="${CDEPEND}
9327 - selinux? ( sec-policy/selinux-qemu )
9328 -"
9329 -
9330 -STRIP_MASK="/usr/share/qemu/palcode-clipper"
9331 -
9332 -QA_PREBUILT="
9333 - usr/share/qemu/openbios-ppc
9334 - usr/share/qemu/openbios-sparc64
9335 - usr/share/qemu/openbios-sparc32
9336 - usr/share/qemu/palcode-clipper
9337 - usr/share/qemu/s390-ccw.img
9338 - usr/share/qemu/u-boot.e500
9339 -"
9340 -
9341 -QA_WX_LOAD="usr/bin/qemu-i386
9342 - usr/bin/qemu-x86_64
9343 - usr/bin/qemu-alpha
9344 - usr/bin/qemu-arm
9345 - usr/bin/qemu-cris
9346 - usr/bin/qemu-m68k
9347 - usr/bin/qemu-microblaze
9348 - usr/bin/qemu-microblazeel
9349 - usr/bin/qemu-mips
9350 - usr/bin/qemu-mipsel
9351 - usr/bin/qemu-or32
9352 - usr/bin/qemu-ppc
9353 - usr/bin/qemu-ppc64
9354 - usr/bin/qemu-ppc64abi32
9355 - usr/bin/qemu-sh4
9356 - usr/bin/qemu-sh4eb
9357 - usr/bin/qemu-sparc
9358 - usr/bin/qemu-sparc64
9359 - usr/bin/qemu-armeb
9360 - usr/bin/qemu-sparc32plus
9361 - usr/bin/qemu-s390x
9362 - usr/bin/qemu-unicore32"
9363 -
9364 -DOC_CONTENTS="If you don't have kvm compiled into the kernel, make sure
9365 -you have the kernel module loaded before running kvm. The easiest way to
9366 -ensure that the kernel module is loaded is to load it on boot.\n
9367 -For AMD CPUs the module is called 'kvm-amd'\n
9368 -For Intel CPUs the module is called 'kvm-intel'\n
9369 -Please review /etc/conf.d/modules for how to load these\n\n
9370 -Make sure your user is in the 'kvm' group\n
9371 -Just run 'gpasswd -a <USER> kvm', then have <USER> re-login."
9372 -
9373 -qemu_support_kvm() {
9374 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386 \
9375 - use qemu_softmmu_targets_ppc || use qemu_softmmu_targets_ppc64 \
9376 - use qemu_softmmu_targets_s390x; then
9377 - return 0
9378 - fi
9379 -
9380 - return 1
9381 -}
9382 -
9383 -pkg_pretend() {
9384 - if use kernel_linux && kernel_is lt 2 6 25; then
9385 - eerror "This version of KVM requres a host kernel of 2.6.25 or higher."
9386 - elif use kernel_linux; then
9387 - if ! linux_config_exists; then
9388 - eerror "Unable to check your kernel for KVM support"
9389 - else
9390 - CONFIG_CHECK="~KVM ~TUN ~BRIDGE"
9391 - ERROR_KVM="You must enable KVM in your kernel to continue"
9392 - ERROR_KVM_AMD="If you have an AMD CPU, you must enable KVM_AMD in"
9393 - ERROR_KVM_AMD+=" your kernel configuration."
9394 - ERROR_KVM_INTEL="If you have an Intel CPU, you must enable"
9395 - ERROR_KVM_INTEL+=" KVM_INTEL in your kernel configuration."
9396 - ERROR_TUN="You will need the Universal TUN/TAP driver compiled"
9397 - ERROR_TUN+=" into your kernel or loaded as a module to use the"
9398 - ERROR_TUN+=" virtual network device if using -net tap."
9399 - ERROR_BRIDGE="You will also need support for 802.1d"
9400 - ERROR_BRIDGE+=" Ethernet Bridging for some network configurations."
9401 - use vhost-net && CONFIG_CHECK+=" ~VHOST_NET"
9402 - ERROR_VHOST_NET="You must enable VHOST_NET to have vhost-net"
9403 - ERROR_VHOST_NET+=" support"
9404 -
9405 - if use amd64 || use x86 || use amd64-linux || use x86-linux; then
9406 - CONFIG_CHECK+=" ~KVM_AMD ~KVM_INTEL"
9407 - fi
9408 -
9409 - use python && CONFIG_CHECK+=" ~DEBUG_FS"
9410 - ERROR_DEBUG_FS="debugFS support required for kvm_stat"
9411 -
9412 - # Now do the actual checks setup above
9413 - check_extra_config
9414 - fi
9415 - fi
9416 -
9417 - if grep -qs '/usr/bin/qemu-kvm' "${EROOT}"/etc/libvirt/qemu/*.xml; then
9418 - eerror "The kvm/qemu-kvm wrappers no longer exist, but your libvirt"
9419 - eerror "instances are still pointing to it. Please update your"
9420 - eerror "configs in /etc/libvirt/qemu/ to use the -enable-kvm flag"
9421 - eerror "and the right system binary (e.g. qemu-system-x86_64)."
9422 - die "update your virt configs to not use qemu-kvm"
9423 - fi
9424 -}
9425 -
9426 -pkg_setup() {
9427 - enewgroup kvm 78
9428 -}
9429 -
9430 -# Sanity check to make sure target lists are kept up-to-date.
9431 -check_targets() {
9432 - local var=$1 mak=$2
9433 - local detected sorted
9434 -
9435 - pushd "${S}"/default-configs >/dev/null || die
9436 -
9437 - # Force C locale until glibc is updated. #564936
9438 - detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | LC_COLLATE=C sort -u))
9439 - sorted=$(echo $(printf '%s\n' ${!var} | LC_COLLATE=C sort -u))
9440 - if [[ ${sorted} != "${detected}" ]] ; then
9441 - eerror "The ebuild needs to be kept in sync."
9442 - eerror "${var}: ${sorted}"
9443 - eerror "$(printf '%-*s' ${#var} configure): ${detected}"
9444 - die "sync ${var} to the list of targets"
9445 - fi
9446 -
9447 - popd >/dev/null
9448 -}
9449 -
9450 -src_prepare() {
9451 - check_targets IUSE_SOFTMMU_TARGETS softmmu
9452 - check_targets IUSE_USER_TARGETS linux-user
9453 -
9454 - # Alter target makefiles to accept CFLAGS set via flag-o
9455 - sed -i -r \
9456 - -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \
9457 - Makefile Makefile.target || die
9458 -
9459 - # Cheap hack to disable gettext .mo generation.
9460 - use nls || rm -f po/*.po
9461 -
9462 - epatch "${FILESDIR}"/qemu-1.7.0-cflags.patch
9463 - epatch "${FILESDIR}"/${PN}-2.4-mips-* #563162
9464 - [[ -n ${BACKPORTS} ]] && \
9465 - EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \
9466 - epatch
9467 -
9468 - # Fix ld and objcopy being called directly
9469 - tc-export AR LD OBJCOPY
9470 -
9471 - # Verbose builds
9472 - MAKEOPTS+=" V=1"
9473 -
9474 - epatch_user
9475 -}
9476 -
9477 -##
9478 -# configures qemu based on the build directory and the build type
9479 -# we are using.
9480 -#
9481 -qemu_src_configure() {
9482 - debug-print-function ${FUNCNAME} "$@"
9483 -
9484 - local buildtype=$1
9485 - local builddir="${S}/${buildtype}-build"
9486 - local static_flag="static-${buildtype}"
9487 -
9488 - mkdir "${builddir}"
9489 -
9490 - local conf_opts=(
9491 - --prefix=/usr
9492 - --sysconfdir=/etc
9493 - --libdir=/usr/$(get_libdir)
9494 - --docdir=/usr/share/doc/${PF}/html
9495 - --disable-bsd-user
9496 - --disable-guest-agent
9497 - --disable-strip
9498 - --disable-werror
9499 - --python="${PYTHON}"
9500 - --cc="$(tc-getCC)"
9501 - --cxx="$(tc-getCXX)"
9502 - --host-cc="$(tc-getBUILD_CC)"
9503 - $(use_enable debug debug-info)
9504 - $(use_enable debug debug-tcg)
9505 - --enable-docs
9506 - $(use_enable tci tcg-interpreter)
9507 - $(use_enable xattr attr)
9508 - )
9509 -
9510 - # Disable options not used by user targets as the default configure
9511 - # options will autoprobe and try to link in a bunch of unused junk.
9512 - conf_softmmu() {
9513 - if [[ ${buildtype} == "user" ]] ; then
9514 - echo "--disable-${2:-$1}"
9515 - else
9516 - use_enable "$@"
9517 - fi
9518 - }
9519 - conf_opts+=(
9520 - $(conf_softmmu accessibility brlapi)
9521 - $(conf_softmmu aio linux-aio)
9522 - $(conf_softmmu bluetooth bluez)
9523 - $(conf_softmmu caps cap-ng)
9524 - $(conf_softmmu curl)
9525 - $(conf_softmmu fdt)
9526 - $(conf_softmmu glusterfs)
9527 - $(conf_softmmu gtk)
9528 - $(conf_softmmu infiniband rdma)
9529 - $(conf_softmmu iscsi libiscsi)
9530 - $(conf_softmmu jpeg vnc-jpeg)
9531 - $(conf_softmmu kernel_linux kvm)
9532 - $(conf_softmmu lzo)
9533 - $(conf_softmmu ncurses curses)
9534 - $(conf_softmmu nfs libnfs)
9535 - $(conf_softmmu numa)
9536 - $(conf_softmmu opengl)
9537 - $(conf_softmmu png vnc-png)
9538 - $(conf_softmmu rbd)
9539 - $(conf_softmmu sasl vnc-sasl)
9540 - $(conf_softmmu sdl)
9541 - $(conf_softmmu seccomp)
9542 - $(conf_softmmu smartcard smartcard-nss)
9543 - $(conf_softmmu snappy)
9544 - $(conf_softmmu spice)
9545 - $(conf_softmmu ssh libssh2)
9546 - $(conf_softmmu tls vnc-tls)
9547 - $(conf_softmmu usb libusb)
9548 - $(conf_softmmu usbredir usb-redir)
9549 - $(conf_softmmu uuid)
9550 - $(conf_softmmu vde)
9551 - $(conf_softmmu vhost-net)
9552 - $(conf_softmmu virtfs)
9553 - $(conf_softmmu vnc)
9554 - $(conf_softmmu vte)
9555 - $(conf_softmmu xen)
9556 - $(conf_softmmu xen xen-pci-passthrough)
9557 - $(conf_softmmu xfs xfsctl)
9558 - )
9559 -
9560 - case ${buildtype} in
9561 - user)
9562 - conf_opts+=(
9563 - --enable-linux-user
9564 - --disable-system
9565 - --disable-blobs
9566 - --disable-tools
9567 - )
9568 - ;;
9569 - softmmu)
9570 - # audio options
9571 - local audio_opts="oss"
9572 - use alsa && audio_opts="alsa,${audio_opts}"
9573 - use sdl && audio_opts="sdl,${audio_opts}"
9574 - use pulseaudio && audio_opts="pa,${audio_opts}"
9575 -
9576 - conf_opts+=(
9577 - --disable-linux-user
9578 - --enable-system
9579 - --with-system-pixman
9580 - --audio-drv-list="${audio_opts}"
9581 - )
9582 - use gtk && conf_opts+=( --with-gtkabi=$(usex gtk2 2.0 3.0) )
9583 - use sdl && conf_opts+=( --with-sdlabi=$(usex sdl2 2.0 1.2) )
9584 - ;;
9585 - tools)
9586 - conf_opts+=(
9587 - --disable-linux-user
9588 - --disable-system
9589 - --disable-blobs
9590 - )
9591 - static_flag="static"
9592 - ;;
9593 - esac
9594 -
9595 - local targets="${buildtype}_targets"
9596 - [[ -n ${targets} ]] && conf_opts+=( --target-list="${!targets}" )
9597 -
9598 - # Add support for SystemTAP
9599 - use systemtap && conf_opts+=( --enable-trace-backend=dtrace )
9600 -
9601 - # We always want to attempt to build with PIE support as it results
9602 - # in a more secure binary. But it doesn't work with static or if
9603 - # the current GCC doesn't have PIE support.
9604 - if use ${static_flag}; then
9605 - conf_opts+=( --static --disable-pie )
9606 - else
9607 - gcc-specs-pie && conf_opts+=( --enable-pie )
9608 - fi
9609 -
9610 - echo "../configure ${conf_opts[*]}"
9611 - cd "${builddir}"
9612 - ../configure "${conf_opts[@]}" || die "configure failed"
9613 -
9614 - # FreeBSD's kernel does not support QEMU assigning/grabbing
9615 - # host USB devices yet
9616 - use kernel_FreeBSD && \
9617 - sed -i -E -e "s|^(HOST_USB=)bsd|\1stub|" "${S}"/config-host.mak
9618 -}
9619 -
9620 -src_configure() {
9621 - local target
9622 -
9623 - python_setup
9624 -
9625 - softmmu_targets= softmmu_bins=()
9626 - user_targets= user_bins=()
9627 -
9628 - for target in ${IUSE_SOFTMMU_TARGETS} ; do
9629 - if use "qemu_softmmu_targets_${target}"; then
9630 - softmmu_targets+=",${target}-softmmu"
9631 - softmmu_bins+=( "qemu-system-${target}" )
9632 - fi
9633 - done
9634 -
9635 - for target in ${IUSE_USER_TARGETS} ; do
9636 - if use "qemu_user_targets_${target}"; then
9637 - user_targets+=",${target}-linux-user"
9638 - user_bins+=( "qemu-${target}" )
9639 - fi
9640 - done
9641 -
9642 - softmmu_targets=${softmmu_targets#,}
9643 - user_targets=${user_targets#,}
9644 -
9645 - [[ -n ${softmmu_targets} ]] && qemu_src_configure "softmmu"
9646 - [[ -n ${user_targets} ]] && qemu_src_configure "user"
9647 - [[ -z ${softmmu_targets}${user_targets} ]] && qemu_src_configure "tools"
9648 -}
9649 -
9650 -src_compile() {
9651 - if [[ -n ${user_targets} ]]; then
9652 - cd "${S}/user-build"
9653 - default
9654 - fi
9655 -
9656 - if [[ -n ${softmmu_targets} ]]; then
9657 - cd "${S}/softmmu-build"
9658 - default
9659 - fi
9660 -
9661 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
9662 - cd "${S}/tools-build"
9663 - default
9664 - fi
9665 -}
9666 -
9667 -src_test() {
9668 - if [[ -n ${softmmu_targets} ]]; then
9669 - cd "${S}/softmmu-build"
9670 - pax-mark m */qemu-system-* #515550
9671 - emake -j1 check
9672 - emake -j1 check-report.html
9673 - fi
9674 -}
9675 -
9676 -qemu_python_install() {
9677 - python_domodule "${S}/scripts/qmp/qmp.py"
9678 -
9679 - python_doscript "${S}/scripts/kvm/kvm_stat"
9680 - python_doscript "${S}/scripts/kvm/vmxcap"
9681 - python_doscript "${S}/scripts/qmp/qmp-shell"
9682 - python_doscript "${S}/scripts/qmp/qemu-ga-client"
9683 -}
9684 -
9685 -src_install() {
9686 - if [[ -n ${user_targets} ]]; then
9687 - cd "${S}/user-build"
9688 - emake DESTDIR="${ED}" install
9689 -
9690 - # Install binfmt handler init script for user targets
9691 - newinitd "${FILESDIR}/qemu-binfmt.initd-r1" qemu-binfmt
9692 - fi
9693 -
9694 - if [[ -n ${softmmu_targets} ]]; then
9695 - cd "${S}/softmmu-build"
9696 - emake DESTDIR="${ED}" install
9697 -
9698 - # This might not exist if the test failed. #512010
9699 - [[ -e check-report.html ]] && dohtml check-report.html
9700 -
9701 - if use kernel_linux; then
9702 - udev_dorules "${FILESDIR}"/65-kvm.rules
9703 - fi
9704 -
9705 - if use python; then
9706 - python_foreach_impl qemu_python_install
9707 - fi
9708 - fi
9709 -
9710 - if [[ -z ${softmmu_targets}${user_targets} ]]; then
9711 - cd "${S}/tools-build"
9712 - emake DESTDIR="${ED}" install
9713 - fi
9714 -
9715 - # Disable mprotect on the qemu binaries as they use JITs to be fast #459348
9716 - pushd "${ED}"/usr/bin >/dev/null
9717 - pax-mark m "${softmmu_bins[@]}" "${user_bins[@]}"
9718 - popd >/dev/null
9719 -
9720 - # Install config file example for qemu-bridge-helper
9721 - insinto "/etc/qemu"
9722 - doins "${FILESDIR}/bridge.conf"
9723 -
9724 - # Remove the docdir placed qmp-commands.txt
9725 - mv "${ED}/usr/share/doc/${PF}/html/qmp-commands.txt" "${S}/docs/qmp/"
9726 -
9727 - cd "${S}"
9728 - dodoc Changelog MAINTAINERS docs/specs/pci-ids.txt
9729 - newdoc pc-bios/README README.pc-bios
9730 - dodoc docs/qmp/*.txt
9731 -
9732 - if [[ -n ${softmmu_targets} ]]; then
9733 - # Remove SeaBIOS since we're using the SeaBIOS packaged one
9734 - rm "${ED}/usr/share/qemu/bios.bin"
9735 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9736 - dosym ../seabios/bios.bin /usr/share/qemu/bios.bin
9737 - fi
9738 -
9739 - # Remove vgabios since we're using the vgabios packaged one
9740 - rm "${ED}/usr/share/qemu/vgabios.bin"
9741 - rm "${ED}/usr/share/qemu/vgabios-cirrus.bin"
9742 - rm "${ED}/usr/share/qemu/vgabios-qxl.bin"
9743 - rm "${ED}/usr/share/qemu/vgabios-stdvga.bin"
9744 - rm "${ED}/usr/share/qemu/vgabios-vmware.bin"
9745 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9746 - dosym ../vgabios/vgabios.bin /usr/share/qemu/vgabios.bin
9747 - dosym ../vgabios/vgabios-cirrus.bin /usr/share/qemu/vgabios-cirrus.bin
9748 - dosym ../vgabios/vgabios-qxl.bin /usr/share/qemu/vgabios-qxl.bin
9749 - dosym ../vgabios/vgabios-stdvga.bin /usr/share/qemu/vgabios-stdvga.bin
9750 - dosym ../vgabios/vgabios-vmware.bin /usr/share/qemu/vgabios-vmware.bin
9751 - fi
9752 -
9753 - # Remove sgabios since we're using the sgabios packaged one
9754 - rm "${ED}/usr/share/qemu/sgabios.bin"
9755 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9756 - dosym ../sgabios/sgabios.bin /usr/share/qemu/sgabios.bin
9757 - fi
9758 -
9759 - # Remove iPXE since we're using the iPXE packaged one
9760 - rm "${ED}"/usr/share/qemu/pxe-*.rom
9761 - if use qemu_softmmu_targets_x86_64 || use qemu_softmmu_targets_i386; then
9762 - dosym ../ipxe/8086100e.rom /usr/share/qemu/pxe-e1000.rom
9763 - dosym ../ipxe/80861209.rom /usr/share/qemu/pxe-eepro100.rom
9764 - dosym ../ipxe/10500940.rom /usr/share/qemu/pxe-ne2k_pci.rom
9765 - dosym ../ipxe/10222000.rom /usr/share/qemu/pxe-pcnet.rom
9766 - dosym ../ipxe/10ec8139.rom /usr/share/qemu/pxe-rtl8139.rom
9767 - dosym ../ipxe/1af41000.rom /usr/share/qemu/pxe-virtio.rom
9768 - fi
9769 - fi
9770 -
9771 - qemu_support_kvm && readme.gentoo_create_doc
9772 -}
9773 -
9774 -pkg_postinst() {
9775 - if qemu_support_kvm; then
9776 - readme.gentoo_print_elog
9777 - fi
9778 -
9779 - if [[ -n ${softmmu_targets} ]] && use kernel_linux; then
9780 - udev_reload
9781 - fi
9782 -
9783 - fcaps cap_net_admin /usr/libexec/qemu-bridge-helper
9784 -}
9785 -
9786 -pkg_info() {
9787 - echo "Using:"
9788 - echo " $(best_version app-emulation/spice-protocol)"
9789 - echo " $(best_version sys-firmware/ipxe)"
9790 - echo " $(best_version sys-firmware/seabios)"
9791 - if has_version 'sys-firmware/seabios[binary]'; then
9792 - echo " USE=binary"
9793 - else
9794 - echo " USE=''"
9795 - fi
9796 - echo " $(best_version sys-firmware/vgabios)"
9797 -}