Toshaan Bharvani
2 years ago
commit
d7e40cba1c
12 changed files with 1068 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||||||
|
SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", \ |
||||||
|
TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service" |
@ -0,0 +1,14 @@ |
|||||||
|
[Unit] |
||||||
|
Description=Kernel Samepage Merging |
||||||
|
ConditionPathExists=/sys/kernel/mm/ksm |
||||||
|
ConditionVirtualization=no |
||||||
|
|
||||||
|
[Service] |
||||||
|
Type=oneshot |
||||||
|
RemainAfterExit=yes |
||||||
|
EnvironmentFile=-/etc/sysconfig/ksm |
||||||
|
ExecStart=/usr/libexec/ksmctl start |
||||||
|
ExecStop=/usr/libexec/ksmctl stop |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
@ -0,0 +1,4 @@ |
|||||||
|
# The maximum number of unswappable kernel pages |
||||||
|
# which may be allocated by ksm (0 for unlimited) |
||||||
|
# If unset, defaults to half of total memory |
||||||
|
# KSM_MAX_KERNEL_PAGES= |
@ -0,0 +1,77 @@ |
|||||||
|
/* Start/stop KSM, for systemd. |
||||||
|
* Copyright (C) 2009, 2011 Red Hat, Inc. |
||||||
|
* Written by Paolo Bonzini <pbonzini@redhat.com>. |
||||||
|
* Based on the original sysvinit script by Dan Kenigsberg <danken@redhat.com> |
||||||
|
* This file is distributed under the GNU General Public License, version 2 |
||||||
|
* or later. */ |
||||||
|
|
||||||
|
#include <unistd.h> |
||||||
|
#include <stdio.h> |
||||||
|
#include <limits.h> |
||||||
|
#include <stdint.h> |
||||||
|
#include <stdlib.h> |
||||||
|
#include <string.h> |
||||||
|
|
||||||
|
#define KSM_MAX_KERNEL_PAGES_FILE "/sys/kernel/mm/ksm/max_kernel_pages" |
||||||
|
#define KSM_RUN_FILE "/sys/kernel/mm/ksm/run" |
||||||
|
|
||||||
|
char *program_name; |
||||||
|
|
||||||
|
int usage(void) |
||||||
|
{ |
||||||
|
fprintf(stderr, "Usage: %s {start|stop}\n", program_name); |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
int write_value(uint64_t value, char *filename) |
||||||
|
{ |
||||||
|
FILE *fp; |
||||||
|
if (!(fp = fopen(filename, "w")) || |
||||||
|
fprintf(fp, "%llu\n", (unsigned long long) value) == EOF || |
||||||
|
fflush(fp) == EOF || |
||||||
|
fclose(fp) == EOF) |
||||||
|
return 1; |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
uint64_t ksm_max_kernel_pages() |
||||||
|
{ |
||||||
|
char *var = getenv("KSM_MAX_KERNEL_PAGES"); |
||||||
|
char *endptr; |
||||||
|
uint64_t value; |
||||||
|
if (var && *var) { |
||||||
|
value = strtoll(var, &endptr, 0); |
||||||
|
if (value < LLONG_MAX && !*endptr) |
||||||
|
return value; |
||||||
|
} |
||||||
|
/* Unless KSM_MAX_KERNEL_PAGES is set, let KSM munch up to half of |
||||||
|
* total memory. */ |
||||||
|
return sysconf(_SC_PHYS_PAGES) / 2; |
||||||
|
} |
||||||
|
|
||||||
|
int start(void) |
||||||
|
{ |
||||||
|
if (access(KSM_MAX_KERNEL_PAGES_FILE, R_OK) >= 0) |
||||||
|
write_value(ksm_max_kernel_pages(), KSM_MAX_KERNEL_PAGES_FILE); |
||||||
|
return write_value(1, KSM_RUN_FILE); |
||||||
|
} |
||||||
|
|
||||||
|
int stop(void) |
||||||
|
{ |
||||||
|
return write_value(0, KSM_RUN_FILE); |
||||||
|
} |
||||||
|
|
||||||
|
int main(int argc, char **argv) |
||||||
|
{ |
||||||
|
program_name = argv[0]; |
||||||
|
if (argc < 2) { |
||||||
|
return usage(); |
||||||
|
} else if (!strcmp(argv[1], "start")) { |
||||||
|
return start(); |
||||||
|
} else if (!strcmp(argv[1], "stop")) { |
||||||
|
return stop(); |
||||||
|
} else { |
||||||
|
return usage(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,139 @@ |
|||||||
|
#!/bin/bash |
||||||
|
# |
||||||
|
# Copyright 2009 Red Hat, Inc. and/or its affiliates. |
||||||
|
# Released under the GPL |
||||||
|
# |
||||||
|
# Author: Dan Kenigsberg <danken@redhat.com> |
||||||
|
# |
||||||
|
# ksmtuned - a simple script that controls whether (and with what vigor) ksm |
||||||
|
# should search for duplicated pages. |
||||||
|
# |
||||||
|
# starts ksm when memory commited to qemu processes exceeds a threshold, and |
||||||
|
# make ksm work harder and harder untill memory load falls below that |
||||||
|
# threshold. |
||||||
|
# |
||||||
|
# send SIGUSR1 to this process right after a new qemu process is started, or |
||||||
|
# following its death, to retune ksm accordingly |
||||||
|
# |
||||||
|
# needs testing and ironing. contact danken@redhat.com if something breaks. |
||||||
|
|
||||||
|
if [ -f /etc/ksmtuned.conf ]; then |
||||||
|
. /etc/ksmtuned.conf |
||||||
|
fi |
||||||
|
|
||||||
|
debug() { |
||||||
|
if [ -n "$DEBUG" ]; then |
||||||
|
s="`/bin/date`: $*" |
||||||
|
[ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s" |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60} |
||||||
|
KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300} |
||||||
|
KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50} |
||||||
|
|
||||||
|
KSM_NPAGES_MIN=${KSM_NPAGES_MIN:-64} |
||||||
|
KSM_NPAGES_MAX=${KSM_NPAGES_MAX:-1250} |
||||||
|
# millisecond sleep between ksm scans for 16Gb server. Smaller servers sleep |
||||||
|
# more, bigger sleep less. |
||||||
|
KSM_SLEEP_MSEC=${KSM_SLEEP_MSEC:-10} |
||||||
|
|
||||||
|
KSM_THRES_COEF=${KSM_THRES_COEF:-20} |
||||||
|
KSM_THRES_CONST=${KSM_THRES_CONST:-2048} |
||||||
|
|
||||||
|
total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo` |
||||||
|
debug total $total |
||||||
|
|
||||||
|
npages=0 |
||||||
|
sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total] |
||||||
|
[ $sleep -le 10 ] && sleep=10 |
||||||
|
debug sleep $sleep |
||||||
|
thres=$[total * KSM_THRES_COEF / 100] |
||||||
|
if [ $KSM_THRES_CONST -gt $thres ]; then |
||||||
|
thres=$KSM_THRES_CONST |
||||||
|
fi |
||||||
|
debug thres $thres |
||||||
|
|
||||||
|
KSMCTL () { |
||||||
|
case x$1 in |
||||||
|
xstop) |
||||||
|
echo 0 > /sys/kernel/mm/ksm/run |
||||||
|
;; |
||||||
|
xstart) |
||||||
|
echo $2 > /sys/kernel/mm/ksm/pages_to_scan |
||||||
|
echo $3 > /sys/kernel/mm/ksm/sleep_millisecs |
||||||
|
echo 1 > /sys/kernel/mm/ksm/run |
||||||
|
;; |
||||||
|
esac |
||||||
|
} |
||||||
|
|
||||||
|
committed_memory () { |
||||||
|
# calculate how much memory is committed to running qemu processes |
||||||
|
local pidlist |
||||||
|
pidlist=$(pgrep -d ' ' -- '^qemu(-(kvm|system-.+)|:.{1,11})$') |
||||||
|
if [ -n "$pidlist" ]; then |
||||||
|
ps -p "$pidlist" -o rsz= |
||||||
|
fi | awk '{ sum += $1 }; END { print 0+sum }' |
||||||
|
} |
||||||
|
|
||||||
|
free_memory () { |
||||||
|
awk '/^(MemFree|Buffers|Cached):/ {free += $2}; END {print free}' \ |
||||||
|
/proc/meminfo |
||||||
|
} |
||||||
|
|
||||||
|
increase_npages() { |
||||||
|
local delta |
||||||
|
delta=${1:-0} |
||||||
|
npages=$[npages + delta] |
||||||
|
if [ $npages -lt $KSM_NPAGES_MIN ]; then |
||||||
|
npages=$KSM_NPAGES_MIN |
||||||
|
elif [ $npages -gt $KSM_NPAGES_MAX ]; then |
||||||
|
npages=$KSM_NPAGES_MAX |
||||||
|
fi |
||||||
|
echo $npages |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
adjust () { |
||||||
|
local free committed |
||||||
|
free=`free_memory` |
||||||
|
committed=`committed_memory` |
||||||
|
debug committed $committed free $free |
||||||
|
if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then |
||||||
|
KSMCTL stop |
||||||
|
debug "$[committed + thres] < $total and free > $thres, stop ksm" |
||||||
|
return 1 |
||||||
|
fi |
||||||
|
debug "$[committed + thres] > $total, start ksm" |
||||||
|
if [ $free -lt $thres ]; then |
||||||
|
npages=`increase_npages $KSM_NPAGES_BOOST` |
||||||
|
debug "$free < $thres, boost" |
||||||
|
else |
||||||
|
npages=`increase_npages $KSM_NPAGES_DECAY` |
||||||
|
debug "$free > $thres, decay" |
||||||
|
fi |
||||||
|
KSMCTL start $npages $sleep |
||||||
|
debug "KSMCTL start $npages $sleep" |
||||||
|
return 0 |
||||||
|
} |
||||||
|
|
||||||
|
function nothing () { |
||||||
|
: |
||||||
|
} |
||||||
|
|
||||||
|
loop () { |
||||||
|
trap nothing SIGUSR1 |
||||||
|
while true |
||||||
|
do |
||||||
|
sleep $KSM_MONITOR_INTERVAL & |
||||||
|
wait $! |
||||||
|
adjust |
||||||
|
done |
||||||
|
} |
||||||
|
|
||||||
|
PIDFILE=${PIDFILE-/var/run/ksmtune.pid} |
||||||
|
if touch "$PIDFILE"; then |
||||||
|
loop & |
||||||
|
echo $! > "$PIDFILE" |
||||||
|
fi |
@ -0,0 +1,21 @@ |
|||||||
|
# Configuration file for ksmtuned. |
||||||
|
|
||||||
|
# How long ksmtuned should sleep between tuning adjustments |
||||||
|
# KSM_MONITOR_INTERVAL=60 |
||||||
|
|
||||||
|
# Millisecond sleep between ksm scans for 16Gb server. |
||||||
|
# Smaller servers sleep more, bigger sleep less. |
||||||
|
# KSM_SLEEP_MSEC=10 |
||||||
|
|
||||||
|
# KSM_NPAGES_BOOST=300 |
||||||
|
# KSM_NPAGES_DECAY=-50 |
||||||
|
# KSM_NPAGES_MIN=64 |
||||||
|
# KSM_NPAGES_MAX=1250 |
||||||
|
|
||||||
|
# KSM_THRES_COEF=20 |
||||||
|
# KSM_THRES_CONST=2048 |
||||||
|
|
||||||
|
# uncomment the following if you want ksmtuned debug info |
||||||
|
|
||||||
|
# LOGFILE=/var/log/ksmtuned |
||||||
|
# DEBUG=1 |
@ -0,0 +1,13 @@ |
|||||||
|
[Unit] |
||||||
|
Description=Kernel Samepage Merging (KSM) Tuning Daemon |
||||||
|
After=ksm.service |
||||||
|
Requires=ksm.service |
||||||
|
ConditionVirtualization=no |
||||||
|
|
||||||
|
[Service] |
||||||
|
ExecStart=/usr/sbin/ksmtuned |
||||||
|
ExecReload=/bin/kill -USR1 $MAINPID |
||||||
|
Type=forking |
||||||
|
|
||||||
|
[Install] |
||||||
|
WantedBy=multi-user.target |
@ -0,0 +1,11 @@ |
|||||||
|
[Unit] |
||||||
|
Description=QEMU Guest Agent |
||||||
|
BindTo=dev-virtio\x2dports-org.qemu.guest_agent.0.device |
||||||
|
After=dev-virtio\x2dports-org.qemu.guest_agent.0.device |
||||||
|
|
||||||
|
[Service] |
||||||
|
ExecStart=-/usr/bin/qemu-ga |
||||||
|
Restart=always |
||||||
|
RestartSec=0 |
||||||
|
|
||||||
|
[Install] |
@ -0,0 +1,22 @@ |
|||||||
|
:qemu-alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-alpha: |
||||||
|
:qemu-armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb: |
||||||
|
:qemu-arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm: |
||||||
|
:qemu-cris:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x4c\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-cris: |
||||||
|
:qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386: |
||||||
|
:qemu-i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386: |
||||||
|
:qemu-m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k: |
||||||
|
:qemu-microblazeel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xab\xba:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-microblazeel: |
||||||
|
:qemu-microblaze:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xba\xab:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-microblaze: |
||||||
|
:qemu-mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el: |
||||||
|
:qemu-mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64: |
||||||
|
:qemu-mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel: |
||||||
|
:qemu-mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips: |
||||||
|
:qemu-ppc64abi32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc64abi32: |
||||||
|
:qemu-ppc64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc64: |
||||||
|
:qemu-ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc: |
||||||
|
:qemu-s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x: |
||||||
|
:qemu-sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb: |
||||||
|
:qemu-sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4: |
||||||
|
:qemu-sparc32plus:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc32plus: |
||||||
|
:qemu-sparc64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc64: |
||||||
|
:qemu-sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc: |
@ -0,0 +1,763 @@ |
|||||||
|
Name: qemu |
||||||
|
Version: 6.0.1 |
||||||
|
Release: 1%{?dist} |
||||||
|
Summary: QEMU is a FAST! processor emulator |
||||||
|
License: GPLv2+ and LGPLv2+ and BSD |
||||||
|
Group: Development/Tools |
||||||
|
URL: http://www.qemu.org/ |
||||||
|
Source0: http://download.qemu-project.org/%{name}-%{version}.tar.xz |
||||||
|
Source1: qemu.binfmt |
||||||
|
# Creates /dev/kvm |
||||||
|
Source3: 80-kvm.rules |
||||||
|
# KSM control scripts |
||||||
|
Source4: ksm.service |
||||||
|
Source5: ksm.sysconfig |
||||||
|
Source6: ksmctl.c |
||||||
|
Source7: ksmtuned.service |
||||||
|
Source8: ksmtuned |
||||||
|
Source9: ksmtuned.conf |
||||||
|
Source10: qemu-guest-agent.service |
||||||
|
Source11: 99-qemu-guest-agent.rules |
||||||
|
Source12: bridge.conf |
||||||
|
# qemu-kvm back compat wrapper |
||||||
|
#Source13: qemu-kvm-ppc64.sh |
||||||
|
BuildRequires: SDL2-devel |
||||||
|
BuildRequires: zlib-devel |
||||||
|
BuildRequires: which |
||||||
|
BuildRequires: chrpath |
||||||
|
BuildRequires: texi2html |
||||||
|
BuildRequires: gnutls-devel |
||||||
|
BuildRequires: cyrus-sasl-devel |
||||||
|
BuildRequires: libtool |
||||||
|
BuildRequires: libaio-devel |
||||||
|
BuildRequires: rsync |
||||||
|
BuildRequires: pciutils-devel |
||||||
|
BuildRequires: pulseaudio-libs-devel |
||||||
|
BuildRequires: libiscsi-devel |
||||||
|
BuildRequires: ncurses-devel |
||||||
|
BuildRequires: libattr-devel |
||||||
|
BuildRequires: usbredir-devel >= 0.5.2 |
||||||
|
BuildRequires: gperftools-devel |
||||||
|
BuildRequires: texinfo |
||||||
|
BuildRequires: perl-podlators |
||||||
|
BuildRequires: spice-protocol >= 0.12.2 |
||||||
|
BuildRequires: spice-server-devel >= 0.12.0 |
||||||
|
BuildRequires: libseccomp-devel >= 2.1.0 |
||||||
|
# For network block driver |
||||||
|
BuildRequires: libcurl-devel |
||||||
|
# For rbd block driver |
||||||
|
#BuildRequires: ceph-devel >= 0.61 |
||||||
|
# We need both because the 'stap' binary is probed for by configure |
||||||
|
BuildRequires: systemtap |
||||||
|
BuildRequires: systemtap-sdt-devel |
||||||
|
# For smartcard NSS support |
||||||
|
BuildRequires: nss-devel |
||||||
|
# For XFS discard support in raw-posix.c |
||||||
|
BuildRequires: xfsprogs-devel |
||||||
|
# For VNC JPEG support |
||||||
|
BuildRequires: libjpeg-devel |
||||||
|
# For VNC PNG support |
||||||
|
BuildRequires: libpng-devel |
||||||
|
# For uuid generation |
||||||
|
BuildRequires: libuuid-devel |
||||||
|
# For BlueZ device support |
||||||
|
BuildRequires: bluez-libs-devel |
||||||
|
# For Braille device support |
||||||
|
BuildRequires: brlapi-devel |
||||||
|
# For FDT device tree support |
||||||
|
BuildRequires: libfdt-devel |
||||||
|
# For virtfs |
||||||
|
BuildRequires: libcap-devel |
||||||
|
# Hard requirement for version >= 1.3 |
||||||
|
BuildRequires: pixman-devel |
||||||
|
# For gluster support |
||||||
|
BuildRequires: glusterfs-devel >= 3.4.0 |
||||||
|
BuildRequires: glusterfs-api-devel >= 3.4.0 |
||||||
|
# Needed for usb passthrough for qemu >= 1.5 |
||||||
|
BuildRequires: libusbx-devel |
||||||
|
# SSH block driver |
||||||
|
BuildRequires: libssh2-devel |
||||||
|
# GTK frontend |
||||||
|
BuildRequires: gtk3-devel |
||||||
|
BuildRequires: vte3-devel |
||||||
|
# GTK translations |
||||||
|
BuildRequires: gettext |
||||||
|
# RDMA migration |
||||||
|
BuildRequires: librdmacm-devel |
||||||
|
# For sanity test |
||||||
|
#BuildRequires: qemu-sanity-check-nodeps |
||||||
|
BuildRequires: kernel |
||||||
|
# For acpi compilation |
||||||
|
BuildRequires: iasl |
||||||
|
# Xen support |
||||||
|
#BuildRequires: xen-devel |
||||||
|
# memdev hostmem backend added in 2.1 |
||||||
|
BuildRequires: numactl-devel |
||||||
|
# Added in qemu 2.3 |
||||||
|
BuildRequires: bzip2-devel |
||||||
|
# Added in qemu 2.4 for opengl bits |
||||||
|
BuildRequires: libepoxy-devel |
||||||
|
BuildRequires: jemalloc-devel |
||||||
|
BuildRequires: libnfs-devel >= 1.9.3 |
||||||
|
BuildRequires: device-mapper-multipath-devel |
||||||
|
Requires: %{name}-img = %{version}-%{release} |
||||||
|
Requires: %{name}-kvm = %{version}-%{release} |
||||||
|
|
||||||
|
|
||||||
|
%description |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. QEMU has two operating modes: |
||||||
|
* Full system emulation. In this mode, QEMU emulates a full system (for |
||||||
|
example a PC), including a processor and various peripherials. It can be |
||||||
|
used to launch different Operating Systems without rebooting the PC or |
||||||
|
to debug system code. |
||||||
|
* User mode emulation. In this mode, QEMU can launch Linux processes compiled |
||||||
|
for one CPU on another CPU. |
||||||
|
As QEMU requires no host kernel patches to run, it is safe and easy to use. |
||||||
|
|
||||||
|
|
||||||
|
%package kvm |
||||||
|
Summary: QEMU metapackage for KVM support |
||||||
|
Group: Development/Tools |
||||||
|
Provides: kvm = 85 |
||||||
|
Obsoletes: kvm < 85 |
||||||
|
Requires: libseccomp >= 1.0.0 |
||||||
|
%ifarch ppc64 ppc64le |
||||||
|
Requires: %{name}-system-ppc64 = %{version}-%{release} |
||||||
|
%endif |
||||||
|
%ifarch x86_64 |
||||||
|
Requires: %{name}-system-x64 = %{version}-%{release} |
||||||
|
%endif |
||||||
|
%description kvm |
||||||
|
This is a meta-package that provides a qemu-system-<arch> package for native |
||||||
|
architectures where kvm can be enabled. |
||||||
|
|
||||||
|
|
||||||
|
%package virtiofs |
||||||
|
Summary: QEMU virtiofs daemon and tools |
||||||
|
Group: Development/Tools |
||||||
|
%description virtiofs |
||||||
|
This package provides a virtiofs daemon and command line tool |
||||||
|
|
||||||
|
|
||||||
|
%package virtiogpu |
||||||
|
Summary: QEMU virtiogpu tools |
||||||
|
Group: Development/Tools |
||||||
|
%description virtiogpu |
||||||
|
This package provides a virtiogpu command line tool |
||||||
|
|
||||||
|
|
||||||
|
%package img |
||||||
|
Summary: QEMU command line tool for manipulating disk images |
||||||
|
Group: Development/Tools |
||||||
|
%description img |
||||||
|
This package provides a command line tool for manipulating disk images |
||||||
|
|
||||||
|
|
||||||
|
%package common |
||||||
|
Summary: QEMU common files needed by all QEMU targets |
||||||
|
Group: Development/Tools |
||||||
|
Requires(post): /usr/bin/getent |
||||||
|
Requires(post): /usr/sbin/groupadd |
||||||
|
Requires(post): /usr/sbin/useradd |
||||||
|
Requires(post): systemd-units |
||||||
|
Requires(preun): systemd-units |
||||||
|
Requires(postun): systemd-units |
||||||
|
Requires: %{name}-bootloaders = %{version}-%{release} |
||||||
|
%description common |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the common files needed by all QEMU targets |
||||||
|
|
||||||
|
|
||||||
|
%package guest-agent |
||||||
|
Summary: QEMU guest agent |
||||||
|
Group: System Environment/Daemons |
||||||
|
Requires(post): systemd-units |
||||||
|
Requires(preun): systemd-units |
||||||
|
Requires(postun): systemd-units |
||||||
|
%description guest-agent |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides an agent to run inside guests, which communicates |
||||||
|
with the host over a virtio-serial channel named "org.qemu.guest_agent.0" |
||||||
|
This package does not need to be installed on the host OS. |
||||||
|
|
||||||
|
|
||||||
|
%package -n ksm |
||||||
|
Summary: Kernel Samepage Merging services |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
Requires(post): systemd-units |
||||||
|
Requires(postun): systemd-units |
||||||
|
%description -n ksm |
||||||
|
Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, |
||||||
|
that merges anonymous (private) pages (not pagecache ones). |
||||||
|
This package provides service files for disabling and tuning KSM. |
||||||
|
|
||||||
|
|
||||||
|
%package system-x64 |
||||||
|
Summary: QEMU system emulator for x86_64 |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-x64 |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for x86_64 or amd64. |
||||||
|
|
||||||
|
|
||||||
|
%package system-alpha |
||||||
|
Summary: QEMU system emulator for Alpha |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-alpha |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for Alpha systems. |
||||||
|
|
||||||
|
|
||||||
|
%package system-arm |
||||||
|
Summary: QEMU system emulator for ARM |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-arm |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for ARM boards. |
||||||
|
|
||||||
|
|
||||||
|
%package system-mips64 |
||||||
|
Summary: QEMU system emulator for MIPS |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-mips64 |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for MIPS64 boards. |
||||||
|
|
||||||
|
|
||||||
|
%package system-s390x |
||||||
|
Summary: QEMU system emulator for S390X |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-s390x |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for S390X systems. |
||||||
|
|
||||||
|
|
||||||
|
%package system-sparc64 |
||||||
|
Summary: QEMU system emulator for SPARC |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-sparc64 |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for SPARC64 systems. |
||||||
|
|
||||||
|
|
||||||
|
%package system-ppc64 |
||||||
|
Summary: QEMU system emulator for PPC |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-ppc64 |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for PPC64 systems. |
||||||
|
|
||||||
|
|
||||||
|
%package system-riscv64 |
||||||
|
Summary: QEMU system emulator for RISC-V |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-riscv64 |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for RISC-V systems. |
||||||
|
|
||||||
|
|
||||||
|
%package system-aarch64 |
||||||
|
Summary: QEMU system emulator for AArch64 |
||||||
|
Group: Development/Tools |
||||||
|
Requires: %{name}-common = %{version}-%{release} |
||||||
|
%description system-aarch64 |
||||||
|
QEMU is a generic and open source processor emulator which achieves a good |
||||||
|
emulation speed by using dynamic translation. |
||||||
|
This package provides the system emulator for AArch64. |
||||||
|
|
||||||
|
|
||||||
|
#%package kvm-tools |
||||||
|
#Summary: KVM debugging and diagnostics tools |
||||||
|
#Group: Development/Tools |
||||||
|
#%description kvm-tools |
||||||
|
#This package contains some diagnostics and debugging tools for KVM, |
||||||
|
#such as kvm_stat. |
||||||
|
|
||||||
|
|
||||||
|
#%package -n ivshmem-tools |
||||||
|
#Summary: Client and server for QEMU ivshmem device |
||||||
|
#Group: Development/Tools |
||||||
|
#%description -n ivshmem-tools |
||||||
|
#This package provides client and server tools for QEMU's ivshmem device. |
||||||
|
|
||||||
|
|
||||||
|
%package bootloaders |
||||||
|
Summary: Bootloaders for QEMU |
||||||
|
Group: Development/Tools |
||||||
|
# x64 / ppc64 |
||||||
|
Requires: seabios-bin >= 1.7.5 |
||||||
|
Requires: seavgabios-bin >= 1.7.5 |
||||||
|
Requires: sgabios-bin |
||||||
|
#Requires: ipxe-roms-qemu |
||||||
|
# sparc64 |
||||||
|
#Requires: openbios |
||||||
|
# ppc64 |
||||||
|
#Requires: openbios |
||||||
|
Requires: SLOF-bin |
||||||
|
%description bootloaders |
||||||
|
This package provides the bootloader images for QEMU and stubs |
||||||
|
|
||||||
|
|
||||||
|
%prep |
||||||
|
%setup -q -n qemu-%{version} |
||||||
|
%autopatch -p1 |
||||||
|
|
||||||
|
|
||||||
|
%build |
||||||
|
# we do it all in the install |
||||||
|
|
||||||
|
|
||||||
|
%install |
||||||
|
|
||||||
|
#%global optflags %(echo %{optflags} | sed 's/-Wp,-D_FORTIFY_SOURCE=2//') |
||||||
|
extraldflags="-Wl,--build-id"; |
||||||
|
buildldflags="VL_LDFLAGS=-Wl,--build-id" |
||||||
|
tracebackends="dtrace" |
||||||
|
%ifarch ppc64 |
||||||
|
cflags="-m64 -O3 -g -fsigned-char -fno-strength-reduce -mcpu=power8 -mtune=power8 -mpower8-fusion -mpower8-vector -mcrypto -mquad-memory -mquad-memory-atomic -maltivec -mpowerpc-gpopt -mpowerpc-gfxopt -mcrypto -mvsx -mdirect-move -fPIC -fPIE -DPIE -D_FORTIFY_SOURCE=2" |
||||||
|
nativebuildarch="ppc64-softmmu" |
||||||
|
emulatedbuildarch="x86_64-softmmu s390x-softmmu sparc64-softmmu aarch64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu" |
||||||
|
%endif |
||||||
|
%ifarch ppc64le |
||||||
|
cflags="-m64 -O3 -g -fsigned-char -fno-strength-reduce -mcpu=power8 -mtune=power8 -mpower8-fusion -mpower8-vector -mcrypto -maltivec -mpowerpc-gpopt -mpowerpc-gfxopt -mcrypto -mvsx -mdirect-move -fPIC -fPIE -DPIE -D_FORTIFY_SOURCE=2" |
||||||
|
nativebuildarch="ppc64-softmmu" |
||||||
|
emulatedbuildarch="x86_64-softmmu s390x-softmmu sparc64-softmmu aarch64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu" |
||||||
|
%endif |
||||||
|
%ifarch x86_64 |
||||||
|
cflags="-m64 -O3 -g -march=core2 -mtune=core2 -mmmx -msse -msse2 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -fPIC -fPIE -DPIE -D_FORTIFY_SOURCE=2" |
||||||
|
nativebuildarch="x86_64-softmmu" |
||||||
|
emulatedbuildarch="ppc64-softmmu s390x-softmmu sparc64-softmmu aarch64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu" |
||||||
|
%endif |
||||||
|
%ifarch aarch64 |
||||||
|
nativebuildarch="aarch64-softmmu" |
||||||
|
emulatedbuildarch="ppc64-softmmu s390x-softmmu sparc64-softmmu x86_64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu" |
||||||
|
%endif |
||||||
|
|
||||||
|
# native build |
||||||
|
./configure \ |
||||||
|
--prefix=%{_prefix} --libdir=%{_libdir} --sysconfdir=%{_sysconfdir} --interp-prefix=%{_prefix}/qemu-%%M \ |
||||||
|
--localstatedir=%{_localstatedir} --libexecdir=%{_libexecdir} --with-pkgversion=%{name}-%{version}-%{release} \ |
||||||
|
--disable-strip --enable-pie --enable-numa --disable-werror --disable-xen --enable-curl --enable-jemalloc \ |
||||||
|
--enable-glusterfs --enable-libiscsi --enable-virtfs --enable-rdma --enable-pvrdma --enable-replication --enable-libssh \ |
||||||
|
--enable-tpm --enable-smartcard --enable-lzo --enable-bzip2 --enable-zstd --enable-libusb --enable-usb-redir --enable-libnfs \ |
||||||
|
--disable-gtk --disable-vte --disable-brlapi --enable-live-block-migration --enable-mpath --enable-membarrier --enable-libpmem \ |
||||||
|
--enable-attr --enable-nettle --enable-vhost-scsi --enable-vhost-net --enable-vhost-vsock --enable-vhost-crypto --enable-crypto-afalg \ |
||||||
|
--enable-xfsctl --enable-linux-aio --enable-vvfat --enable-coroutine-pool --enable-cap-ng --enable-opengl --enable-vhost-vdpa \ |
||||||
|
%ifarch x86_64 |
||||||
|
--enable-virglrenderer --enable-avx2 \ |
||||||
|
%endif |
||||||
|
--enable-vhost-kernel --enable-debug-info --enable-slirp=system --enable-pvrdma --enable-dmg \ |
||||||
|
--enable-curses --enable-vnc --enable-vnc-sasl --enable-vnc-png --enable-curl --enable-fdt \ |
||||||
|
--audio-drv-list=pa,sdl,alsa,oss --enable-trace-backend=$tracebackends \ |
||||||
|
--block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,gluster,rdb,blkdebug,luks,null-co,https,ssh \ |
||||||
|
--block-drv-ro-whitelist=vmdk,vhdx,vpc \ |
||||||
|
--extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \ |
||||||
|
--extra-cflags="$cflags -Wall" \ |
||||||
|
--target-list="$nativebuildarch" --enable-kvm --enable-tcg --enable-tcg-interpreter --enable-spice --enable-hax \ |
||||||
|
"$@" |
||||||
|
make V=1 %{?_smp_mflags} $buildldflags |
||||||
|
make DESTDIR=%{buildroot} install |
||||||
|
|
||||||
|
# other archs |
||||||
|
./configure \ |
||||||
|
--prefix=%{_prefix} --libdir=%{_libdir} --sysconfdir=%{_sysconfdir} --interp-prefix=%{_prefix}/qemu-%%M \ |
||||||
|
--localstatedir=%{_localstatedir} --libexecdir=%{_libexecdir} --with-pkgversion=%{name}-%{version}-%{release} \ |
||||||
|
--disable-strip --enable-pie --enable-numa --disable-werror --disable-xen --enable-curl --enable-jemalloc \ |
||||||
|
--enable-glusterfs --enable-libiscsi --enable-virtfs --enable-rdma --enable-pvrdma --enable-replication --enable-libssh \ |
||||||
|
--enable-tpm --enable-smartcard --enable-lzo --enable-bzip2 --enable-zstd --enable-libusb --enable-usb-redir --enable-libnfs \ |
||||||
|
--disable-gtk --disable-vte --disable-brlapi --enable-live-block-migration --enable-mpath --enable-membarrier \ |
||||||
|
--enable-attr --enable-nettle --enable-vhost-scsi --enable-vhost-net --enable-vhost-vsock --enable-vhost-crypto --enable-crypto-afalg \ |
||||||
|
--enable-xfsctl --enable-linux-aio --enable-vvfat --enable-coroutine-pool --enable-cap-ng --enable-opengl \ |
||||||
|
--enable-vhost-kernel --enable-debug-info --enable-slirp=system --enable-pvrdma --enable-dmg \ |
||||||
|
--enable-curses --enable-vnc --enable-vnc-sasl --enable-vnc-png --enable-curl --enable-fdt \ |
||||||
|
--audio-drv-list=pa,sdl,alsa,oss --enable-trace-backend=$tracebackends \ |
||||||
|
--block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,gluster,rdb,blkdebug,luks,null-co,https,ssh \ |
||||||
|
--block-drv-ro-whitelist=vmdk,vhdx,vpc \ |
||||||
|
--extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \ |
||||||
|
--extra-cflags="$cflags -Wall" \ |
||||||
|
--target-list="$emulatedbuildarch" --enable-kvm --enable-tcg --enable-tcg-interpreter --enable-spice --enable-hax \ |
||||||
|
"$@" |
||||||
|
make V=1 %{?_smp_mflags} $buildldflags |
||||||
|
make DESTDIR=%{buildroot} install |
||||||
|
|
||||||
|
#echo "config-host.mak contents:" |
||||||
|
#echo "===" |
||||||
|
#cat config-host.mak |
||||||
|
#echo "===" |
||||||
|
|
||||||
|
gcc %{_sourcedir}/ksmctl.c $cflags -o ksmctl |
||||||
|
|
||||||
|
### |
||||||
|
|
||||||
|
%define _udevdir /lib/udev/rules.d |
||||||
|
%define qemudocdir %{_docdir}/%{name} |
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{_udevdir} |
||||||
|
mkdir -p %{buildroot}%{_unitdir} |
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/qemu |
||||||
|
|
||||||
|
install -D -p -m 0644 %{_sourcedir}/ksm.service %{buildroot}%{_unitdir} |
||||||
|
install -D -p -m 0644 %{_sourcedir}/ksm.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/ksm |
||||||
|
install -D -p -m 0755 ksmctl %{buildroot}%{_libexecdir}/ksmctl |
||||||
|
|
||||||
|
install -D -p -m 0644 %{_sourcedir}/ksmtuned.service %{buildroot}%{_unitdir} |
||||||
|
install -D -p -m 0755 %{_sourcedir}/ksmtuned %{buildroot}%{_sbindir}/ksmtuned |
||||||
|
install -D -p -m 0644 %{_sourcedir}/ksmtuned.conf %{buildroot}%{_sysconfdir}/ksmtuned.conf |
||||||
|
|
||||||
|
# Install qemu-guest-agent service and udev rules |
||||||
|
install -m 0644 %{_sourcedir}/qemu-guest-agent.service %{buildroot}%{_unitdir} |
||||||
|
install -m 0644 %{_sourcedir}/99-qemu-guest-agent.rules %{buildroot}%{_udevdir} |
||||||
|
|
||||||
|
# Install kvm specific bits |
||||||
|
mkdir -p %{buildroot}%{_bindir}/ |
||||||
|
#install -m 0755 scripts/kvm/kvm_stat %{buildroot}%{_bindir}/ |
||||||
|
install -m 0644 %{_sourcedir}/80-kvm.rules %{buildroot}%{_udevdir} |
||||||
|
|
||||||
|
#%find_lang %{name} |
||||||
|
|
||||||
|
install -D -p -m 0644 qemu.sasl %{buildroot}%{_sysconfdir}/sasl2/qemu.conf |
||||||
|
|
||||||
|
# Provided by package openbios |
||||||
|
#rm -rf %{buildroot}%{_datadir}/%{name}/openbios-ppc |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/openbios-sparc32 |
||||||
|
#rm -rf %{buildroot}%{_datadir}/%{name}/openbios-sparc64 |
||||||
|
# Provided by package SLOF |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/slof.bin |
||||||
|
# Provided by package ipxe |
||||||
|
#rm -rf %{buildroot}%{_datadir}/%{name}/pxe*rom |
||||||
|
#rm -rf %{buildroot}%{_datadir}/%{name}/efi*rom |
||||||
|
# Provided by package seavgabios |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/vgabios-*bin |
||||||
|
# Provided by package seabios |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/bios.bin |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/bios-256k.bin |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/acpi-dsdt.aml |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/q35-acpi-dsdt.aml |
||||||
|
# Provided by package sgabios |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/sgabios.bin |
||||||
|
#rm -rf %{buildroot}%{_datadir}/%{name}/palcode-clipper |
||||||
|
# microblaze firmwares we do not need |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/petalogix-ml605.dtb |
||||||
|
rm -rf %{buildroot}%{_datadir}/%{name}/petalogix-s3adsp1800.dtb |
||||||
|
|
||||||
|
# Install binfmt |
||||||
|
#mkdir -p %{buildroot}%{_exec_prefix}/lib/binfmt.d |
||||||
|
#for i in dummy \ |
||||||
|
#%ifnarch %{ix86} x86_64 |
||||||
|
# qemu-x86_64 \ |
||||||
|
#%endif |
||||||
|
#%ifnarch alpha |
||||||
|
# qemu-alpha \ |
||||||
|
#%endif |
||||||
|
#%ifnarch %{arm} |
||||||
|
# qemu-arm \ |
||||||
|
#%endif |
||||||
|
# qemu-armeb \ |
||||||
|
# qemu-cris \ |
||||||
|
# qemu-microblaze qemu-microblazeel \ |
||||||
|
#%ifnarch mips |
||||||
|
# qemu-mips qemu-mips64 \ |
||||||
|
#%endif |
||||||
|
#%ifnarch mipsel |
||||||
|
# qemu-mipsel qemu-mips64el \ |
||||||
|
#%endif |
||||||
|
#%ifnarch m68k |
||||||
|
# qemu-m68k \ |
||||||
|
#%endif |
||||||
|
#%ifnarch ppc ppc64 ppc64le |
||||||
|
# qemu-ppc qemu-ppc64abi32 qemu-ppc64 \ |
||||||
|
#%endif |
||||||
|
#%ifnarch sparc sparc64 |
||||||
|
# qemu-sparc qemu-sparc32plus qemu-sparc64 \ |
||||||
|
#%endif |
||||||
|
#%ifnarch s390 s390x |
||||||
|
# qemu-s390x \ |
||||||
|
#%endif |
||||||
|
#%ifnarch sh4 |
||||||
|
# qemu-sh4 \ |
||||||
|
#%endif |
||||||
|
# qemu-sh4eb \ |
||||||
|
#; do |
||||||
|
# test $i = dummy && continue |
||||||
|
# grep /$i:\$ %{_sourcedir}/qemu.binfmt > %{buildroot}%{_exec_prefix}/lib/binfmt.d/$i.conf |
||||||
|
# chmod 644 %{buildroot}%{_exec_prefix}/lib/binfmt.d/$i.conf |
||||||
|
#done < %{_sourcedir}/qemu.binfmt |
||||||
|
|
||||||
|
|
||||||
|
# Install rules to use the bridge helper with libvirt's virbr0 |
||||||
|
install -m 0644 %{_sourcedir}/bridge.conf %{buildroot}%{_sysconfdir}/qemu |
||||||
|
|
||||||
|
# override specific architecture as default qemu |
||||||
|
%ifarch ppc64 ppc64le |
||||||
|
%define qemu_system_exec_arch ppc64 |
||||||
|
%endif |
||||||
|
%ifarch x86_64 |
||||||
|
%define qemu_system_exec_arch x86_64 |
||||||
|
%endif |
||||||
|
cat << EOF > $RPM_BUILD_ROOT%{_bindir}/qemu-kvm |
||||||
|
#!/bin/sh |
||||||
|
|
||||||
|
exec /usr/bin/qemu-system-%{qemu_system_exec_arch} -machine accel=kvm "\$@" |
||||||
|
EOF |
||||||
|
chmod +x $RPM_BUILD_ROOT%{_bindir}/qemu-kvm |
||||||
|
|
||||||
|
# When building using 'rpmbuild' or 'fedpkg local', RPATHs can be left in |
||||||
|
# the binaries and libraries (although this doesn't occur when |
||||||
|
# building in Koji, for some unknown reason). Some discussion here: |
||||||
|
# |
||||||
|
# https://lists.fedoraproject.org/pipermail/devel/2013-November/192553.html |
||||||
|
# |
||||||
|
# In any case it should always be safe to remove RPATHs from |
||||||
|
# the final binaries: |
||||||
|
for f in %{buildroot}%{_bindir}/* %{buildroot}%{_libdir}/* \ |
||||||
|
%{buildroot}%{_libexecdir}/*; do |
||||||
|
if file $f | grep -q ELF; then chrpath --delete $f; fi |
||||||
|
done |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%post kvm |
||||||
|
# Default /dev/kvm permissions are 660, we install a udev rule changing that |
||||||
|
# to 666. However trying to trigger the re-permissioning via udev has been |
||||||
|
# a neverending source of trouble, so we just force it with chmod. For |
||||||
|
# more info see: https://bugzilla.redhat.com/show_bug.cgi?id=950436 |
||||||
|
chmod --quiet 666 /dev/kvm || : |
||||||
|
|
||||||
|
|
||||||
|
%post common |
||||||
|
getent group kvm >/dev/null || groupadd -g 36 -r kvm |
||||||
|
getent group qemu >/dev/null || groupadd -g 107 -r qemu |
||||||
|
getent passwd qemu >/dev/null || \ |
||||||
|
useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \ |
||||||
|
-c "qemu user" qemu |
||||||
|
|
||||||
|
|
||||||
|
%post -n ksm |
||||||
|
%systemd_post ksm.service |
||||||
|
%systemd_post ksmtuned.service |
||||||
|
%preun -n ksm |
||||||
|
%systemd_preun ksm.service |
||||||
|
%systemd_preun ksmtuned.service |
||||||
|
%postun -n ksm |
||||||
|
%systemd_postun_with_restart ksm.service |
||||||
|
%systemd_postun_with_restart ksmtuned.service |
||||||
|
|
||||||
|
|
||||||
|
%post guest-agent |
||||||
|
%systemd_post qemu-guest-agent.service |
||||||
|
%preun guest-agent |
||||||
|
%systemd_preun qemu-guest-agent.service |
||||||
|
%postun guest-agent |
||||||
|
%systemd_postun_with_restart qemu-guest-agent.service |
||||||
|
|
||||||
|
|
||||||
|
%files |
||||||
|
|
||||||
|
|
||||||
|
%files kvm |
||||||
|
%{_bindir}/qemu-kvm |
||||||
|
%{_udevdir}/80-kvm.rules |
||||||
|
|
||||||
|
|
||||||
|
#%files common -f %{name}.lang |
||||||
|
%files common |
||||||
|
%{_bindir}/qemu-edid |
||||||
|
%{_bindir}/qemu-keymap |
||||||
|
%{_bindir}/qemu-pr-helper |
||||||
|
%{_bindir}/qemu-trace-stap |
||||||
|
%{_bindir}/elf2dmp |
||||||
|
%dir %{_datadir}/%{name}/ |
||||||
|
#%{_datadir}/%{name}/qemu-icon.bmp |
||||||
|
#%{_datadir}/%{name}/qemu_logo_no_text.svg |
||||||
|
%{_datadir}/%{name}/keymaps/ |
||||||
|
%{_datadir}/%{name}/trace-events-all |
||||||
|
%{_libexecdir}/virtfs-proxy-helper |
||||||
|
%attr(4755, root, root) %{_libexecdir}/qemu-bridge-helper |
||||||
|
%config(noreplace) %{_sysconfdir}/sasl2/qemu.conf |
||||||
|
%dir %{_sysconfdir}/qemu |
||||||
|
%config(noreplace) %{_sysconfdir}/qemu/bridge.conf |
||||||
|
%{_datadir}/icons/hicolor/*/apps/qemu.* |
||||||
|
%{_datadir}/applications/qemu.desktop |
||||||
|
%{_datadir}/%{name}/qemu-nsis.bmp |
||||||
|
|
||||||
|
|
||||||
|
%files -n ksm |
||||||
|
%{_libexecdir}/ksmctl |
||||||
|
%{_sbindir}/ksmtuned |
||||||
|
%{_unitdir}/ksmtuned.service |
||||||
|
%{_unitdir}/ksm.service |
||||||
|
%config(noreplace) %{_sysconfdir}/ksmtuned.conf |
||||||
|
%config(noreplace) %{_sysconfdir}/sysconfig/ksm |
||||||
|
|
||||||
|
|
||||||
|
%files virtiofs |
||||||
|
%{_bindir}/qemu-storage-daemon |
||||||
|
%{_libexecdir}/virtiofsd |
||||||
|
%{_datadir}/%{name}/vhost-user/50-qemu-virtiofsd.json |
||||||
|
|
||||||
|
|
||||||
|
%files virtiogpu |
||||||
|
%ifarch x86_64 |
||||||
|
%{_libexecdir}/vhost-user-gpu |
||||||
|
%{_datadir}/%{name}/vhost-user/50-qemu-gpu.json |
||||||
|
%endif |
||||||
|
|
||||||
|
|
||||||
|
%files guest-agent |
||||||
|
%doc COPYING |
||||||
|
%{_bindir}/qemu-ga |
||||||
|
%{_unitdir}/qemu-guest-agent.service |
||||||
|
%{_udevdir}/99-qemu-guest-agent.rules |
||||||
|
|
||||||
|
|
||||||
|
%files img |
||||||
|
%{_bindir}/qemu-img |
||||||
|
%{_bindir}/qemu-io |
||||||
|
%{_bindir}/qemu-nbd |
||||||
|
|
||||||
|
|
||||||
|
#%files -n ivshmem-tools |
||||||
|
#%{_bindir}/ivshmem-client |
||||||
|
#%{_bindir}/ivshmem-server |
||||||
|
|
||||||
|
|
||||||
|
%files bootloaders |
||||||
|
#%{_datadir}/%{name}/acpi-dsdt.aml |
||||||
|
#%{_datadir}/%{name}/q35-acpi-dsdt.aml |
||||||
|
#%{_datadir}/%{name}/bios.bin |
||||||
|
#%{_datadir}/%{name}/bios-256k.bin |
||||||
|
#%{_datadir}/%{name}/sgabios.bin |
||||||
|
%{_datadir}/%{name}/linuxboot.bin |
||||||
|
%{_datadir}/%{name}/linuxboot_dma.bin |
||||||
|
%{_datadir}/%{name}/multiboot.bin |
||||||
|
%{_datadir}/%{name}/bios-microvm.bin |
||||||
|
%{_datadir}/%{name}/kvmvapic.bin |
||||||
|
%{_datadir}/%{name}/vgabios.bin |
||||||
|
%{_datadir}/%{name}/qemu_vga.ndrv |
||||||
|
#%{_datadir}/%{name}/vgabios-cirrus.bin |
||||||
|
#%{_datadir}/%{name}/vgabios-qxl.bin |
||||||
|
#%{_datadir}/%{name}/vgabios-stdvga.bin |
||||||
|
#%{_datadir}/%{name}/vgabios-vmware.bin |
||||||
|
#%{_datadir}/%{name}/vgabios-virtio.bin |
||||||
|
%{_datadir}/%{name}/pxe-e1000.rom |
||||||
|
%{_datadir}/%{name}/efi-e1000.rom |
||||||
|
%{_datadir}/%{name}/efi-e1000e.rom |
||||||
|
%{_datadir}/%{name}/pxe-virtio.rom |
||||||
|
%{_datadir}/%{name}/efi-virtio.rom |
||||||
|
%{_datadir}/%{name}/pxe-pcnet.rom |
||||||
|
%{_datadir}/%{name}/efi-pcnet.rom |
||||||
|
%{_datadir}/%{name}/pxe-rtl8139.rom |
||||||
|
%{_datadir}/%{name}/efi-rtl8139.rom |
||||||
|
%{_datadir}/%{name}/pxe-ne2k_pci.rom |
||||||
|
%{_datadir}/%{name}/efi-ne2k_pci.rom |
||||||
|
%{_datadir}/%{name}/palcode-clipper |
||||||
|
%{_datadir}/%{name}/bamboo.dtb |
||||||
|
%{_datadir}/%{name}/canyonlands.dtb |
||||||
|
#%{_datadir}/%{name}/ppc_rom.bin |
||||||
|
#%{_datadir}/%{name}/spapr-rtas.bin |
||||||
|
%{_datadir}/%{name}/u-boot.e500 |
||||||
|
%{_datadir}/%{name}/efi-eepro100.rom |
||||||
|
%{_datadir}/%{name}/efi-vmxnet3.rom |
||||||
|
#%{_datadir}/%{name}/slof.bin |
||||||
|
%{_datadir}/%{name}/openbios-ppc |
||||||
|
%{_datadir}/%{name}/skiboot.lid |
||||||
|
%{_datadir}/%{name}/pxe-eepro100.rom |
||||||
|
%{_datadir}/%{name}/hppa-firmware.img |
||||||
|
%{_datadir}/%{name}/u-boot-sam460-20100605.bin |
||||||
|
%{_datadir}/%{name}/pvh.bin |
||||||
|
%{_datadir}/%{name}/edk2-aarch64-code.fd |
||||||
|
%{_datadir}/%{name}/edk2-arm-code.fd |
||||||
|
%{_datadir}/%{name}/edk2-arm-vars.fd |
||||||
|
%{_datadir}/%{name}/edk2-i386-code.fd |
||||||
|
%{_datadir}/%{name}/edk2-i386-secure-code.fd |
||||||
|
%{_datadir}/%{name}/edk2-i386-vars.fd |
||||||
|
%{_datadir}/%{name}/edk2-licenses.txt |
||||||
|
%{_datadir}/%{name}/edk2-x86_64-code.fd |
||||||
|
%{_datadir}/%{name}/edk2-x86_64-secure-code.fd |
||||||
|
%{_datadir}/%{name}/firmware/50-edk2-i386-secure.json |
||||||
|
%{_datadir}/%{name}/firmware/50-edk2-x86_64-secure.json |
||||||
|
%{_datadir}/%{name}/firmware/60-edk2-aarch64.json |
||||||
|
%{_datadir}/%{name}/firmware/60-edk2-arm.json |
||||||
|
%{_datadir}/%{name}/firmware/60-edk2-i386.json |
||||||
|
%{_datadir}/%{name}/firmware/60-edk2-x86_64.json |
||||||
|
%{_datadir}/%{name}/opensbi-riscv32-generic-fw_dynamic.bin |
||||||
|
%{_datadir}/%{name}/opensbi-riscv32-generic-fw_dynamic.elf |
||||||
|
%{_datadir}/%{name}/opensbi-riscv64-generic-fw_dynamic.bin |
||||||
|
%{_datadir}/%{name}/opensbi-riscv64-generic-fw_dynamic.elf |
||||||
|
%{_datadir}/%{name}/qboot.rom |
||||||
|
%{_datadir}/%{name}/npcm7xx_bootrom.bin |
||||||
|
|
||||||
|
|
||||||
|
%files system-x64 |
||||||
|
%{_bindir}/qemu-system-x86_64 |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-x86_64*.stp |
||||||
|
|
||||||
|
|
||||||
|
%files system-alpha |
||||||
|
%{_bindir}/qemu-system-alpha |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-alpha*.stp |
||||||
|
|
||||||
|
|
||||||
|
%files system-arm |
||||||
|
%{_bindir}/qemu-system-arm |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-arm*.stp |
||||||
|
|
||||||
|
|
||||||
|
%files system-mips64 |
||||||
|
%{_bindir}/qemu-system-mips64 |
||||||
|
%{_bindir}/qemu-system-mips64el |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-mips*.stp |
||||||
|
|
||||||
|
|
||||||
|
%files system-s390x |
||||||
|
%{_bindir}/qemu-system-s390x |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-s390x*.stp |
||||||
|
#%{_datadir}/%{name}/s390-zipl.rom |
||||||
|
%{_datadir}/%{name}/s390-ccw.img |
||||||
|
%{_datadir}/%{name}/s390-netboot.img |
||||||
|
|
||||||
|
|
||||||
|
%files system-sparc64 |
||||||
|
%{_bindir}/qemu-system-sparc64 |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-sparc*.stp |
||||||
|
%{_datadir}/%{name}/QEMU,tcx.bin |
||||||
|
%{_datadir}/%{name}/QEMU,cgthree.bin |
||||||
|
%{_datadir}/%{name}/openbios-sparc64 |
||||||
|
|
||||||
|
|
||||||
|
%files system-ppc64 |
||||||
|
%{_bindir}/qemu-system-ppc64 |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-ppc64*.stp |
||||||
|
|
||||||
|
|
||||||
|
%files system-riscv64 |
||||||
|
%{_bindir}/qemu-system-riscv64 |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-riscv64*.stp |
||||||
|
|
||||||
|
|
||||||
|
%files system-aarch64 |
||||||
|
%{_bindir}/qemu-system-aarch64 |
||||||
|
%{_datadir}/systemtap/tapset/qemu-system-aarch64*.stp |
||||||
|
|
||||||
|
|
||||||
|
%changelog |
Loading…
Reference in new issue