File kvm.spec of Package kvm
#
# spec file for package kvm (Version 63)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# icecream 0
Name: kvm
BuildRequires: SDL-devel alsa alsa-devel dev86 ncurses-devel perl pmtools texinfo
License: BSD 3-Clause; GPL v2 only; GPL v2 or later; LGPL v2.1 or later; X11/MIT
Group: System/Kernel
Summary: Kernel-based Virtual Machine
Url: http://kvm.qumranet.com/
Version: 63
Release: 9.4
Source0: %name-%version.tar.bz2
### To update to new version, recompress the kvm-??.tar.gz using:
# rpmbuild -bp kvm.spec --define="_sourcedir `pwd`"
#%(
if [ -f %name-%version.tar.gz ]; then
gunzip %name-%version.tar.gz
tar --delete %name-%version/patches \
--delete "%name-%version/qemu/s390-dis.c" \
--delete "%name-%version/qemu/s390.ld" \
--file=%{name}-%{version}.tar
bzip2 %name-%version.tar
fi
)
###
ExclusiveArch: %ix86 x86_64
Source1: 60-kvm.rules
Patch01: qemu-datadir.diff
Patch02: kvm-susekernel.patch
Patch04: kvm-ssse3.patch
Patch10: qemu-hpet.patch
Patch11: qemu-lpc.patch
Patch12: qemu-applesmc.patch
Patch13: qemu-coreduo.patch
Patch14: qemu-ide.patch
Patch15: qemu-intelmac.patch
Patch16: qemu-rtl8139.patch
Patch17: qemu-multiboot.patch
Patch18: qemu-maxnics.patch
Patch82: kvm-cpuid.patch
Patch83: kvm-gfxboot.patch
Patch90: acpi-tables.patch
# For upstream patches:
Source100: convert-commits-to-patch.sh
#Patch100: kvm-commits.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: /usr/sbin/groupadd
%define use_kmp 1
%if %use_kmp
BuildRequires: module-init-tools
Requires: kvm-kmp
%suse_kernel_module_package debug kdump um xen xenpae
%endif
# Can't use --with-patched-kernel with kvm-36 on i386, so for now also on 10.3:
BuildRequires: kernel-syms
%description
KVM (Kernel-based Virtual Machine) is a virtualization software for
Linux which is based on hardware virtualization extensions (Intel VT-X
and AMD-V) and a modified version of qemu to enable full hardware
emulation as far as needed to boot many PC operating systems in
unmodified form, including Linux, Windows and Mac OS X.
Note: KVM is not yet ready for production use and has known issues. You
can find details the Novell bugzilla: http://bugzilla.novell.com
KVM depends on Intel VT and AMD-V and does not run on CPUs without
these extensions. qemu can be used on those, with some performance
penalty, instead.
As the hardware emulation used for KVM is based on QEMU, virtual
machines can be moved between QEMU and KVM hosts seamlessly.
The package libvirt contains libvirtd, a simple hypervisor for managing
multiple QEMU and KVM virtual machines on one host machine. The
included virtsh allows to define virtual machines using XML files and
allows some simple management of such virtual machines on the command
line. virt-manager is a GUI for connecting to, and controlling virtual
machines based on libvirt.
Authors:
--------
Avi Kivity <avi@qumranet.com>
Yaniv Kamay <yaniv@qumranet.com>
Dor Laor <dor.laor@qumranet.com>
%package KMP
Summary: Updated kernel modules for KVM (Kernel-based Virtual Machine)
Group: System/Kernel
%description KMP
This package contains updated kernel modules which are recommended for
enhanced functionality of KVM. The Linux kernel rpm already contains
kvm modules, but with this package installed and the modules of this
package loaded, certain fixes which are not yet available in the kernel
rpm.
To verify the kernel to which this package is built for, compare the
postfix of this package has after "kvm-kmp-" with the postfix after
"kernel-", e.g. kvm-kmp-default contains updated modules for the
kernel-default with the exact same version number.
To take advantage of KVM in general, you need qemu-kvm (which is
included in the package kvm) which contains the PC hardware simulation
that is needed for full virtualisation.
KVM guests implemented using qemu-kvm can be monitored using libvirt
which contains a hypervisor for managing multible QEMU and KVM and Xen
virtual machines. virt-manager provides a graphical application for
connecting to and controlling virtual machines based on libvirt.
Authors:
--------
Avi Kivity <avi@qumranet.com>
Yaniv Kamay <yaniv@qumranet.com>
Dor Laor <dor.laor@qumranet.com>
%prep
%setup -q
%patch01 -p1 -b .use-qemu-kvm-as-datadir
%if %use_kmp
%patch02 -p0 -b .include-path-for-suse-kernel-rpms
%endif
%define bios_targets bios vgabios extboot
%define vanilla 0
%if !%{vanilla}
%patch04 -p1 -b .add-support-for-ssse3
%patch10 -p0
%patch11 -p0
%patch12 -p0
%patch13 -p0
%patch14 -p0
%patch15 -p0
%patch16 -p0
%patch17 -p0
%patch18 -p0
%patch82 -p1
%patch83 -p0
cp -a bios bios-mac
%patch90 -p0 -b .bios-mac
%endif
# Currently not used, keep it for later use:
# Apply selected upstream patches from the kvm-commits list:
#sh %_sourcedir/convert-commits-to-patch.sh %PATCH100 | patch -p0
%build
[ -f qemu/s390-dis.c ] && exit 2 # bnc#353836
# Temporary workaround until qemu's configure is fixed:
sed -i 's/-lcurses/-lncurses/' qemu/configure
# qemu's old CPU emulator (used if KVM disabled) is broken with gcc4
# and using -O0 hurts qemu's device performance, so disable it and
# give a hint until kvm merges qemu's new gcc-independent CPU instruction
# emulator.
# It may even be good to do that geneerally as it sounds be better
# to give a clear noticeable error message instead of just being slow
# by using qemu's CPU emulation:
sed 's/Compiled with --disable-cpu-emulation, exiting./\
CPU emulation is disabled in this kvm build, use qemu-system(-x86_64) instead!/' qemu/vl.c
./configure --prefix=%{_prefix} \
--disable-cpu-emulation \
--disable-gcc-check --qemu-cflags="%{optflags}"
# Aborts if curses support is not enabled:
grep "^CONFIG_CURSES=yes" qemu/config-host.mak
# Patch kvm/user Makefile to accept inital CFLAGS:
sed -i 's/CFLAGS =/CFLAGS +=/' user/Makefile
echo "CFLAGS=%optflags" >> user/config.mak
# Main build:
make libkvm user qemu %{?bios_targets} %{?jobs:-j%jobs}
%if !%{vanilla}
make -C bios-mac
%endif
# kernel modules
%if %use_kmp
mkdir suse-kernel
for flavor in %flavors_to_build; do
rm -rf suse-kernel/$flavor
cp -r kernel suse-kernel/$flavor
cd suse-kernel/$flavor
sed "s|KERNELDIR=.*|KERNELDIR=/usr/src/linux-obj/%_target_cpu/$flavor|" ../../config.mak >../config.mak
make
cd ../..
done
%endif
%install
# kernel modules
%if %use_kmp
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=weak-updates
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
M=$PWD/suse-kernel/$flavor
done
%endif
make DESTDIR=%{buildroot} WANT_MODULE="" install
mv qemu/qemu-doc.html qemu/qemu-kvm.html
%if !%{vanilla}
install -m 644 bios-mac/BIOS-bochs-latest %{buildroot}/%{_datadir}/qemu-kvm/macbios.bin
%endif
cd %{buildroot}
rm -r .{%_bindir/qemu-img,%_datadir/{doc,qemu-kvm/{openbios-sparc32,ppc_rom.bin}}}
rm -r .{%_mandir/man1/qemu-img.1,%_includedir,%_libdir}
mv .%_bindir/{qemu*,qemu-kvm}
mv .%_mandir/man1/{qemu.1,qemu-kvm.1}
chmod 644 .%_mandir/man1/*
install -D -m 644 %{SOURCE1} %{buildroot}/etc/udev/rules.d/60-kvm.rules
%pre
/usr/sbin/groupadd -r kvm 2>/dev/null || :
%files
%defattr(-,root,root)
%doc qemu/qemu-kvm.html
%attr(750,root,kvm) %{_bindir}/qemu-kvm
%{_datadir}/qemu-kvm
%config /etc/udev/rules.d/60-kvm.rules
%_mandir/man1/qemu-kvm.1.gz
%changelog
* Fri Mar 28 2008 coolo@suse.de
- adding ncurses-devel to buildrequires
* Fri Mar 7 2008 bk@suse.de
- Update to kvm-63, adds curses interface. It still uses gcc for qemu's
CPU emulation which is broken with gcc4 -> disable it temporarily.
* Mon Feb 25 2008 alex@suse.de
- Fix cpuid patch
* Thu Feb 21 2008 bk@suse.de
- Add fixes from upstream and drop cpuidfake patch, fixes bnc#360671
* Fri Feb 15 2008 bk@suse.de
- Update to kvm-61, adds paravirtualized clock and dozens of fixes
- Fix cpuid asm or 64-bit guest support and fix core duo support
- Build the BIOS images from source and add ACPI entries for -M mac
- Build qemu with -O0 to work around real-mode emulation problems
* Fri Feb 15 2008 agraf@suse.de
- Include fix to make gfxboot work on Intel
* Wed Feb 13 2008 anschneider@suse.de
- Add upstream patch to fix VMs that no longer boot
* Thu Jan 24 2008 bk@suse.de
- Update to kvm-60, add C2D cpuid level 4, use bios.mac for -M mac
* Fri Jan 11 2008 bk@suse.de
- Update to kvm-59, now works with gfxboot of recent openSUSE CDs!
* Tue Aug 28 2007 bk@suse.de
- based unpon version in opensue buildservice by dbahi/kraxel