Chapter 9. Linux Kernel Modules

In the previous two chapters, you learned how the Linux kernel development process works. You learned about the upstream kernel community and how the kernel is a constantly evolving project. The last chapter was written in order to explain to you just how much of a moving target Linux really is (this is complex stuff, don't worry—there's no class test at the end of this book), while this chapter sets the stage for you to begin writing your very own Linux kernel modules. These are often referred to as Linux kernel drivers because a majority of modules support specific devices.

You already wrote a simple Linux kernel module called plp back in Chapter 7. That simple loadable Linux kernel module simply printed a greeting into the kernel ring buffer (displayed using the dmesg command) and demonstrated the fundamental concept of writing a module, without delving deeper. This chapter builds upon the examples from the previous chapter by introducing many more of the concepts that you need to work with when writing real Linux kernel modules for real-world uses.

Not all kernel development takes place in the form of third-party modules. There are many parts of the kernel that cannot be modified through loadable kernel modules alone, requiring core code changes instead of a simple module load. Although you will experience your first taste of kernel development in the form of loadable modules, you won't be modifying core kernel algorithms by the end of this chapter. ...

Get Professional Linux® Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.