# # spec file for package hyper-v # # Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %define with_kmp 0 %if %{with_kmp} %define with_drivers_in_kmp 0 %endif %define hv_kvp_daemon hv_kvp_daemon Name: hyper-v %if %{with_kmp} BuildRequires: kernel-default-devel BuildRequires: module-init-tools %ifarch %ix86 BuildRequires: kernel-pae-devel %endif %endif ExclusiveArch: %ix86 x86_64 PreReq: %insserv_prereq Summary: Microsoft Hyper-V tools License: GPL-2.0 Group: System/Kernel Supplements: modalias(dmi*:svn*MicrosoftCorporation*:pn*VirtualMachine*:rn*VirtualMachine*) Supplements: modalias(pci:v00001414d00005353sv*sd*bc*sc*i*) Url: http://www.kernel.org Version: 3 Release: 4.1 Source: Module.supported Source1: hyperv_pvdrivers.conf Source2: kmp_filelist Source3: hyper-v.supplements.txt Source4: hyper-v.dummy_ko.c Source5: hyper-v.kvptest.ps1.txt Source9: hyper-v.include.linux.hyperv.h Source10: hyper-v.tools.hv.hv_kvp_daemon.c Source11: hyper-v.init.sh BuildRoot: %{_tmppath}/%{name}-%{version}-build %if %{with_kmp} %if %{with_drivers_in_kmp} %suse_kernel_module_package -n hyper-v um xen -f kmp_filelist %else %suse_kernel_module_package -n hyper-v um xen -f kmp_filelist -p hyper-v.supplements.txt %endif %endif %description This package contains the Microsoft Hyper-V tools. %if %{with_kmp} %package KMP Summary: Microsoft Hyper-V drivers Group: System/Kernel %description KMP This package contains the Microsoft Hyper-V drivers. %endif %prep %setup -Tc cp -avL %{S:5} kvptest.ps1.txt cp -vL %{S:9} %{hv_kvp_daemon}.h cp -vL %{S:10} %{hv_kvp_daemon}.c sed -i~ '/#include /d' %{hv_kvp_daemon}.c %build gcc \ $RPM_OPT_FLAGS \ -g \ %{hv_kvp_daemon}.c \ -include %{hv_kvp_daemon}.h \ -DCN_KVP_IDX=0x9 \ -DCN_KVP_VAL=0x1 \ -o %{hv_kvp_daemon} %if %{with_kmp} for flavor in %flavors_to_build; do %if %{with_drivers_in_kmp} krel=$(make -s -C %{kernel_source $flavor} kernelrelease) cp -a /lib/modules/$krel/source/drivers/staging/hv $flavor %else rm -rfv $flavor mkdir -p $flavor cp %_sourcedir/hyper-v.dummy_ko.c $flavor/hyper-v.suse_kmp_dummy.c cat > $flavor/Makefile <<-EOF obj-m += hyper-v.suse_kmp_dummy.o EOF %endif cp %_sourcedir/Module.supported $flavor make -C %{kernel_source $flavor} modules M=$PWD/$flavor done %endif %install %if %{with_kmp} export INSTALL_MOD_PATH=$RPM_BUILD_ROOT for flavor in %flavors_to_build; do make -C %{kernel_source $flavor} modules_install M=$PWD/$flavor done %endif mkdir -p $RPM_BUILD_ROOT/usr/sbin install -m755 %{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin mkdir -p $RPM_BUILD_ROOT/etc/init.d install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/%{hv_kvp_daemon} ln -sfvbn ../../etc/init.d/%{hv_kvp_daemon} $RPM_BUILD_ROOT/usr/sbin/rc%{hv_kvp_daemon} mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d install -m644 %SOURCE1 $RPM_BUILD_ROOT/etc/modprobe.d/hyperv_pvdrivers.conf %files %defattr (-,root,root) %doc kvptest.ps1.txt %if !%{with_kmp} %dir /etc/modprobe.d %config /etc/modprobe.d/hyperv_pvdrivers.conf %endif /etc/init.d/%{hv_kvp_daemon} /usr/sbin/rc%{hv_kvp_daemon} /usr/sbin/%{hv_kvp_daemon} %post board_vendor= product_name= if pushd /sys/class/dmi/id > /dev/null 2>/dev/null then if test -r board_vendor then board_vendor="`cat board_vendor`" fi if test -r product_name then product_name="`cat product_name`" fi popd > /dev/null fi if test "${board_vendor}" = "Microsoft Corporation" -a "${product_name}" = "Virtual Machine" then echo "Enabling %{hv_kvp_daemon} on '${product_name}' from '${board_vendor}'" %{insserv_force_if_yast %{hv_kvp_daemon}} fi %preun %stop_on_removal %{hv_kvp_daemon} %postun %restart_on_update %{hv_kvp_daemon} %insserv_cleanup %changelog * Wed May 2 2012 ohering@suse.de - update insserv part, see comments in OBS submit request #112701 * Tue Mar 27 2012 ohering@suse.de - add kvptest.ps1.txt to docs, a PowerShell script to verify KVP * Mon Mar 26 2012 ohering@suse.de - update hv_kvp_daemon to 3.4-rc1 state use a copy linux/hyperv.h to compile the daemon * Fri Nov 18 2011 ohering@suse.de - add Supplements to install package if dmi matches [bnc#731198] * Thu Sep 1 2011 ohering@suse.de - disable hyper-v-kmp hv_storvsc handles now IDE and SCSI disks and ata_piix is compiled into the kernel in SLE12, so the modprobe.conf rules have no meaning anymore * Tue Jul 26 2011 ohering@suse.de - update hv_kvp_daemon: Cleanup kvp_get_domain_name(). If getaddrinfo() fails, deal with it properly (this can happen if no IP address has been assigned). Also, don't specify a specific service in the call to getaddrinfo() to make this code as generic as possible. * Sun Jul 24 2011 ohering@suse.de - update hv_kvp_daemon: The current win7 host does not like it when we return the complete kernel release information. Conform to what the host expects. * Fri Jun 17 2011 ohering@suse.de - update preun, stop_on_removal requires an argument * Fri Jun 17 2011 ohering@suse.de - remove get_release_number.sh, which was added by accident - bump version number to 2 * Fri Jun 17 2011 ohering@suse.de - catch errors from daemon() * Fri Jun 17 2011 ohering@suse.de - update postun to run restart_on_update - use rpmmacro for daemon name * Fri Jun 17 2011 ohering@suse.de - update postin to work in / again when running insserv macro * Thu Jun 16 2011 ohering@suse.de - Update version number to 1 so kernel.rpm can obsolete the old kmp packages * Thu Jun 16 2011 ohering@suse.de - enable hv_kvp_daemon if run in a hv guest [fate#312213] * Thu Apr 21 2011 ohering@suse.de - add hv_kvp_daemon to provide system infos to hypervisor [bnc#685189] this enables the hyper-v main package * Sat Apr 16 2011 ohering@suse.de - Require at least kernel-default 2.6.32.27 for an empty KMP. * Fri Apr 15 2011 ohering@suse.de - actually keep the KMP packages with just the modprobe.conf file * Thu Mar 31 2011 ohering@suse.de - make building of kernel modules optional [bnc#676890] the hv*.ko drivers exist in two places, kernel-default and this KMP package. Both can get out of sync, then mkinitrd will use (the possible outdated) drivers from this KMP package. disable building drivers per default, keep only the hyperv_pvdrivers.conf - mark hyperv_pvdrivers.conf as config to preserve local modifications done by the sysadmin * Thu Feb 24 2011 meissner@suse.de - also add hv_timesource to Modules.supported [bnc#650748] * Tue Jan 4 2011 meissner@suse.de - add hv_utils to Modules.supported [bnc#650748] * Wed Apr 28 2010 kukuk@suse.de - Next update of hyperv_pvdrivers.conf [bnc#600212] * Tue Apr 27 2010 kukuk@suse.de - hyperv_pvdrivers.conf: fix syntax error * Tue Apr 27 2010 ksrinivasan@novell.com - Update hyperv_pvdrivers.conf config file * Mon Apr 26 2010 kukuk@suse.de - Add hyperv_pvdrivers.conf modprobe config file * Fri Mar 5 2010 mmarek@suse.cz - Packaged drivers/staging/hv as a standalone KMP (bnc#585651).