Red Hat Enterprise Linux and CentOS 7 Driver Disk

Sun Jul 3, 2016

Recently I had the need to install CentOS 7 on an old machine to be used as a simple firewall. The problem I faced was that the RAID controller (IBM ServeRAID 5) of that old server was not suported anymore by Red Hat Enterprise Linux (RHEL) and by that, by CentOS kernels. The driver is part of the kernel version of CentOS 7 but Red Hat disable it for support reasons. There is an external repository, ELRepo, that packages external drivers and drivers Red Hat disables. I have used ELRepo before in order to install a 100 MBit network interface driver (Red Hat disable too many old 100 MBit NIC drivers).

RHEL and CentOS kernels and those from many other enterprise targeted distributions are API and ABI compatible for the entire lifespan of them, so building a driver for a kernel release can be reused for all kernel updates. ELRepo packages are built that way, in contrast with akmod method that need compiler tools in order to rebuild the driver module everytime the kernel is updated.

The easiest way to build a new kernel module package is to download the SRPM of a kernel module package that is somewhat related to the one you are building, for example same device type like a NIC or a SCSI controller. Use that SRPM as the base for your package. I extracted the ips.h, ips.c and a few other needed files and built my package.

What took me more time than to build the package was to create a Driver Disk (DD) that the CentOS installer could recognize. A driver disk is needed because as I was packaging a SCSI controller driver that manage the disk I will install to, the installer need to load the driver at startup. This isn’t a problem when you are building a driver for other kind of devices, those could be installed after the installer finishes. There is little documentation on the layout of a driver disk, took me time and a lot of search to build one.

First you need your driver package RPM, let call ours kmod-ips-<version>.<arch>.rpm, and build a removable drive with the following layout

├── rhdd3
└── rpms
    └── <arch>
        ├── kmod-ips-7.12.05-1.el7.centos.<arch>.rpm
        └── repodata
            ├── …
            └── repomd.xml

Where <arch> could be i686 (only for CentOS 7, RHEL 7 doesn’t provide 32 bit support) or x86_64. The repodata directory is the yum repository metadata created for the <arch> directory. You can generate it from that directory using tools like createrepo or createrepo_c. rhdd3 is just a file with the text Driver Update Disk version 3 as contents.

The driver RPM must provide kernel-modules in order to tell the installer the minimum support kernel version for the module:

kernel-modules >= 3.10.0-327.el7.<arch>

ELRepo SRPMs are able to add it, so if you use them as base the RPM already contains it.

Now that you have generated your driver disk, read how to perform a driver update during installation on RHEL documentation and there you have, your driver ready to be loaded.

  « Previous: Next: »