Summary
In this chapter, we covered the basics of Linux kernel architecture and the LKM framework. You learned what a kernel module is and why it’s useful. We then wrote a simple yet complete kernel module, a very basic Hello, world. We then delved further into how it works and the coding conventions to follow, along with the practicalities of how exactly to build, load, see the module listing, and unload it. Kernel logging with printk
(and friends) was covered in some detail, along with explanations regarding the printk
logging levels, controlling output to the console(s), and more. Details on how to emit pure debug-level kernel messages, and more importantly, an introduction to using the kernel’s dynamic debug feature were then dealt with. We then moved on to the rate-limiting printk
, generating kernel messages from user space, standardizing its output format, and understanding the new printk
indexing feature. We closed this chapter with an understanding of the basics...