Megaraid sas driver on RHEL 8.7

From Leo's Notes
Last edited on 17 January 2023, at 23:26.

The megaraid_sas driver package for Red Hat Enterprise Linux (RHEL) / Rocky Linux is provided by ElRepo. However, as of the time of this writing, the precompiled package for EL 8.7 doesn't exist for some reason.

To build this package, run the following (I did this inside a Rocky Linux 8.7 Docker image):

# yum -y install rpm-build elfutils-libelf-devel kernel-abi-whitelists kernel-rpm-macros make gcc
# wget
# rpm -ivh kmod-megaraid_sas-07.719.03.00-1.el8_6.elrepo.src.rpm
# rpmbuild --define "kmod_kernel_version 4.18.0-425.10.1.el8_7" --define "_topdir $HOME/rpmbuild" -bb /root/rpmbuild/SPECS/megaraid_sas-kmod.spec
# ls /root/rpmbuild/RPMS/x86_64/kmod-megaraid_sas-07.719.03.00-1.el8.x86_64.rpm

Replace the kernel version with the kernel version you're targetting. In my case, it's 4.18.0-425.10.1.el8_7.