Blame SPECS/kmod-mlx4.spec

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