3.9. Adding a Device Driver

This section describes how to add a device driver to the installation environment (initrd.img). 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
    # hg clone http://fyp.rocksclusters.org/hg/rocks-5.0
  2. Go to the directory which holds the device driver code:

    # cd /export/rocks-5.0/rocks/src/roll/kernel/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/rocks-5.0/rocks/src/roll/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/rocks-5.0/rocks/src/roll/kernel/RPMS/x86_64/rocks-boot* \
    	/home/install/contrib/5.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 /home/install
    # rocks-dist dist
  11. Install the newly created initrd.img and its matching kernel vmlinuz so PXE booted nodes will get the new device drivers:

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

3.9.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/rocks-5.0/rocks/src/roll/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.