How to compile Red Hat module

This HOWTO is for 2.4.x kernel. For 2.6.x you need to take into acount new things described in the following resources: http://linuxdevices.com/articles/AT4389927951.html also http://www.linuxdevices.com/articles/AT3855888078.html may be useful. This short HOWTO describes how to compile a module for Red Hat (may work with other distros too) without recompiling the whole kernel.

It is simple, you need a brand new, untouched kernel source - just remove your old and install new.

  1. create some working directory (it can be under your user account!) and copy there necessary files (like audio.c and audio.h)
  2. write the proper Makefile, here are examples for USB audio, USB pegasus based network adapters for Firewire IEEE1394 and for USB storage. Both are based on Arjan's example for xircom_cb and Doug Ledford's page
  3. make
  4. test module with insmod ./driver.o - do not forget to remove the old one when testing!
  5. if done - copy it to /lib/modules/...propepath/modulename.o and run depmod -a. To find out where, just run locate

Jacek Pliszka
Last modified: Sun Feb 15 23:09:05 CET 2004