Book Review :  Linux Device Drivers

Alessandro Rubini & Jonathan Corbet O'Reilly  £28.50
16 Chapters and index in 570 Pages.

Contents

Chapters

        1    An introduction to the Linux Kernel
        2    Building and Running Modules
        3    Char Drivers
        4    Debugging Techniques
        5    Enhanced Char Driver Options
        6    Flow of Time
        7    Getting Hold of Memory
        8    Hardware Management
        9    Interrupt Handling
        10  Judicious use of Data Types
        11  Kmod and Advanced Modularisation
        12  Loading Block Drivers
        13  MMap and DMA
        14  Network Drivers
        15  Overview of Peripheral Buses
        16  Physical Layout of the Kernel Source
 
 

    Synopsis

Linux like all operating systems uses device drivers to get the software to drive a piece of hardware.  This book is all about those drivers.  How to understand them and what to do with them.

    Review

The open source revolution has given us access to several things which were previously inaccessible. One of the reasons I got into Linux in the beginning was I thought "hey, I can see how an operating system works". One look at the kernel code scared me off, and I went into other things.   The second edition of Rubini's book now with help from Jonathan Corbet goes a long way to dispelling my fears to do with technology that scares me because I don't understand it. While it is primarily written for those who wish to support new hardware and program within kernel space, it is impossible to do these things without knowing a fair bit of information about core kernel activities. All of these things are explained well in the book

The primary focus, of course, is device driver functionality. At the outset, Rubini and friend make sure the reader is familiar with the concept of a loadable module, and the things which are required to understand the book. These are:

It's probably a good idea to upgrade that last point to a firm grasp of C programming or something similar. If you're capable of running C code in your head while reading it, your comprehension of the code snippets provided will be greatly improved. The coding style is open and readable, and it makes for a greatly improved understanding.

There is only a very small part of the book which actually requires you to work with hardware - almost all of the basic concepts of device driver writing and use can be demonstrated purely in software - wait queues, task queues, ioctls, I/O, and a host of other things. Debugging, the bane of every programmer, is dealt with well, especially when one considers just how hard it is to debug something which you can't start and stop at will, and which will bring down the system if it crashes.  You will also pick up a working knowledge of real live hardware issues - it is obvious that the author has 'been there, done that' with real devices. He has also been gifted with an ability to explain concepts very clearly, with the aid of diagrams, where appropriate. This is, in fact, one of the strongest points in the book - all of the hard technical details are spelt out, in detail, to the level where you can immediately say "I get that now".

After a thorough grounding in the basics, there are some advanced topics as well - handling versioning within modules, DMA access, network drivers, and peripheral buses, to name a few. The extensive advances made in newer kernels - up to and including 2.1.43, are also covered, allowing some measure of advanced design. If you follow the advice given throughout the book, however, your own modules should work, with minimal modifications, with the newer 2.4.x source tree.  I would be interested to see a book by Rubini concentrating on the function of the Linux kernel in detail. Chapter 16, Physical Layout of the Kernel Source, gives a taste of what the authors are capable of.

In short, if you want to support hardware, or want to know what goes on under the hood of your kernel, and have a good working knowledge of C, I'd recommend buying this book. You won't regret it, even if you never actually write a device driver that ends up in the Linux kernel.

Review by
Matthew Palmer
and Richard Ibbotson

O'Reilly Books