Blame SPECS/kmod-mlx4.spec

cf790c
%global pkg mlx4
cf790c
767af5
%global driver_version 4.18.0-315.el8
cf790c
aed08e
%global kernel_version 4.18.0-338.el8
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
aed08e
Release:          338%{?dist}
cf790c
Summary:          Mellanox ConnectX HCA (%{pkg}) driver
cf790c
cf790c
License:          GPLv2 and (BSD or GPLv2)
cf790c
URL:              https://www.kernel.org/
cf790c
767af5
Source0:          %{pkg}-%{driver_version}.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
BuildRequires:    kernel-devel = %{kernel_version}
ed311d
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
cf790c
0ba31d
Requires:         kernel-core = %{kernel_version}
ed311d
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
74f710
Requires:         kernel-modules = %{kernel_version}
ed311d
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
cf790c
c511ae
Provides:         installonlypkg(kernel-module)
439512
Provides:         kernel-modules = %{kernel_version}
fbb352
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
cf790c
cf790c
Requires(post):   /usr/sbin/depmod
cf790c
Requires(postun): /usr/sbin/depmod
cf790c
de626c
Requires(post):   /usr/bin/dracut
de626c
Requires(postun): /usr/bin/dracut
de626c
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
767af5
%autosetup -p1 -n %{pkg}-%{driver_version}
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
de626c
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
de626c
    then
de626c
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
de626c
        then
de626c
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
de626c
            then
de626c
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
de626c
            else
de626c
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
de626c
            fi
de626c
        fi
de626c
    fi
de626c
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
de626c
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
de626c
    then
de626c
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
de626c
        then
de626c
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
de626c
            then
de626c
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
de626c
            else
de626c
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
de626c
            fi
de626c
        fi
de626c
    fi
de626c
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
aed08e
* Mon Aug 30 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-338
aed08e
- Set specific kernel version to use
aed08e
- Rename kernel_version_min to driver_version
aed08e
- Add Provides kernel-modules
aed08e
- Rebuild for 4.18.0-338.el8
aed08e
b5527d
* Thu Aug 19 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-331
b5527d
- Rebuild for 4.18.0-331.el8
b5527d
9b59fe
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
1654e7
- Rebuild for 4.18.0-326.el8
9b59fe
- Fix provides/requires
9b59fe
- Fix kernel dependencies
9b59fe
- Add convenient provides kmod-aacraid-`uname -r`
9b59fe
- Fix installonlypkg detection
9b59fe
- Recreate source tarballs
9b59fe
- Rebuild for dist = .el8s
9b59fe
9b59fe
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-315
cf790c
- Initial version