Blame SPECS/kmod-megaraid_sas.spec

f3328c
%global pkg megaraid_sas
f3328c
2d0a03
%global kernel_version_min 4.18.0-326.el8
f3328c
f3328c
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
f3328c
# Otherwise the latest installed kernel-devel version later than
f3328c
# %%{kernel_version_min} will be used.
f3328c
f3328c
%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)
f3328c
f3328c
%if "%{kernel_version_latest}" != ""
f3328c
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
f3328c
%endif
f3328c
f3328c
%global _use_internal_dependency_generator 0
d600cd
%global __find_requires %{nil}
4147ff
%global __find_provides /usr/lib/rpm/find-provides
f3328c
f3328c
%global debug_package %{nil}
f3328c
f3328c
%global __spec_install_post \
f3328c
  %{?__debug_package:%{__debug_install_post}} \
f3328c
  %{__arch_install_post} \
f3328c
  %{__os_install_post} \
f3328c
  %{__mod_compress_install_post}
f3328c
f3328c
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
f3328c
f3328c
f3328c
Name:             kmod-%{pkg}
f3328c
Version:          4.18.0
2d0a03
Release:          326%{?dist}
f3328c
Summary:          Broadcom MegaRAID SAS (%{pkg}) driver
f3328c
f3328c
License:          GPLv2
f3328c
URL:              https://www.kernel.org/
f3328c
f3328c
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
f3328c
Patch1:           0001-add-deprecated-ids.patch
f3328c
f3328c
ExclusiveArch:    x86_64 aarch64
f3328c
f3328c
BuildRequires:    elfutils-libelf-devel
f3328c
BuildRequires:    gcc
f3328c
BuildRequires:    kmod
f3328c
BuildRequires:    make
f3328c
BuildRequires:    redhat-rpm-config
f3328c
BuildRequires:    xz
f3328c
f3328c
%{!?kernel_version:
f3328c
BuildRequires:    kernel-devel >= %{kernel_version_min}
f3328c
}
f3328c
f3328c
%{?kernel_version:
f3328c
BuildRequires:    kernel-devel = %{kernel_version}
d4c797
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
f3328c
11c128
Requires:         kernel-core = %{kernel_version}
d4c797
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
a6aeba
Requires:         kernel-modules = %{kernel_version}
d4c797
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
f3328c
8015bc
Provides:         installonlypkg(kernel-module)
fd9c85
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
f3328c
}
f3328c
f3328c
Requires(post):   /usr/sbin/depmod
f3328c
Requires(postun): /usr/sbin/depmod
f3328c
53e9b1
Requires(post):   /usr/bin/dracut
53e9b1
Requires(postun): /usr/bin/dracut
53e9b1
f3328c
f3328c
%description
f3328c
This package provides the Broadcom MegaRAID SAS (%{pkg}) driver. Compared to
f3328c
the in-kernel driver this driver re-enables support for deprecated adapters:
f3328c
f3328c
- 0x1000:0x0060: LSI MegaRAID SAS1078R
f3328c
- 0x1000:0x0078: LSI MegaRAID SAS1078 Gen2
f3328c
- 0x1000:0x007C: LSI MegaRAID SAS1078DE
f3328c
- 0x1000:0x0411: LSI MegaRAID SAS1064R
f3328c
- 0x1000:0x0413: LSI MegaRAID SAS1068 Verde ZCR
f3328c
- 0x1028:0x0015: Dell PERC5
f3328c
f3328c
The removal of the following adapters has been reverted in 4.18.0-290 [1761485]:
f3328c
- 0x1000:0x0071: LSI MegaRAID SAS0071 Skinny
f3328c
- 0x1000:0x0073: LSI MegaRAID SAS0073 Skinny
f3328c
- 0x1000:0x0079: LSI MegaRAID SAS0079 Gen2
f3328c
f3328c
f3328c
%prep
f3328c
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
f3328c
f3328c
f3328c
%build
f3328c
pushd src
f3328c
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
f3328c
popd
f3328c
f3328c
f3328c
%install
f3328c
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/megaraid src/%{pkg}.ko
f3328c
f3328c
# Make .ko objects temporarily executable for automatic stripping
f3328c
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
f3328c
f3328c
f3328c
%clean
f3328c
%{__rm} -rf %{buildroot}
f3328c
f3328c
f3328c
%post
eccca9
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
eccca9
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
eccca9
eccca9
eccca9
%preun
eccca9
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
eccca9
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f3328c
f3328c
f3328c
%postun
eccca9
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
eccca9
then
eccca9
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
eccca9
    then
eccca9
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
eccca9
    fi
eccca9
53e9b1
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
53e9b1
    then
53e9b1
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
53e9b1
        then
53e9b1
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
53e9b1
            then
53e9b1
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
53e9b1
            else
53e9b1
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
53e9b1
            fi
53e9b1
        fi
53e9b1
    fi
53e9b1
eccca9
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
eccca9
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
eccca9
fi
eccca9
eccca9
eccca9
%posttrans
eccca9
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
eccca9
then
eccca9
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
eccca9
    then
eccca9
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
eccca9
    fi
eccca9
53e9b1
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
53e9b1
    then
53e9b1
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
53e9b1
        then
53e9b1
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
53e9b1
            then
53e9b1
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
53e9b1
            else
53e9b1
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
53e9b1
            fi
53e9b1
        fi
53e9b1
    fi
53e9b1
eccca9
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
eccca9
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
eccca9
fi
f3328c
f3328c
f3328c
%files
f3328c
%defattr(644,root,root,755)
f3328c
/lib/modules/%{kernel_version}.%{_arch}
f3328c
%license COPYING
f3328c
f3328c
f3328c
%changelog
2d0a03
* Thu Jul 29 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-326
2d0a03
- Update to 4.18.0-326.el8
2d0a03
f3328c
* Fri Jul 23 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18-310
f3328c
- Initial version