%define KDIR /usr/src/linux %define KMAJOR %( cat %KDIR/Makefile |grep ^VERSION |sed -e 's,.*=[[:space:]]*,,' ) %define KMINOR %( cat %KDIR/Makefile |grep ^PATCHLEVEL |sed -e 's,.*=[[:space:]]*,,' ) %define KSUB %( cat %KDIR/Makefile |grep ^SUBLEVEL |sed -e 's,.*=[[:space:]]*,,' ) %define KEXTRA %( cat %KDIR/Makefile |grep ^EXTRAVERSION |sed -e 's,.*=[[:space:]]*,,;s,-custom,,' ) %define KVERSION %( echo %KMAJOR.%KMINOR.%KSUB%KEXTRA ) %define svn 84 Name: kvm Version: 0.1 Release: 0.%svn.1ark Summary: Kernel Virtual Machine virtualization environment Group: System Environment/Kernel License: GPL URL: http://www.linux-kvm.org/page/Downloads BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} ExclusiveArch: %ix86 x86_64 BuildRequires: SDL-devel zlib-devel alsa-lib-devel Source: kvm-%svn.tar.lz %description The Kernel Virtual Machine provides a virtualization enviroment for processors with hardware support for virtualization: Intel's VT and AMD's AMD-V. %prep %setup -q -n kvm-%svn cp -a /usr/src/linux-%KVERSION linux cd linux if [ -e configs/config-*-%_target_cpu ]; then cp configs/config-*-%_target_cpu .config make %?_smp_mflags oldconfig else make defconfig fi make %?_smp_mflags prepare0 prepare1 prepare2 cd .. ./configure --enable-mixemu --with-patched-kernel --kerneldir=`pwd`/linux --prefix=%_prefix/kvm %build rm -rf %{buildroot} make %?_smp_mflags make %?_smp_mflags extboot make %?_smp_mflags -C qemu %install make DESTDIR=%{buildroot} install-rpm %post /sbin/chkconfig --add kvm /sbin/chkconfig --level 2345 kvm on /sbin/chkconfig --level 16 kvm off /usr/sbin/groupadd -fg 444 kvm %preun if [ "$1" != 0 ]; then /sbin/service kvm stop /sbin/chkconfig --level 2345 kvm off /sbin/chkconfig --del kvm fi %clean %{__rm} -rf %{buildroot} %files %_bindir/kvm %_bindir/kvm_stat %_prefix/kvm %_sysconfdir/kvm %_sysconfdir/init.d/kvm %changelog