So, you want to write a kernel module. You know C, you've written a number of normal programs to run as processes, and now you want to get to where the real action is, to where a single wild pointer can wipe out your file system and a core dump means a reboot. Welcome to the club. Linux Kernel Module Programming Guide is for people who want to write kernel modules. It takes a hands-on approach starting with writing a small "hello, world" program, and quickly moves from there. Far from a boring text on programming, Linux Kernel Module Programming Guide has a lively style that entertains while it educates. Linux Kernel Module Programming Guide is one of the key documents of the Linux Documentation Project, an online compilation of freely distributed manuals and how-to guides on the popular Linux operating system. This book is a printed version of the online documentation, and is provided as a convenience for those who prefer printed manuals. iUniverse.com Computer Books are composed of freely available online computer manuals, industry standard specifications, and electronically distributed computer-programming guides. They include open documents' collections of industry specifications and standards and a collection of the best open source documentation on the Web...the most complete open source library available anywhere. Each book contains the complete, unabridged text of the original document. The on-demand publishing process gives you the actual text of the online document in a convenient, inexpensive, easy-to-use format. And remember...iUniverse.com donates a portion of the profits from open document and open source books to support the mission of the free software community.
This document is for people who want to write kernel modules. Although I will touch on how things are done in the kernel in several places, that is not my purpose. There are enough good sources which do a better job than I could have done.
This document is also for people who know how to write kernel modules, but have not yet adapted to version 2.2 of the kernel. If you are such a person, I suggest you look at appendix A to see all the differences I encountered while updating the examples. The list is nowhere near comprehensive, but I think it covers most of the basic functionality and will be enough to get you started.
The kernel is a great piece of programming, and I believe that programmers should read at least some kernel source files and understand them. Having said that, I also believe in the value of playing with the system first and asking questions later. When I learn a new programming language, I don’t start with reading the library code, but by writing a small ‘hello, world’ program. I don’t see why playing with the kernel should be any different.