5.10. Adding a Device Driver

This section describes how to add a device driver to the installation environment (initrd.img-7.0-<arch>). This enables the installation environment to use the new driver as well as installing the device driver into the running environment (that is, after the node has installed).

This feature is enabled by ddiskit which is maintained by Jon Masters at Red Hat.

  1. Set up a build environment:

    # cd /export
    # mkdir src
    # git clone http://git.rocksclusters.org/git/core/kernel/.git
    # cd kernel
    # git checkout -b ROCKS_<major_version>_<minor_version>
  2. Go to the directory which holds the device driver code:

    # cd src/rocks-boot/enterprise/5/images/drivers
  3. In this directory, you'll see some example drivers. Let's look at the e1000 driver:

    # cd e1000
  4. If you want to supply a new version of the driver, you'll have to download the e1000 source tarball and copy the *.c and *.h files from the tarball to this directory. Make sure all the *.c and *.h files are listed at the top of the Makefile:

    MODULES := e1000
    
    SOURCES := e1000_main.c e1000_hw.c e1000_ethtool.c e1000_param.c
    
    HEADERS := e1000.h e1000_hw.h e1000_osdep.h
  5. You'll need to make sure the proper PCI ids are in the file pcitable. For example, to test on one of our Dell SC1425's, we added the line:

    0x8086  0x1076  "e1000" "Intel|82541GI/PI Gigabit Ethernet Controller (rev 05)"
  6. Now we'll need to specify to the device driver building code that the e1000 driver should be built. To do this, edit the file subdirs:

    # cd ..
    # vi subdirs
  7. Change the section from:

    #
    # put a list of all the driver directories that you'd like to build.
    #
    # for example, to build the 'e1000' driver, uncomment the line below:
    #e1000

    to:

    #
    # put a list of all the driver directories that you'd like to build.
    #
    # for example, to build the 'e1000' driver, uncomment the line below:
    e1000
  8. Build the rocks-boot package:

    # cd /export/kernel/src/rocks-boot
    # make rpm
  9. When this completes, copy the binary RPMs into a directory where the distribution building utility (rocks-dist) will find and include them:

    # cp /export/kernel/RPMS/x86_64/rocks-boot* \
    	/export/rocks/install/contrib/7.0/x86_64/RPMS/

    Note

    If you are building on an i386 system, change the above x86_64 references to i386.

  10. Rebuild the distro:

    # cd /export/rocks/install
    # rocks create distro
  11. Install the newly created initrd.img-7.0-<arch> and its matching kernel vmlinuz-7.0-<arch> so PXE booted nodes will get the new device drivers:

    # cd /export/rocks/install
    # rpm -Uvh --force rocks-dist/x86_64/RedHat/RPMS/rocks-boot-5*.rpm
    # cp /boot/kickstart/default/initrd.img-7.0-<arch> /tftpboot/pxelinux/
    # cp /boot/kickstart/default/vmlinuz-7.0-<arch> /tftpboot/pxelinux/
  12. Now PXE boot a node. This node will load your new driver and will install this driver into the running environment.

5.10.1. Adding a New Device Driver (That Isn't One of the Example Drivers)

If the name of your device driver you wish to add is not one of the example device drivers (e.g., ata_piix, cciss, e1000, sk98lin, or tg3), then you'll need to create a new directory and populate it with the appropriate files.

For help on how to populate your new driver directory, see: /export/kernel/src/rocks-boot/enterprise/5/images/drivers/INSTALL.

The rest of the build process follows the same procedure as above starting at step 6 where you'll have to add the name of your new driver to the file subdirs.