Making Red Hat Linux driver disks

COPYRIGHT

Please read the copyright that covers this work.

Why driver disks?

What do you do if you want to install Red Hat Linux, but your computer's hard disk interface is not supported? Or what if you want to use the network during the install process (e.g. to grab the packages from a website), but again, the Red Hat installation disks have no drivers for your network interface?

Probably the easiest solution (besides plugging in a card for which drivers are available :) is to make a "driver disk". A driver disk is a diskette or CD that holds the driver kernel module(s) you need, plus certain other required files, all in a well-defined format. To use a driver disk, you give the installer bootloader the special option "dd", then later in the install process, the installer offers you the opportunity to insert driver disks. The installer reads the disk, tries to load the driver, and if all is well, you can now use your hardware during the install.

I ran into this problem when trying to install Red Hat Linux 9 using kickstart. I initiate the kickstart process with a customized Red Hat 9 install CD, and all the later data and files were pulled from servers on the network. My built-in network interface was not supported by Red Hat 9, so I was a bit stuck. After reviewing my options, I ended up making a working driver disk that allowed me to do the network kickstart install. I've written up another page that describes in some detail why and how I made that specific driver disk.

On this page, I'll describe some of the general lessons I learned about how to make a driver disk. First of all, let me point out that if you think you need a driver disk, you should contact your vendor(s) to see if they have one available, and do a web search to see if someone has already made a driver disk available that satisfies your needs. But if you really want or need to make your own driver disk, read on...

A number of people have already written documentation about how to make a driver disk. For example, see:

[...Hmmm, I seem to have lost those references. If I can find them later, I'll insert them here. At any rate, what I remember from those pages is that they're awfully hackish -- lots of manual use of mke2fs and cpio and gzip -9 etc. That's all fine, because that is how driver disks work behind the scenes, but the method described below is easier, cleaner, and less time-consuming.]

Many of the instructions on this page will work for a variety of Red Hat Linux versions, but I specifically have worked with Red Hat Linux 9, and these instructions reflect that in small ways.

Doug Ledford's driver disk kit

Doug Ledford, a Red Hat kernel driver engineer, has provided a kit that eases many of the steps for making a driver disk. You can download his Device Driver Update Disk Devel Kit. I recommend checking out Doug's homepage, because it has some other good material on it, notably instructions for end-users for how to use a driver disk.

If you've gotten this far, you probably have sufficient technical skills to figure out how to use Doug's driver disk kit on your own. I won't hold your hand with the fairly obvious things (e.g. download the file, extract the files using tar xzf...), but let me share some of the rough spots I had to overcome, which may save you some time.

Before doing anything else, read Doug's kit README to get some basic idea how this thing works. There are a number of manual steps you have to do, and I'm not going to re-describe those here. I will, however, offer some clarifications or additions to Doug's README.

My experience using the kit

beginning the build

One thing Doug's README doesn't mention is that you have to put your driver heirarchy directly under the kit's top-level directory. For example, for the sk98lin driver, I had to put everything in mod_devel_kit/net/sk98lin/ (the sk98lin driver has a number of source files, and in the mainline kernel, they live in linux-2.4/drivers/net/sk98lin/). I tried at first to make a separate build directory, putting things in mod_devel_kit/build/net/sk98lin, but that didn't work.

In his README, Doug mentions five files that you have to provide: disk-info, modinfo, modules.dep, Makefile, and pcitable. In case it's not clear from his README, all these files go into your driver directory. In my case, they all went in mod_devel_kit/net/sk98lin/.

It's worth noting that Doug's toplevel Makefile copies disk-info onto the driver disk as rhdd-6.1 This was a source of confusion for me, because I was expecting to need a file called rhdd-6.1.

pcitable

Be aware that the pcitable file must have horizontal tabs between the fields on each line, not spaces. I found out the hard way that the parser for pcitable is brittle and does not accept (multiple) spaces between fields. It's also possible, I suppose, that a single space between fields will work; I didn't actually look at the parser code carefully. If you care to work it out for yourself, the parser is in pciReadDrivers() in pci.c in the kudzu source.

If you do use multiple spaces betwen fields, the Red Hat installer will tell you (after loading the driver from your driver disk) that you do not have any devices of the appropriate type installed. I suppose this is because the failure to parse the pcitable means the installer couldn't recognize the device's PCI ID.

your Makefile

Another mistake I made was to make a bad Makefile. My first attempt both didn't list some of the .o files that went into the final driver .o, and it didn't define (with -D) some of the macros that had to be defined. Both of these problems generated a load failure (undefined symbols) when I tried to load the driver. The details you'll have to go through to create a Makefile for your driver will vary, but be aware that you might not create a good .o on your first try, despite the fact that everything seemed to work during the compile. Try loading the driver with insmod as a test.

Doug's Makefile

I had to modify Doug's Makefile to support Red Hat Linux 9. You can download my Makefile to give you a headstart. Note that I provided support for Red Hat kernels 2.4.20-8, 2.4.20-18.9, and 2.4.20-19.9. Modify this list as you require.

kernels

Before you can run 'make', you have to 'make import' the kernels that you're going to develop your driver disks for. See README.new_kernel_versions in Doug's kit for details.

One last thing I discovered is that the RH9 kernels provide config files for i386-smp, but Doug's Makefile hangs while processing this file. So in each kernel I imported, I went into the configs/ directory and removed the *i386-smp* file. I also removed the i586-smp and *x86_64* files, because I didn't think I or anyone else downloading from my site would likely need these. You may want to remove or leave various of these config files, depending on your situation. Note that the fewer config files you have, the faster the 'make' goes.


If you see any errors on this page, would like to suggest additions or changes, or want to contact me for any other reason, my email address is kewley<at>klab.caltech.edu

David Kewley

Last modified 2003.11.05