diff --git a/60-kvm.rules b/60-kvm.rules index f7bb40ef..4ee7d7cf 100644 --- a/60-kvm.rules +++ b/60-kvm.rules @@ -1,2 +1 @@ KERNEL=="kvm", MODE="0660", GROUP="kvm" -ACTION=="add|change", SUBSYSTEM=="dmi", KERNEL=="id", RUN+="/bin/sh -c 'grep -q vmx /proc/cpuinfo && /sbin/modprobe kvm-intel; grep -q svm /proc/cpuinfo && /sbin/modprobe kvm-amd'" diff --git a/60-kvm.x86.rules b/60-kvm.x86.rules new file mode 100644 index 00000000..f7bb40ef --- /dev/null +++ b/60-kvm.x86.rules @@ -0,0 +1,2 @@ +KERNEL=="kvm", MODE="0660", GROUP="kvm" +ACTION=="add|change", SUBSYSTEM=="dmi", KERNEL=="id", RUN+="/bin/sh -c 'grep -q vmx /proc/cpuinfo && /sbin/modprobe kvm-intel; grep -q svm /proc/cpuinfo && /sbin/modprobe kvm-amd'" diff --git a/qemu.changes b/qemu.changes index b32d625d..1a711dc5 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Sat May 10 20:06:24 UTC 2014 - afaerber@suse.de + +- Split 60-kvm.rules into 60-kvm.rules and 60-kvm.x86.rules +- Install udev rules on s390x, ppc and arm, too +* Clean up KVM vs. qemu-kvm conditionals +- Package qemu-system-ppcemb in qemu-ppc and qemu-system-aarch64 + in qemu-arm + ------------------------------------------------------------------- Fri Apr 18 17:55:03 UTC 2014 - afaerber@suse.de diff --git a/qemu.spec b/qemu.spec index 461cf5a5..d3df3261 100644 --- a/qemu.spec +++ b/qemu.spec @@ -26,6 +26,16 @@ %else %define build_x86_fw_from_source 0 %endif +%ifarch %ix86 x86_64 ppc ppc64 ppc64le s390x %arm aarch64 +%define kvm_available 1 +%else +%define kvm_available 0 +%endif +%ifarch %ix86 x86_64 s390x +%define legacy_qemu_kvm 1 +%else +%define legacy_qemu_kvm 0 +%endif %define noarch_supported 1110 Name: qemu @@ -42,6 +52,7 @@ Source3: kvm_stat Source4: qemu-kvm.1.gz Source5: 60-kvm.rules Source6: ksm.service +Source7: 60-kvm.x86.rules # This patch queue is auto-generated from https://github.com/openSUSE/qemu Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch Patch0002: 0002-XXX-work-around-SA_RESTART-race-wit.patch @@ -156,6 +167,14 @@ BuildRequires: systemd %{?systemd_requires} %define with_systemd 1 %endif +%if %{kvm_available} +BuildRequires: udev +%if %( echo `rpm -q --queryformat %%{version} udev` ) > 190 +%define _udevrulesdir /usr/lib/udev/rules.d +%else +%define _udevrulesdir /lib/udev/rules.d +%endif +%endif %if 0%{?sles_version} != 11 BuildRequires: usbredir-devel %endif @@ -176,14 +195,6 @@ BuildRequires: libspice-server-devel BuildRequires: spice-protocol-devel %endif %endif -%ifarch %ix86 x86_64 s390x -BuildRequires: udev -%if %( echo `rpm -q --queryformat %%{version} udev` ) > 190 -%define _udevrulesdir /usr/lib/udev/rules.d -%else -%define _udevrulesdir /lib/udev/rules.d -%endif -%endif Requires: /usr/sbin/groupadd Requires: pwdutils Requires: timezone @@ -297,7 +308,7 @@ as PC and PowerMac systems. This sub-package provides some lesser used emulations, such as moxie and xtensa. -%ifarch %ix86 x86_64 s390x +%if %{legacy_qemu_kvm} %package kvm Url: http://www.linux-kvm.org Summary: Kernel-based Virtual Machine @@ -543,6 +554,9 @@ done --enable-gtk \ %if 0%{?suse_version} >= 1220 --with-gtkabi=3.0 \ +%endif +%if %{kvm_available} + --enable-kvm \ %endif --enable-linux-aio \ --enable-modules \ @@ -594,7 +608,7 @@ make install DESTDIR=$RPM_BUILD_ROOT rm -fr $RPM_BUILD_ROOT/%_datadir/doc install -D -m 644 %{SOURCE302} $RPM_BUILD_ROOT/%{_sysconfdir}/qemu/bridge.conf %find_lang %name -%ifarch %ix86 x86_64 s390x +%if %{legacy_qemu_kvm} cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF' #!/bin/sh @@ -605,16 +619,20 @@ exec %{_bindir}/qemu-system-x86_64 -machine accel=kvm "$@" %endif EOF chmod 755 %{buildroot}%{_bindir}/qemu-kvm -%ifarch %ix86 x86_64 +install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup +install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat +install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz +%endif +%if %{kvm_available} %if 0%{?suse_version} >= 1230 install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules %else +%ifarch %ix86 x86_64 +install -D -m 644 %{SOURCE7} %{buildroot}%{_udevrulesdir}/60-kvm.rules +%else install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules %endif %endif -install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup -install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat -install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz %endif install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service %fdupes -s $RPM_BUILD_ROOT @@ -629,7 +647,7 @@ rm -rf ${RPM_BUILD_ROOT} %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \ -c "qemu user" qemu -%ifarch %ix86 x86_64 s390x +%if %{kvm_available} %post if [ "$(readlink -f /proc/1/root)" = "/" ]; then /sbin/udevadm control --reload-rules || : @@ -713,7 +731,7 @@ fi %exclude %_datadir/%name/qemu-ifup %endif %dir %_sysconfdir/%name -%ifarch %ix86 x86_64 +%if %{kvm_available} %if 0%{?suse_version} >= 1230 %{_udevrulesdir}/80-kvm.rules %else @@ -734,6 +752,7 @@ fi %defattr(-, root, root) %_bindir/qemu-system-ppc %_bindir/qemu-system-ppc64 +%_bindir/qemu-system-ppcemb %_datadir/%name/ppc_rom.bin %_datadir/%name/openbios-ppc %_datadir/%name/slof.bin @@ -750,6 +769,7 @@ fi %files arm %defattr(-, root, root) %_bindir/qemu-system-arm +%_bindir/qemu-system-aarch64 %files extra %defattr(-, root, root) @@ -758,8 +778,10 @@ fi %exclude %_bindir/qemu-system-x86_64 %exclude %_bindir/qemu-system-ppc %exclude %_bindir/qemu-system-ppc64 +%exclude %_bindir/qemu-system-ppcemb %exclude %_bindir/qemu-system-s390x %exclude %_bindir/qemu-system-arm +%exclude %_bindir/qemu-system-aarch64 %_datadir/%name/palcode-clipper %_datadir/%name/openbios-sparc32 %_datadir/%name/openbios-sparc64 @@ -767,7 +789,7 @@ fi %_datadir/%name/QEMU,cgthree.bin %_datadir/%name/QEMU,tcx.bin -%ifarch %ix86 x86_64 s390x +%if %{legacy_qemu_kvm} %files kvm %defattr(-,root,root) %_bindir/qemu-kvm diff --git a/qemu.spec.in b/qemu.spec.in index 9105c7ad..ba7c7d40 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -26,6 +26,16 @@ %else %define build_x86_fw_from_source 0 %endif +%ifarch %ix86 x86_64 ppc ppc64 ppc64le s390x %arm aarch64 +%define kvm_available 1 +%else +%define kvm_available 0 +%endif +%ifarch %ix86 x86_64 s390x +%define legacy_qemu_kvm 1 +%else +%define legacy_qemu_kvm 0 +%endif %define noarch_supported 1110 Name: qemu @@ -42,6 +52,7 @@ Source3: kvm_stat Source4: qemu-kvm.1.gz Source5: 60-kvm.rules Source6: ksm.service +Source7: 60-kvm.x86.rules # This patch queue is auto-generated from https://github.com/openSUSE/qemu PATCH_FILES # Please do not add patches manually here, run update_git.sh. @@ -113,6 +124,14 @@ BuildRequires: systemd %{?systemd_requires} %define with_systemd 1 %endif +%if %{kvm_available} +BuildRequires: udev +%if %( echo `rpm -q --queryformat %%{version} udev` ) > 190 +%define _udevrulesdir /usr/lib/udev/rules.d +%else +%define _udevrulesdir /lib/udev/rules.d +%endif +%endif %if 0%{?sles_version} != 11 BuildRequires: usbredir-devel %endif @@ -133,14 +152,6 @@ BuildRequires: libspice-server-devel BuildRequires: spice-protocol-devel %endif %endif -%ifarch %ix86 x86_64 s390x -BuildRequires: udev -%if %( echo `rpm -q --queryformat %%{version} udev` ) > 190 -%define _udevrulesdir /usr/lib/udev/rules.d -%else -%define _udevrulesdir /lib/udev/rules.d -%endif -%endif Requires: /usr/sbin/groupadd Requires: pwdutils Requires: timezone @@ -254,7 +265,7 @@ as PC and PowerMac systems. This sub-package provides some lesser used emulations, such as moxie and xtensa. -%ifarch %ix86 x86_64 s390x +%if %{legacy_qemu_kvm} %package kvm Url: http://www.linux-kvm.org Summary: Kernel-based Virtual Machine @@ -457,6 +468,9 @@ done --enable-gtk \ %if 0%{?suse_version} >= 1220 --with-gtkabi=3.0 \ +%endif +%if %{kvm_available} + --enable-kvm \ %endif --enable-linux-aio \ --enable-modules \ @@ -508,7 +522,7 @@ make install DESTDIR=$RPM_BUILD_ROOT rm -fr $RPM_BUILD_ROOT/%_datadir/doc install -D -m 644 %{SOURCE302} $RPM_BUILD_ROOT/%{_sysconfdir}/qemu/bridge.conf %find_lang %name -%ifarch %ix86 x86_64 s390x +%if %{legacy_qemu_kvm} cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF' #!/bin/sh @@ -519,16 +533,20 @@ exec %{_bindir}/qemu-system-x86_64 -machine accel=kvm "$@" %endif EOF chmod 755 %{buildroot}%{_bindir}/qemu-kvm -%ifarch %ix86 x86_64 +install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup +install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat +install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz +%endif +%if %{kvm_available} %if 0%{?suse_version} >= 1230 install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules %else +%ifarch %ix86 x86_64 +install -D -m 644 %{SOURCE7} %{buildroot}%{_udevrulesdir}/60-kvm.rules +%else install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules %endif %endif -install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup -install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat -install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz %endif install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service %fdupes -s $RPM_BUILD_ROOT @@ -543,7 +561,7 @@ rm -rf ${RPM_BUILD_ROOT} %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \ -c "qemu user" qemu -%ifarch %ix86 x86_64 s390x +%if %{kvm_available} %post if [ "$(readlink -f /proc/1/root)" = "/" ]; then /sbin/udevadm control --reload-rules || : @@ -627,7 +645,7 @@ fi %exclude %_datadir/%name/qemu-ifup %endif %dir %_sysconfdir/%name -%ifarch %ix86 x86_64 +%if %{kvm_available} %if 0%{?suse_version} >= 1230 %{_udevrulesdir}/80-kvm.rules %else @@ -648,6 +666,7 @@ fi %defattr(-, root, root) %_bindir/qemu-system-ppc %_bindir/qemu-system-ppc64 +%_bindir/qemu-system-ppcemb %_datadir/%name/ppc_rom.bin %_datadir/%name/openbios-ppc %_datadir/%name/slof.bin @@ -664,6 +683,7 @@ fi %files arm %defattr(-, root, root) %_bindir/qemu-system-arm +%_bindir/qemu-system-aarch64 %files extra %defattr(-, root, root) @@ -672,8 +692,10 @@ fi %exclude %_bindir/qemu-system-x86_64 %exclude %_bindir/qemu-system-ppc %exclude %_bindir/qemu-system-ppc64 +%exclude %_bindir/qemu-system-ppcemb %exclude %_bindir/qemu-system-s390x %exclude %_bindir/qemu-system-arm +%exclude %_bindir/qemu-system-aarch64 %_datadir/%name/palcode-clipper %_datadir/%name/openbios-sparc32 %_datadir/%name/openbios-sparc64 @@ -681,7 +703,7 @@ fi %_datadir/%name/QEMU,cgthree.bin %_datadir/%name/QEMU,tcx.bin -%ifarch %ix86 x86_64 s390x +%if %{legacy_qemu_kvm} %files kvm %defattr(-,root,root) %_bindir/qemu-kvm