gitmyhub

lkmpg

TeX ★ 8.5k updated 25d ago

The Linux Kernel Module Programming Guide (updated for 5.0+ kernels)

A free, continuously updated book teaching C programmers how to write Linux kernel modules, with working code examples tested against modern 5.x and 6.x kernels and available as a PDF or HTML download.

CTeXTeXLiveLinuxsetup: hardcomplexity 4/5

This repository is an updated edition of the Linux Kernel Module Programming Guide, a book originally published in 2001 that teaches programmers how to write kernel modules for the Linux operating system. The original guide covered 2.6.x kernels from that era, so this project maintains a current version with working code examples tested against modern 5.x and 6.x kernels. You can read the book for free online or download a PDF from the GitHub releases page.

A kernel module is a piece of code that can be loaded into and removed from the Linux kernel without restarting the system. Writing one is different from ordinary application development because the code runs in a privileged environment and interacts directly with hardware and system internals. This guide walks through that process in steps, starting from setting up a build environment and working through device drivers and other advanced topics.

The book source is written in TeX, a document preparation format common in technical publishing. To build the book yourself from source, you need a TeX toolchain such as TeXLive. The README provides installation commands for Ubuntu, Arch Linux, and macOS. Alternatively, you can use a pre-packaged container image that bundles all the required tools, which avoids installing them individually. Once the prerequisites are in place, a single build command produces either a PDF or an HTML version.

The sample code in each chapter is licensed under GNU GPL version 2, the same license as the Linux kernel. The book text uses the Open Software License, which allows reproduction and modification.

This is a documentation project, not a runnable application. Its intended readers are C programmers who want to extend the Linux kernel, such as people building device drivers or low-level system tools.

Where it fits