# Define the kmod package name here. %define kmod_name megaraid_sas # If kmod_kernel_version isn't defined on the rpmbuild line, define it here. %{!?kmod_kernel_version: %define kmod_kernel_version 5.14.0-362.24.2.el9_3} %{!?dist: %define dist .el9} Name: kmod-%{kmod_name} Version: 07.725.01.00 Release: 3%{?dist} Summary: %{kmod_name} kernel module(s) Group: System Environment/Kernel License: GPLv2 URL: http://www.kernel.org/ # Sources. Source0: %{kmod_name}-%{version}.tar.gz Source5: GPL-v2.0.txt # Source code patches Patch0: elrepo-%{kmod_name}-rhel_differences.el9_0.patch %define __spec_install_post \ /usr/lib/rpm/check-buildroot \ /usr/lib/rpm/redhat/brp-ldconfig \ /usr/lib/rpm/brp-compress \ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump \ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip \ /usr/lib/rpm/redhat/brp-python-bytecompile "" "1" "0" \ /usr/lib/rpm/brp-python-hardlink \ /usr/lib/rpm/redhat/brp-mangle-shebangs %define findpat %( echo "%""P" ) %define __find_requires /usr/lib/rpm/redhat/find-requires.ksyms %define __find_provides /usr/lib/rpm/redhat/find-provides.ksyms %{kmod_name} %{?epoch:%{epoch}:}%{version}-%{release} %define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups %define kver_state_dir %{dup_state_dir}/kver %define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%{_arch} %define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules %define debug_package %{nil} %global _use_internal_dependency_generator 0 %global kernel_source() %{_usrsrc}/kernels/%{kmod_kernel_version}.%{_arch} BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) ExclusiveArch: x86_64 BuildRequires: elfutils-libelf-devel BuildRequires: kernel-abi-stablelists BuildRequires: kernel-devel = %{kmod_kernel_version} BuildRequires: kernel-rpm-macros BuildRequires: redhat-rpm-config BuildRequires: rpm-build BuildRequires: gcc BuildRequires: make Provides: kernel-modules >= %{kmod_kernel_version}.%{_arch} Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: kernel >= %{kmod_kernel_version} Requires: kernel-core-uname-r >= %{kmod_kernel_version} Requires(post): %{_sbindir}/depmod Requires(postun): %{_sbindir}/depmod Requires(post): %{_sbindir}/weak-modules Requires(postun): %{_sbindir}/weak-modules %description This package provides the %{kmod_name} kernel module(s). It is built to depend upon the specific ABI provided by a range of releases of the same variant of the Linux kernel and not on any one specific build. %prep %setup -q -n %{kmod_name}-%{version} echo "override %{kmod_name} * weak-updates/%{kmod_name}" > kmod-%{kmod_name}.conf # Apply patch(es) %patch0 -p0 %build %{__make} -C %{kernel_source} %{?_smp_mflags} V=1 modules M=$PWD whitelist="/lib/modules/kabi-current/kabi_stablelist_%{_target_cpu}" for modules in $( find . -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do # update greylist nm -u ./$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> ./greylist done done sort -u greylist | uniq > greylist.txt %install %{__install} -d %{buildroot}/lib/modules/%{kmod_kernel_version}.%{_arch}/extra/%{kmod_name}/ %{__install} %{kmod_name}.ko %{buildroot}/lib/modules/%{kmod_kernel_version}.%{_arch}/extra/%{kmod_name}/ %{__install} -d %{buildroot}%{_sysconfdir}/depmod.d/ %{__install} -m 0644 kmod-%{kmod_name}.conf %{buildroot}%{_sysconfdir}/depmod.d/ %{__install} -d %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ %{__install} -m 0644 %{SOURCE5} %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ %{__install} -m 0644 greylist.txt %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/ # strip the modules(s) find %{buildroot} -name \*.ko -type f | xargs --no-run-if-empty %{__strip} --strip-debug # Sign the modules(s) %if %{?_with_modsign:1}%{!?_with_modsign:0} # If the module signing keys are not defined, define them here. %{!?privkey: %define privkey %{_sysconfdir}/pki/SECURE-BOOT-KEY.priv} %{!?pubkey: %define pubkey %{_sysconfdir}/pki/SECURE-BOOT-KEY.der} for module in $(find %{buildroot} -type f -name \*.ko); do %{_usrsrc}/kernels/%{kmod_kernel_version}.%{_arch}/scripts/sign-file \ sha256 %{privkey} %{pubkey} $module; done %endif %clean %{__rm} -rf %{buildroot} %files %defattr(644,root,root,755) /lib/modules/%{kmod_kernel_version}.%{_arch}/ %config /etc/depmod.d/kmod-%{kmod_name}.conf %doc /usr/share/doc/kmod-%{kmod_name}-%{version}/ %changelog * Mon Apr 08 2024 Patrick Coakley - 07.725.01.00-3 - Rebuilt for kernel 5.14.0-362.24.2.el9_3.x86_64 * Wed Nov 22 2023 Patrick Coakley - 07.725.01.00-2 - Rebuilt for CyaraOS 9.3 * Tue Nov 07 2023 Philip J Perry - 07.725.01.00-1 - Rebuilt for RHEL 9.3 - Source updated from RHEL 9.3 kernel * Tue May 09 2023 Philip J Perry - 07.719.03.00-3 - Rebuilt for RHEL 9.2 - Source updated from RHEL 9.2 kernel * Tue Nov 15 2022 Philip J Perry - 07.719.03.00-2 - Rebuilt for RHEL 9.1 - Source updated from RHEL 9.1 kernel * Tue May 17 2022 Philip J Perry - 07.719.03.00-1 - Initial build for RHEL 9 - Backported from kernel-5.14.0-70.13.1.el9_0