File msft-hvnd.spec of Package msft-hvnd
#
# spec file for package microsoft-hv_network_direct KMP
#
# Copyright (c) 2015 SUSE LINUX 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://bugzilla.novell.com/
#
%define releasetag private
%define my_release 0
Name:          msft-hvnd
BuildRequires: %kernel_module_package_buildreqs
# begin mod
BuildRequires: kernel-source
# end mod
License:       GPL-2.0
Group:         System/Kernel
Summary:       Microsoft Infiniband RDMA Driver Kernel Module Package
Version:       20150623
Release:       %{my_release}
Source0:       June-23-2015.tar
BuildRoot:     %{_tmppath}/%{name}-%{version}-build
%kernel_module_package -x xen
%description
This package contains the Microsoft hv_network_direct RDMA driver for SLES 12.
%prep
%setup -n June-23-2015 %{Source0}
set -- *
mkdir source
mv "$@" source/
# begin mod 
pushd source
cp /usr/src/linux/drivers/infiniband/hw/mlx4/user.h .
sed -i 's/\.\.\/mlx4\/user\.h/\.\/user\.h/g' ./provider.c
sed -i 's/ret = vmbus_sendpacket_completion(dev->channel, requestid);/ret = vmbus_sendpacket(dev->channel, NULL, 0,  requestid, VM_PKT_COMP, 0);/g' vmbus_rdma.c
popd
# end mod
echo "hv_network_direct.ko external" > source/Module.supported
mkdir obj
%build
export CONFIG_HYPERV_INFINIBAND_ND=m
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -r source obj/$flavor
    make -C %{kernel_source $flavor} modules M=$PWD/obj/$flavor/
done
%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor/
done
%clean
rm -rf %{buildroot}
%post
%preun
%postun
%changelog