Dynamic Kernels: Modularized Device Drivers

This is the first in a series of four articles co-authored by Alessandro Rubini and Georg Zezchwitz which present a practical approach to writing Linux device drivers as kernel loadable modules. This installment presents and introduction to thte topic, preparing the reader to understand next month's installment.
Additional information

The Kernel Korner columns of the following months will introduce further points of module-writing. Code samples can be found inside the kernel and on ftp sites near you.

In particular, what I describe is based on my personal experience with device drivers: both the ceddrv-0.xx and cxdrv-0.xx resemble the code I describe. Georg Zezschwitz and I wrote the ceddrv, which drives a lab interface (A/D, D/A, bells and whistles). The cxdrv driver is simpler, and drives a memory-mapped frame grabber. The latest versions of both drivers are available on ftp://iride.unipv.it/pub/linux for public ftp. ceddrv is also on tsx-11.mit.edu, while cxdev is on sunsite.unc.edu in apps/video.

There are quite a few books about device drivers out there, but they're often too system-specific and describe an awkward interface—Linux is easier. Generic books about Unix internals and the kernel source are the best teachers. I'd suggest to get one of the following:

  • Maurice J. Bach, The Design of the UNIX Operating System, Prentice Hall, 1986

  • Andrew S. Tanenbaum, Operating Systems: Design and Implementation, Prentice Hall, 1987

  • Andrew S. Tanenbaum, Modern Operating Systems, Prentice Hall, 1992

Alessandro Rubini (rubini@foggy.systemy.it) is taking his PhD course in computer science and is breeding two small Linux boxes at home. Wild by his very nature, he loves trekking, canoeing, and riding his bike.