The Linux Kernel Module Programming Guide
Forum rules
Do not spam and respect other forum members!
Do not spam and respect other forum members!
The Linux Kernel Module Programming Guide

Download here:
https://www.iot-tech.dev/ff/lkmpg.pdf
1 Introduction
1.1 Authorship
1.2 Acknowledgements
1.3 What Is A Kernel Module?
1.4 Kernel module package
1.5 What Modules are in my Kernel?
1.6 Do I need to download and compile the kernel?
1.7 Before We Begin
2 Headers
3 Examples
4 Hello World
4.1 The Simplest Module
4.2 Hello and Goodbye
4.3 The __init and __exit Macros
4.4 Licensing and Module Documentation
4.5 Passing Command Line Arguments to a Module
4.6 Modules Spanning Multiple Files
4.7 Building modules for a precompiled kernel
5 Preliminaries
5.1 How modules begin and end
5.2 Functions available to modules
5.3 User Space vs Kernel Space
5.4 Name Space
5.5 Code space
5.6 Device Drivers
6 Character Device drivers
6.1 The file_operations Structure
6.2 The file structure
6.3 Registering A Device
6.4 Unregistering A Device
6.5 chardev.c
6.6 Writing Modules for Multiple Kernel Versions
7 The /proc File System
7.1 The proc_ops Structure
7.2 Read and Write a /proc File
7.3 Manage /proc file with standard filesystem
7.4 Manage /proc file with seq_file
8 sysfs: Interacting with your module
9 Talking To Device Files
10 System Calls
11 Blocking Processes and threads
11.1 Sleep
11.2 Completions
12 Avoiding Collisions and Deadlocks
12.1 Mutex
12.2 Spinlocks
12.3 Read and write locks
12.4 Atomic operations
13 Replacing Print Macros
13.1 Replacement
13.2 Flashing keyboard LEDs
14 Scheduling Tasks
14.1 Tasklets
14.2 Work queues
15 Interrupt Handlers
15.1 Interrupt Handlers
15.2 Detecting button presses
15.3 Bottom Half
16 Crypto
16.1 Hash functions
16.2 Symmetric key encryption
17 Virtual Input Device Driver
18 Standardizing the interfaces: The Device Model
19 Optimizations
19.1 Likely and Unlikely conditions
19.2 Static keys
20 Common Pitfalls
20.1 Using standard libraries
20.2 Disabling interrupts
21 Where To Go From Here?