Blame SPECS/kmod-mlx4.spec

cf790c
%global pkg mlx4
cf790c
cf790c
%global kernel_version_min 4.18.0-315.el8
cf790c
cf790c
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
cf790c
# Otherwise the latest installed kernel-devel version later than
cf790c
# %%{kernel_version_min} will be used.
cf790c
cf790c
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
cf790c
cf790c
%if "%{kernel_version_latest}" != ""
cf790c
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
cf790c
%endif
cf790c
cf790c
%global _use_internal_dependency_generator 0
be718e
%global __find_requires %{nil}
b388da
%global __find_provides /usr/lib/rpm/find-provides
cf790c
cf790c
%global debug_package %{nil}
cf790c
cf790c
%global __spec_install_post \
cf790c
  %{?__debug_package:%{__debug_install_post}} \
cf790c
  %{__arch_install_post} \
cf790c
  %{__os_install_post} \
cf790c
  %{__mod_compress_install_post}
cf790c
cf790c
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
cf790c
cf790c
cf790c
Name:             kmod-%{pkg}
cf790c
Version:          4.18.0
1654e7
Release:          326%{?dist}
cf790c
Summary:          Mellanox ConnectX HCA (%{pkg}) driver
cf790c
cf790c
License:          GPLv2 and (BSD or GPLv2)
cf790c
URL:              https://www.kernel.org/
cf790c
cf790c
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
cf790c
Patch1:           0001-disable-mlx4_en.patch
cf790c
Patch2:           0002-enable-mlx4_core-gen2.patch
cf790c
cf790c
ExclusiveArch:    x86_64 aarch64
cf790c
cf790c
BuildRequires:    elfutils-libelf-devel
cf790c
BuildRequires:    gcc
cf790c
BuildRequires:    kmod
cf790c
BuildRequires:    make
cf790c
BuildRequires:    redhat-rpm-config
cf790c
BuildRequires:    xz
cf790c
cf790c
%{!?kernel_version:
cf790c
BuildRequires:    kernel-devel >= %{kernel_version_min}
cf790c
}
cf790c
cf790c
%{?kernel_version:
cf790c
BuildRequires:    kernel-devel = %{kernel_version}
cf790c
cf790c
Supplements:      kernel = %{kernel_version}
cf790c
0ba31d
Requires:         kernel-core = %{kernel_version}
74f710
Requires:         kernel-modules = %{kernel_version}
cf790c
cf790c
Provides:         kernel-modules = %{kernel_version}.%{_arch}
cf790c
}
cf790c
cf790c
Requires(post):   /usr/sbin/depmod
cf790c
Requires(postun): /usr/sbin/depmod
cf790c
cf790c
cf790c
%description
cf790c
This package provides the Mellanos ConnectX HCA (%{pkg}) driver. Compared to
cf790c
the in-kernel driver this driver re-enables support for deprecated Mellanox
cf790c
Gen2 and ConnectX-2 adapters:
cf790c
cf790c
- 0x15B3:0x1002: Mellanox ConnectX-2 MT25400
cf790c
- 0x15B3:0x6340: Mellanox Hermon SDR
cf790c
- 0x15B3:0x634A: Mellanox Hermon DDR
cf790c
- 0x15B3:0x6354: Mellanox Hermon QDR
cf790c
- 0x15B3:0x6368: Mellanox Hermon EN 10GigE
cf790c
- 0x15B3:0x6372: Mellanox ConnectX EN 10GBASE-T
cf790c
- 0x15B3:0x6732: Mellanox Hermon DDR Gen2
cf790c
- 0x15B3:0x673C: Mellanox Hermon QDR Gen2
cf790c
- 0x15B3:0x6746: Mellanox ConnectX EN 40GigE PCIe Gen2 5GT/s
cf790c
- 0x15B3:0x6750: Mellanox Hermon EN 10GigE Gen2
cf790c
- 0x15B3:0x675A: Mellanox ConnectX EN 10GBASE-T Gen2
cf790c
- 0x15B3:0x6764: Mellanox ConnectX EN 10 GigE PCIe Gen2
cf790c
- 0x15B3:0x676E: Mellanox ConnectX-2 40GigE PCIe Gen2
cf790c
cf790c
cf790c
%prep
cf790c
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
cf790c
cf790c
cf790c
%build
cf790c
pushd src
cf790c
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
cf790c
popd
cf790c
cf790c
cf790c
%install
cf790c
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/mellanox/%{pkg} src/%{pkg}_core.ko
cf790c
cf790c
# Make .ko objects temporarily executable for automatic stripping
cf790c
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
cf790c
cf790c
cf790c
%clean
cf790c
%{__rm} -rf %{buildroot}
cf790c
cf790c
cf790c
%post
2064d3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
2064d3
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2064d3
2064d3
2064d3
%preun
2064d3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
2064d3
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
cf790c
cf790c
cf790c
%postun
2064d3
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
2064d3
then
2064d3
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
2064d3
    then
2064d3
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
2064d3
    fi
2064d3
2064d3
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2064d3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
2064d3
fi
2064d3
2064d3
2064d3
%posttrans
2064d3
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
2064d3
then
2064d3
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
2064d3
    then
2064d3
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
2064d3
    fi
2064d3
2064d3
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2064d3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
2064d3
fi
cf790c
cf790c
cf790c
%files
cf790c
%defattr(644,root,root,755)
cf790c
/lib/modules/%{kernel_version}.%{_arch}
cf790c
%license COPYING
cf790c
cf790c
cf790c
%changelog
1654e7
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
1654e7
- Rebuild for 4.18.0-326.el8
1654e7
cf790c
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-315
cf790c
- Initial version