SHA256
1
0
forked from pool/qemu

Accepting request 233675 from home:a_faerber:branches:Virtualization

Make udev rules available beyond x86 and clarify KVM vs. qemu-kvm conditionals. Also package ppcemb and aarch64 correctly.

OBS-URL: https://build.opensuse.org/request/show/233675
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=207
This commit is contained in:
Alexander Graf 2014-05-13 08:09:26 +00:00 committed by Git OBS Bridge
parent 2f37328663
commit e3074d891d
5 changed files with 89 additions and 35 deletions

View File

@ -1,2 +1 @@
KERNEL=="kvm", MODE="0660", GROUP="kvm" 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'"

2
60-kvm.x86.rules Normal file
View File

@ -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'"

View File

@ -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 Fri Apr 18 17:55:03 UTC 2014 - afaerber@suse.de

View File

@ -26,6 +26,16 @@
%else %else
%define build_x86_fw_from_source 0 %define build_x86_fw_from_source 0
%endif %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 %define noarch_supported 1110
Name: qemu Name: qemu
@ -42,6 +52,7 @@ Source3: kvm_stat
Source4: qemu-kvm.1.gz Source4: qemu-kvm.1.gz
Source5: 60-kvm.rules Source5: 60-kvm.rules
Source6: ksm.service Source6: ksm.service
Source7: 60-kvm.x86.rules
# This patch queue is auto-generated from https://github.com/openSUSE/qemu # This patch queue is auto-generated from https://github.com/openSUSE/qemu
Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch
Patch0002: 0002-XXX-work-around-SA_RESTART-race-wit.patch Patch0002: 0002-XXX-work-around-SA_RESTART-race-wit.patch
@ -156,6 +167,14 @@ BuildRequires: systemd
%{?systemd_requires} %{?systemd_requires}
%define with_systemd 1 %define with_systemd 1
%endif %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 %if 0%{?sles_version} != 11
BuildRequires: usbredir-devel BuildRequires: usbredir-devel
%endif %endif
@ -176,14 +195,6 @@ BuildRequires: libspice-server-devel
BuildRequires: spice-protocol-devel BuildRequires: spice-protocol-devel
%endif %endif
%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: /usr/sbin/groupadd
Requires: pwdutils Requires: pwdutils
Requires: timezone Requires: timezone
@ -297,7 +308,7 @@ as PC and PowerMac systems.
This sub-package provides some lesser used emulations, such as moxie and xtensa. This sub-package provides some lesser used emulations, such as moxie and xtensa.
%ifarch %ix86 x86_64 s390x %if %{legacy_qemu_kvm}
%package kvm %package kvm
Url: http://www.linux-kvm.org Url: http://www.linux-kvm.org
Summary: Kernel-based Virtual Machine Summary: Kernel-based Virtual Machine
@ -543,6 +554,9 @@ done
--enable-gtk \ --enable-gtk \
%if 0%{?suse_version} >= 1220 %if 0%{?suse_version} >= 1220
--with-gtkabi=3.0 \ --with-gtkabi=3.0 \
%endif
%if %{kvm_available}
--enable-kvm \
%endif %endif
--enable-linux-aio \ --enable-linux-aio \
--enable-modules \ --enable-modules \
@ -594,7 +608,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
rm -fr $RPM_BUILD_ROOT/%_datadir/doc rm -fr $RPM_BUILD_ROOT/%_datadir/doc
install -D -m 644 %{SOURCE302} $RPM_BUILD_ROOT/%{_sysconfdir}/qemu/bridge.conf install -D -m 644 %{SOURCE302} $RPM_BUILD_ROOT/%{_sysconfdir}/qemu/bridge.conf
%find_lang %name %find_lang %name
%ifarch %ix86 x86_64 s390x %if %{legacy_qemu_kvm}
cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF' cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh #!/bin/sh
@ -605,16 +619,20 @@ exec %{_bindir}/qemu-system-x86_64 -machine accel=kvm "$@"
%endif %endif
EOF EOF
chmod 755 %{buildroot}%{_bindir}/qemu-kvm 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 %if 0%{?suse_version} >= 1230
install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules
%else %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 install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules
%endif %endif
%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 %endif
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%fdupes -s $RPM_BUILD_ROOT %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 \ %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \
-c "qemu user" qemu -c "qemu user" qemu
%ifarch %ix86 x86_64 s390x %if %{kvm_available}
%post %post
if [ "$(readlink -f /proc/1/root)" = "/" ]; then if [ "$(readlink -f /proc/1/root)" = "/" ]; then
/sbin/udevadm control --reload-rules || : /sbin/udevadm control --reload-rules || :
@ -713,7 +731,7 @@ fi
%exclude %_datadir/%name/qemu-ifup %exclude %_datadir/%name/qemu-ifup
%endif %endif
%dir %_sysconfdir/%name %dir %_sysconfdir/%name
%ifarch %ix86 x86_64 %if %{kvm_available}
%if 0%{?suse_version} >= 1230 %if 0%{?suse_version} >= 1230
%{_udevrulesdir}/80-kvm.rules %{_udevrulesdir}/80-kvm.rules
%else %else
@ -734,6 +752,7 @@ fi
%defattr(-, root, root) %defattr(-, root, root)
%_bindir/qemu-system-ppc %_bindir/qemu-system-ppc
%_bindir/qemu-system-ppc64 %_bindir/qemu-system-ppc64
%_bindir/qemu-system-ppcemb
%_datadir/%name/ppc_rom.bin %_datadir/%name/ppc_rom.bin
%_datadir/%name/openbios-ppc %_datadir/%name/openbios-ppc
%_datadir/%name/slof.bin %_datadir/%name/slof.bin
@ -750,6 +769,7 @@ fi
%files arm %files arm
%defattr(-, root, root) %defattr(-, root, root)
%_bindir/qemu-system-arm %_bindir/qemu-system-arm
%_bindir/qemu-system-aarch64
%files extra %files extra
%defattr(-, root, root) %defattr(-, root, root)
@ -758,8 +778,10 @@ fi
%exclude %_bindir/qemu-system-x86_64 %exclude %_bindir/qemu-system-x86_64
%exclude %_bindir/qemu-system-ppc %exclude %_bindir/qemu-system-ppc
%exclude %_bindir/qemu-system-ppc64 %exclude %_bindir/qemu-system-ppc64
%exclude %_bindir/qemu-system-ppcemb
%exclude %_bindir/qemu-system-s390x %exclude %_bindir/qemu-system-s390x
%exclude %_bindir/qemu-system-arm %exclude %_bindir/qemu-system-arm
%exclude %_bindir/qemu-system-aarch64
%_datadir/%name/palcode-clipper %_datadir/%name/palcode-clipper
%_datadir/%name/openbios-sparc32 %_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64 %_datadir/%name/openbios-sparc64
@ -767,7 +789,7 @@ fi
%_datadir/%name/QEMU,cgthree.bin %_datadir/%name/QEMU,cgthree.bin
%_datadir/%name/QEMU,tcx.bin %_datadir/%name/QEMU,tcx.bin
%ifarch %ix86 x86_64 s390x %if %{legacy_qemu_kvm}
%files kvm %files kvm
%defattr(-,root,root) %defattr(-,root,root)
%_bindir/qemu-kvm %_bindir/qemu-kvm

View File

@ -26,6 +26,16 @@
%else %else
%define build_x86_fw_from_source 0 %define build_x86_fw_from_source 0
%endif %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 %define noarch_supported 1110
Name: qemu Name: qemu
@ -42,6 +52,7 @@ Source3: kvm_stat
Source4: qemu-kvm.1.gz Source4: qemu-kvm.1.gz
Source5: 60-kvm.rules Source5: 60-kvm.rules
Source6: ksm.service Source6: ksm.service
Source7: 60-kvm.x86.rules
# This patch queue is auto-generated from https://github.com/openSUSE/qemu # This patch queue is auto-generated from https://github.com/openSUSE/qemu
PATCH_FILES PATCH_FILES
# Please do not add patches manually here, run update_git.sh. # Please do not add patches manually here, run update_git.sh.
@ -113,6 +124,14 @@ BuildRequires: systemd
%{?systemd_requires} %{?systemd_requires}
%define with_systemd 1 %define with_systemd 1
%endif %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 %if 0%{?sles_version} != 11
BuildRequires: usbredir-devel BuildRequires: usbredir-devel
%endif %endif
@ -133,14 +152,6 @@ BuildRequires: libspice-server-devel
BuildRequires: spice-protocol-devel BuildRequires: spice-protocol-devel
%endif %endif
%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: /usr/sbin/groupadd
Requires: pwdutils Requires: pwdutils
Requires: timezone Requires: timezone
@ -254,7 +265,7 @@ as PC and PowerMac systems.
This sub-package provides some lesser used emulations, such as moxie and xtensa. This sub-package provides some lesser used emulations, such as moxie and xtensa.
%ifarch %ix86 x86_64 s390x %if %{legacy_qemu_kvm}
%package kvm %package kvm
Url: http://www.linux-kvm.org Url: http://www.linux-kvm.org
Summary: Kernel-based Virtual Machine Summary: Kernel-based Virtual Machine
@ -457,6 +468,9 @@ done
--enable-gtk \ --enable-gtk \
%if 0%{?suse_version} >= 1220 %if 0%{?suse_version} >= 1220
--with-gtkabi=3.0 \ --with-gtkabi=3.0 \
%endif
%if %{kvm_available}
--enable-kvm \
%endif %endif
--enable-linux-aio \ --enable-linux-aio \
--enable-modules \ --enable-modules \
@ -508,7 +522,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
rm -fr $RPM_BUILD_ROOT/%_datadir/doc rm -fr $RPM_BUILD_ROOT/%_datadir/doc
install -D -m 644 %{SOURCE302} $RPM_BUILD_ROOT/%{_sysconfdir}/qemu/bridge.conf install -D -m 644 %{SOURCE302} $RPM_BUILD_ROOT/%{_sysconfdir}/qemu/bridge.conf
%find_lang %name %find_lang %name
%ifarch %ix86 x86_64 s390x %if %{legacy_qemu_kvm}
cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF' cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh #!/bin/sh
@ -519,16 +533,20 @@ exec %{_bindir}/qemu-system-x86_64 -machine accel=kvm "$@"
%endif %endif
EOF EOF
chmod 755 %{buildroot}%{_bindir}/qemu-kvm 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 %if 0%{?suse_version} >= 1230
install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules
%else %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 install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules
%endif %endif
%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 %endif
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%fdupes -s $RPM_BUILD_ROOT %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 \ %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \
-c "qemu user" qemu -c "qemu user" qemu
%ifarch %ix86 x86_64 s390x %if %{kvm_available}
%post %post
if [ "$(readlink -f /proc/1/root)" = "/" ]; then if [ "$(readlink -f /proc/1/root)" = "/" ]; then
/sbin/udevadm control --reload-rules || : /sbin/udevadm control --reload-rules || :
@ -627,7 +645,7 @@ fi
%exclude %_datadir/%name/qemu-ifup %exclude %_datadir/%name/qemu-ifup
%endif %endif
%dir %_sysconfdir/%name %dir %_sysconfdir/%name
%ifarch %ix86 x86_64 %if %{kvm_available}
%if 0%{?suse_version} >= 1230 %if 0%{?suse_version} >= 1230
%{_udevrulesdir}/80-kvm.rules %{_udevrulesdir}/80-kvm.rules
%else %else
@ -648,6 +666,7 @@ fi
%defattr(-, root, root) %defattr(-, root, root)
%_bindir/qemu-system-ppc %_bindir/qemu-system-ppc
%_bindir/qemu-system-ppc64 %_bindir/qemu-system-ppc64
%_bindir/qemu-system-ppcemb
%_datadir/%name/ppc_rom.bin %_datadir/%name/ppc_rom.bin
%_datadir/%name/openbios-ppc %_datadir/%name/openbios-ppc
%_datadir/%name/slof.bin %_datadir/%name/slof.bin
@ -664,6 +683,7 @@ fi
%files arm %files arm
%defattr(-, root, root) %defattr(-, root, root)
%_bindir/qemu-system-arm %_bindir/qemu-system-arm
%_bindir/qemu-system-aarch64
%files extra %files extra
%defattr(-, root, root) %defattr(-, root, root)
@ -672,8 +692,10 @@ fi
%exclude %_bindir/qemu-system-x86_64 %exclude %_bindir/qemu-system-x86_64
%exclude %_bindir/qemu-system-ppc %exclude %_bindir/qemu-system-ppc
%exclude %_bindir/qemu-system-ppc64 %exclude %_bindir/qemu-system-ppc64
%exclude %_bindir/qemu-system-ppcemb
%exclude %_bindir/qemu-system-s390x %exclude %_bindir/qemu-system-s390x
%exclude %_bindir/qemu-system-arm %exclude %_bindir/qemu-system-arm
%exclude %_bindir/qemu-system-aarch64
%_datadir/%name/palcode-clipper %_datadir/%name/palcode-clipper
%_datadir/%name/openbios-sparc32 %_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64 %_datadir/%name/openbios-sparc64
@ -681,7 +703,7 @@ fi
%_datadir/%name/QEMU,cgthree.bin %_datadir/%name/QEMU,cgthree.bin
%_datadir/%name/QEMU,tcx.bin %_datadir/%name/QEMU,tcx.bin
%ifarch %ix86 x86_64 s390x %if %{legacy_qemu_kvm}
%files kvm %files kvm
%defattr(-,root,root) %defattr(-,root,root)
%_bindir/qemu-kvm %_bindir/qemu-kvm