How do I compile a 3rd party device driver ?

As an example on how to compile a 3rd party device driver for the 2.6 kernel, lets look at how to compile the HWU54G Wireless driver for Fedora Core.


First, you need to make sure you have the kernel-devel package for your kernel installed. If your kernel is up to date, simply doing a yum install kernel-devel should be enough. Verify that you have a kernel-devel package of the same version as your currently running kernel!

  # yum install kernel-devel
  # uname -a
  # rpm -q kernel-devel

If the versions of your currently running kernel and kernel-devel package do not match, you should probably upgrade the kernel and reboot into that new kernel.

Unpack and build driver

The vendor usually ships the driver in a .zip or .tar.gz format, or even has a .tar.gz with source code inside a .zip; anything is possible for packaging. In the case of the HWU54G driver, the zip file contains documentation and a tarball named ZD1211LnxDrv_2_0_0_0.tar.gz.

First, we unpack the driver.

  # mkdir zd
  # cd zd
  # tar xzf /path/to/wherever/you/put/ZD1211LnxDrv_2_0_0_0.tar.gz

This would be a good time to check if the driver tarball contains any additional documentation. If there is any, you should read it. This documentation usually tells you whether you need to download firmware, if you need to adjust any system scripts for this driver to work, specifics on how to build and install this driver, etc...

In the case of the HWU54G driver, the building and installing appears to be quite simple:

  # make
  # make install

Kernel upgrades

When you upgrade your kernel, you will need to recompile the driver for your new kernel. Simply repeat the build procedure above while running your new kernel. You need to be running your new kernel because the Makefile picks the kernel version to build against from the kernel version the system is running currently.

Driver specifics

If you run into other 3rd party drivers that need special instructions, feel free to add them here.


KernelNewbies: FAQ/CompileVendorDriver (last edited 2017-12-30 01:30:07 by localhost)