Blame SPECS/kmod-mlx4.spec

cf790c
%global pkg mlx4
cf790c
767af5
%global driver_version 4.18.0-315.el8
cf790c
90bed7
%global kernel_version 4.18.0-315.el8
cf790c
cf790c
%global _use_internal_dependency_generator 0
c63a4c
%global __find_requires /usr/lib/rpm/redhat/find-requires
c63a4c
%global __find_provides /usr/lib/rpm/redhat/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}
9b730e
Version:          4.18.0~315
9b730e
Release:          1%{?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
c63a4c
BuildRequires:    kernel-rpm-macros
cf790c
BuildRequires:    kmod
cf790c
BuildRequires:    make
cf790c
BuildRequires:    redhat-rpm-config
cf790c
BuildRequires:    xz
cf790c
c63a4c
BuildRequires:    kernel-abi-stablelists = %{kernel_version}
cf790c
BuildRequires:    kernel-devel = %{kernel_version}
ed311d
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
cf790c
c63a4c
Requires:         kernel >= %{kernel_version}
c63a4c
Requires:         kernel-uname-r >= %{kernel_version}.%{_arch}
c63a4c
Requires:         kernel-modules >= %{kernel_version}
c63a4c
Requires:         kernel-modules-uname-r >= %{kernel_version}.%{_arch}
cf790c
c511ae
Provides:         installonlypkg(kernel-module)
c63a4c
Provides:         kernel-modules >= %{kernel_version}.%{_arch}
cf790c
c63a4c
Requires(post):   %{_sbindir}/depmod
c63a4c
Requires(postun): %{_sbindir}/depmod
cf790c
c63a4c
Requires(post):   %{_sbindir}/weak-modules
c63a4c
Requires(postun): %{_sbindir}/weak-modules
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
c63a4c
# Generate depmod.conf
c63a4c
%{__install} -d %{buildroot}/%{_sysconfdir}/depmod.d/
c63a4c
for kmod in $(find %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra -type f -name \*.ko -printf "%%P\n" | sort)
c63a4c
do
c63a4c
    echo "override $(basename $kmod .ko) * weak-updates/$(dirname $kmod)" >> %{buildroot}/%{_sysconfdir}/depmod.d/%{pkg}.conf
c63a4c
done
c63a4c
cf790c
cf790c
%clean
cf790c
%{__rm} -rf %{buildroot}
cf790c
cf790c
cf790c
%post
2064d3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
printf '%s\n' "/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/mellanox/%{pkg}/%{pkg}_core.ko.xz" >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
2064d3
2064d3
2064d3
%preun
2064d3
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
rpm -ql kmod-%{pkg}-%{?epoch:%{epoch}:}%{version}-%{release}.%{_arch} | grep '/lib/modules/%{kernel_version}.%{_arch}/.*\.ko\.xz$' >> %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
cf790c
cf790c
cf790c
%postun
c63a4c
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove ]
2064d3
then
c63a4c
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove) )
c63a4c
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove
2064d3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules
2064d3
fi
2064d3
2064d3
c63a4c
%pretrans -p <lua>
c63a4c
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add")
c63a4c
posix.unlink("%{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-remove")
c63a4c
c63a4c
2064d3
%posttrans
c63a4c
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add ]
2064d3
then
c63a4c
    modules=( $(cat %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add) )
c63a4c
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/weak-modules-add
2064d3
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
c63a4c
    printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules
2064d3
fi
cf790c
cf790c
cf790c
%files
cf790c
%defattr(644,root,root,755)
cf790c
/lib/modules/%{kernel_version}.%{_arch}
cf790c
%license COPYING
c63a4c
%config(noreplace) %{_sysconfdir}/depmod.d/%{pkg}.conf
cf790c
cf790c
cf790c
%changelog
9b730e
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0~315-1
9b730e
- Add driver release number to version
9b730e
90bed7
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-350
90bed7
- Use release number independent of kernel
90bed7
- Build 4.18.0-315.el8 for 4.18.0-315.el8
90bed7
c63a4c
* Wed Oct 27 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-348
c63a4c
- Convert to kABI tracking kmod package (kernel >= 4.18.0-326.el8)
c63a4c
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