Writing Your First Kernel Module – Part 1
In the previous two chapters, you have learned the ins and outs of obtaining the kernel source tree and configuring and building it (for the x86). Now, welcome to your journey of learning about a fundamental aspect of Linux kernel development – the Loadable Kernel Module (LKM) framework – and how it is to be used by the module user or module author, who is typically a kernel or device driver programmer. This topic is rather vast and hence is split into two chapters – this one and the next.
In this chapter, we’ll begin by taking a quick look at the basics of the Linux kernel architecture, which will help us understand the LKM framework. Then, we’ll look into why kernel modules are useful and write, build, and run our simple Hello, world LKM. We’ll see how messages are written to the kernel log and understand and make use of the LKM Makefile. By the end of this chapter, you will have learned...