Blame SPECS/kmod-mlx4.spec

82be66
%global pkg mlx4
82be66
184af8
%global driver_version 4.18.0-305.el8
82be66
f20559
%global kernel_version 4.18.0-305.12.1.el8_4
82be66
82be66
%global _use_internal_dependency_generator 0
82be66
%global __find_requires %{nil}
82be66
%global __find_provides /usr/lib/rpm/find-provides
82be66
82be66
%global debug_package %{nil}
82be66
82be66
%global __spec_install_post \
82be66
  %{?__debug_package:%{__debug_install_post}} \
82be66
  %{__arch_install_post} \
82be66
  %{__os_install_post} \
82be66
  %{__mod_compress_install_post}
82be66
82be66
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
82be66
82be66
82be66
Name:             kmod-%{pkg}
82be66
Version:          4.18.0
db38d7
Release:          305.12.1%{?dist}
82be66
Summary:          Mellanox ConnectX HCA (%{pkg}) driver
82be66
82be66
License:          GPLv2 and (BSD or GPLv2)
82be66
URL:              https://www.kernel.org/
82be66
184af8
Source0:          %{pkg}-%{driver_version}.tar.xz
82be66
Patch1:           0001-disable-mlx4_en.patch
82be66
Patch2:           0002-enable-mlx4_core-gen2.patch
82be66
82be66
ExclusiveArch:    x86_64 aarch64
82be66
82be66
BuildRequires:    elfutils-libelf-devel
82be66
BuildRequires:    gcc
82be66
BuildRequires:    kmod
82be66
BuildRequires:    make
82be66
BuildRequires:    redhat-rpm-config
82be66
BuildRequires:    xz
82be66
82be66
BuildRequires:    kernel-devel = %{kernel_version}
82be66
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
82be66
82be66
Requires:         kernel-core = %{kernel_version}
82be66
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
82be66
Requires:         kernel-modules = %{kernel_version}
82be66
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
82be66
82be66
Provides:         installonlypkg(kernel-module)
b2f0f1
Provides:         kernel-modules = %{kernel_version}
82be66
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
82be66
82be66
Requires(post):   /usr/sbin/depmod
82be66
Requires(postun): /usr/sbin/depmod
82be66
82be66
Requires(post):   /usr/bin/dracut
82be66
Requires(postun): /usr/bin/dracut
82be66
82be66
82be66
%description
82be66
This package provides the Mellanos ConnectX HCA (%{pkg}) driver. Compared to
82be66
the in-kernel driver this driver re-enables support for deprecated Mellanox
82be66
Gen2 and ConnectX-2 adapters:
82be66
82be66
- 0x15B3:0x1002: Mellanox ConnectX-2 MT25400
82be66
- 0x15B3:0x6340: Mellanox Hermon SDR
82be66
- 0x15B3:0x634A: Mellanox Hermon DDR
82be66
- 0x15B3:0x6354: Mellanox Hermon QDR
82be66
- 0x15B3:0x6368: Mellanox Hermon EN 10GigE
82be66
- 0x15B3:0x6372: Mellanox ConnectX EN 10GBASE-T
82be66
- 0x15B3:0x6732: Mellanox Hermon DDR Gen2
82be66
- 0x15B3:0x673C: Mellanox Hermon QDR Gen2
82be66
- 0x15B3:0x6746: Mellanox ConnectX EN 40GigE PCIe Gen2 5GT/s
82be66
- 0x15B3:0x6750: Mellanox Hermon EN 10GigE Gen2
82be66
- 0x15B3:0x675A: Mellanox ConnectX EN 10GBASE-T Gen2
82be66
- 0x15B3:0x6764: Mellanox ConnectX EN 10 GigE PCIe Gen2
82be66
- 0x15B3:0x676E: Mellanox ConnectX-2 40GigE PCIe Gen2
82be66
82be66
82be66
%prep
184af8
%autosetup -p1 -n %{pkg}-%{driver_version}
82be66
82be66
82be66
%build
82be66
pushd src
82be66
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
82be66
popd
82be66
82be66
82be66
%install
82be66
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/mellanox/%{pkg} src/%{pkg}_core.ko
82be66
82be66
# Make .ko objects temporarily executable for automatic stripping
82be66
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
82be66
82be66
82be66
%clean
82be66
%{__rm} -rf %{buildroot}
82be66
82be66
82be66
%post
82be66
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
82be66
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
82be66
82be66
82be66
%preun
82be66
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
82be66
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
82be66
82be66
82be66
%postun
82be66
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
82be66
then
82be66
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
82be66
    then
82be66
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
82be66
    fi
82be66
82be66
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
82be66
    then
82be66
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
82be66
        then
82be66
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
82be66
            then
82be66
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
82be66
            else
82be66
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
82be66
            fi
82be66
        fi
82be66
    fi
82be66
82be66
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
82be66
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
82be66
fi
82be66
82be66
82be66
%posttrans
82be66
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
82be66
then
82be66
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
82be66
    then
82be66
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
82be66
    fi
82be66
82be66
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
82be66
    then
82be66
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
82be66
        then
82be66
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
82be66
            then
82be66
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
82be66
            else
82be66
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
82be66
            fi
82be66
        fi
82be66
    fi
82be66
82be66
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
82be66
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
82be66
fi
82be66
82be66
82be66
%files
82be66
%defattr(644,root,root,755)
82be66
/lib/modules/%{kernel_version}.%{_arch}
82be66
%license COPYING
82be66
82be66
82be66
%changelog
db38d7
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.12.1
db38d7
- Rebuild for 4.18.0-305.12.1.el8_4
db38d7
82be66
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305
82be66
- Initial version