Linux for Embedded and Real-Time Applications

By Doug Abbott
Published by Elsevier

While the technologies of real-time embedded systems continue their rapid evolution, the Linux world develops at a similarly frenetic pace. This new edition of Doug Abbott's solid introduction to embedded Linux brings the book back to the cutting-edge. The embedded market for Linux has continued to expand - recent research indicates that Linux is fast becoming the OS of choice for embedded systems. This new edition still provides a reader-friendly overview, and the updates to it will ensure significantly bolstered coverage of the basics. Reknowned expert author Doug Abbott includes all new chapters including memory management with uClinux, the Eclipse environment, and reducing OS size. Discussion throughout is based on the newest Linux kernel and OS releases.

Kernel Modules and Device Drivers

For me, the fun part of embedded programming is seeing the computer interact with its physical environment, i.e., actually do something. In this chapter we'll use the parallel port on our target machine to provide some limited I/O capability for the thermostat program developed in the previous chapter. But first some background.

Kernel Modules Installable kernel modules offer a very useful way to extend the functionality of the basic Linux kernel and add new features without having to rebuild the kernel. A key feature is that modules may be dynamically loaded when their functionality is required and subsequently unloaded when no longer needed. Modules are particularly useful for things like device drivers and /proc files.

Given the range and diversity of hardware that Linux supports, it would be impractical to build a kernel image that included all of the possible device drivers. Instead the kernel includes only drivers for boot devices and other common hardware such as serial and parallel ports, IDE and SCSI drives, and so on. Other devices are supported as loadable modules and only the modules needed in a given system are actually loaded.

Loadable modules are unlikely to be used in a production embedded environment because we know in advance exactly what hardware the system must support and so we simply build that support into the kernel image. Nevertheless, modules are still useful when testing a new driver. You don't need to build a new kernel image every time you find and fix a problem in your driver code. Just load it as a module and try it.

Keep in mind that modules execute in Kernel Space at Privilege Level 0 and thus are capable of bringing down the entire system.

...

Download PDF.