diff --git a/kvm/kvm-kmod-makefix.patch b/kvm/kvm-kmod-makefix.patch new file mode 100644 index 0000000..45390ff --- /dev/null +++ b/kvm/kvm-kmod-makefix.patch @@ -0,0 +1,23 @@ +--- kvm-84/kernel/Makefile 2009-02-12 10:19:26.000000000 -0500 ++++ kvm-84/kernel/Makefile.rpmfixes 2009-03-12 08:26:33.000000000 -0400 +@@ -8,8 +8,6 @@ + + KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR)) + +-DESTDIR= +- + MAKEFILE_PRE = $(ARCH_DIR)/Makefile.pre + + INSTALLDIR = $(patsubst %/build,%/extra,$(KERNELDIR)) +@@ -104,11 +102,6 @@ + install: + mkdir -p $(DESTDIR)/$(INSTALLDIR) + cp $(ARCH_DIR)/*.ko $(DESTDIR)/$(INSTALLDIR) +- for i in $(ORIGMODDIR)/drivers/kvm/*.ko \ +- $(ORIGMODDIR)/arch/$(ARCH_DIR)/kvm/*.ko; do \ +- if [ -f "$$i" ]; then mv "$$i" "$$i.orig"; fi; \ +- done +- /sbin/depmod -a $(DEPMOD_VERSION) + + tmpspec = .tmp.kvm-kmod.spec + diff --git a/kvm/kvm-kmod.spec b/kvm/kvm-kmod.spec new file mode 100644 index 0000000..be0d205 --- /dev/null +++ b/kvm/kvm-kmod.spec @@ -0,0 +1,63 @@ +%define kmod_name kvm + +%{!?kverrel:%define kverrel %(rpm -q kernel-devel --qf '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' | tail -1)} + +%define kversion %(echo "%{kverrel}" | sed -e 's|-.*||') +%define krelease %(echo "%{kverrel}" | sed -e 's|.*-||') + + +Name: kvm-kmod +Version: 84 +Release: 2_%{kversion}_%{krelease} +Summary: %{kmod_name} kernel module + +Group: System Environment/Kernel +License: GPL +URL: http://www.qumranet.com +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +Source: kvm.tar.gz +Patch: kvm-kmod-makefix.patch + +ExclusiveArch: i386 x86_64 ia64 + +%description +This kernel module provides support for virtual machines using hardware support +(Intel VT-x&VT-i or AMD SVM). + +%prep +%setup -q -n kvm-84 +%patch -p1 + +%build + +rm -rf %{buildroot} +./configure --disable-sdl --disable-gfx-check + +make -C kernel + +%install +make -C kernel install DESTDIR=%{buildroot} + +%define moddir /lib/modules/%{kverrel}/extra +chmod u+x %{buildroot}/%{moddir}/%{kmod_name}*.ko + +%post + +depmod %{kverrel} + +%postun + +depmod %{kverrel} + +%clean +%{__rm} -rf %{buildroot} + +%files +%{moddir}/%{kmod_name}.ko +%ifarch i386 x86_64 +%{moddir}/%{kmod_name}-amd.ko +%endif +%{moddir}/%{kmod_name}-intel.ko + + +%changelog diff --git a/kvm/kvm.spec b/kvm/kvm.spec new file mode 100644 index 0000000..b219da0 --- /dev/null +++ b/kvm/kvm.spec @@ -0,0 +1,113 @@ +Name: kvm +Version: 84 +Release: 3 +Summary: Kernel Virtual Machine virtualization environment + +Group: System Environment/Kernel +License: GPL +URL: http://www.qumranet.com +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} + +ExclusiveArch: i386 x86_64 ia64 + +Requires: kvm-kmod bridge-utils + +%define Distribution %(rpm -q -qf /etc/redhat-release --qf '%%{name}' | cut -d"-" -f 1) +%define os_version %(rpm -q --qf '%%{version}' %{Distribution}-release) +%define os_release %(rpm -q --qf '%%{release}' %{Distribution}-release | cut -d"." -f 1) + +%if %([ x"%{Distribution}" = x"fedora" -a x"%{os_version}" = x"5" ] && echo 1 || echo 0) +%define require_gccver 32 +%endif + +%define qemuldflags "" + +%if %([ x"%{Distribution}" = x"centos" -a x"%{os_version}" = x"4" ] && echo 1 || echo 0) +%define require_gccver 32 +%endif + +%if %([ x"%{Distribution}" = x"redhat" -a x"%{os_release}" = x"5" ] && echo 1 || echo 0) +%define require_gccver 34 +%endif + +%if %( [ x"%{require_gccver}" = x"32" ] && echo 1 || echo 0) +BuildRequires: compat-gcc-32 +%else +BuildRequires: compat-gcc-34 +%endif + +BuildRequires: zlib-devel alsa-lib-devel + +%define _prebuilt %{?prebuilt:1}%{!?prebuilt:0} + +%if !%{_prebuilt} +Source0: kvm.tar.gz +%endif + +%description +The Kernel Virtual Machine provides a virtualization enviroment for processors +with hardware support for virtualization: Intel's VT-x&VT-i and AMD's AMD-V. + +%prep + +%if !%{_prebuilt} +%setup +%endif + +%build + +rm -rf %{buildroot} + +%if !%{_prebuilt} +./configure --prefix=/usr --disable-sdl --disable-gfx-check %{qemuldflags} +make -C libkvm +make -C user +%ifarch i386 x86_64 +make extboot +%endif +make -C qemu + +cd ../.. +%endif + +%install + +%if !%{_prebuilt} +%else +cd %{objdir} +%endif + +make DESTDIR=%{buildroot} install-rpm +ln -sf qemu-system-x86_64 %{buildroot}/usr/bin/kvm +rm %{buildroot}/usr/share/qemu/pxe-e1000.bin + +%define bindir /usr/bin +%define bin %{bindir}/kvm +%define initdir /etc/init.d +%define confdir /etc/kvm +%define utilsdir /etc/kvm/utils + +%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 +/usr/bin/kvm +/usr/bin/kvm_stat +%{confdir}/qemu-ifup +%{initdir}/kvm +/etc/udev/rules.d/*kvm*.rules +/usr +%changelog diff --git a/kvm/kvm.tar.gz b/kvm/kvm.tar.gz new file mode 100644 index 0000000..d0b598e Binary files /dev/null and b/kvm/kvm.tar.gz differ