The best Linux kernel book for most programmers right now is Linux Kernel Programming, Second Edition by Kaiwan N. Billimoria. It’s the only general kernel title from a trade publisher written for a 6.x kernel, and its chapter 4 module built unchanged on kernel 7.3. For device drivers, add Linux Device Driver Development, Second Edition, or Thierry Gayet’s newer Linux Kernel Programming if you need block, USB and network drivers too. To start free, read The Linux Kernel Module Programming Guide.
Age is the catch with Linux kernel books. The driver core dropped an argument from class_create() in 6.4 and 6.19 removed in_irq(), so a chapter that built when it went to print can stop at the first make. We built the companion code from five of these books and wrote down what broke. Every build in this guide was run on Fedora 45 with kernel 7.3.4 in November 2026, and each book’s price and stock were checked again in December 2026.
Pick a Book by the Code You Write
Most readers need one core book plus one for their specialty. Start from the kind of kernel code you’ll actually be writing:
- Best first kernel book: Linux Kernel Programming, Second Edition
- Best for board and embedded drivers: Linux Device Driver Development, Second Edition
- Best for block, USB and network drivers: Linux Kernel Programming by Thierry Gayet
- Best for character drivers and interrupts: Linux Kernel Programming Part 2
- Best for finding kernel bugs: Linux Kernel Debugging
- Best system call reference: The Linux Programming Interface
If you have never written C, fix that first; our list of C and C++ books has the beginner titles. Readers who want to trace and profile a running kernel rather than change it should look at the eBPF books instead, because that’s where tracing work happens now.
How We Picked and Tested
We searched Amazon’s catalog by publisher (Packt, O’Reilly, No Starch Press, Addison-Wesley, BPB, Manning and Apress) as well as by keyword, because a keyword search for “linux kernel” returns more self-published titles than trade books. Each pick had to be a print edition sold new on Amazon in December 2026, and all but The Linux Programming Interface were in stock; we kept that one because nothing replaces it. Every pick’s contents come from the publisher’s page or the book’s companion repository on GitHub.
For the lab we brought a Fedora 45 VM up to kernel 7.3.4, installed the matching kernel-devel, and ran each book’s module code through the kernel’s own build system. Linux Kernel Programming and its Part 2 built without errors; Part 2 also printed which: No such file or directory several times because the Fedora cloud image lacks which, and that noise is harmless. Linux Device Driver Development failed in all three chapters we tried, Linux Kernel Debugging failed on its first kprobe example, and Gayet’s book landed in between. The kernel.org release table showed 7.3 as stable, 7.4 in release candidates and 6.18 as the newest longterm branch when we checked, so no book here targets anything newer than 6.6.
Some well-known titles did not make the list, mostly because of age:
- Understanding the Linux Kernel, whose 2005 third edition is still the latest, and Linux Kernel in a Nutshell (2006)
- Mastering Linux Device Driver Development by John Madieu (Packt, 2021), which goes deeper into multimedia and audio drivers but predates most of the API breaks in our table
- Linux System Programming, 2nd Edition (2013), now scarce on Amazon
- Rust kernel books, which so far come only from small presses and self-publishers
Three new titles are still on preorder, so they are not reviewed here. You can order Billimoria’s Linux Device Drivers in Action (Packt, January 2027), Javier Carrasco’s Linux Device Driver Development Projects (Packt) and Andrew Sohn’s Methodical Introduction to the Linux Kernel (Wiley-IEEE Press), a process management book based on kernels 6.0 to 6.6, ahead of release. Lorenzo Stoakes’s The Linux Memory Manager from No Starch is sold as an early access PDF while it is being finished, and it is the one to watch if memory management is your area.
Check the Kernel Each Book Targets
The kernel column matters more than the publication date. It tells you which API changes in the build section below will hit you while you work through the code:
| Book | Publisher, date | Kernel it targets | Pages | Best for |
|---|---|---|---|---|
| Linux Kernel Programming, 2nd Ed | Packt, February 2024 | 6.1 LTS | 826 | Modules, memory, scheduler, locking |
| Linux Kernel Programming Part 2 | Packt, March 2021 | 5.4 era | 452 | Char drivers, interrupts, user-kernel interfaces |
| Linux Device Driver Development, 2nd Ed | Packt, April 2022 | Not stated | 708 | Device tree, I2C, SPI, GPIO, IIO |
| Linux Kernel Programming (Gayet) | BPB, June 2025 | Not stated | 462 | Block, USB, network and bus drivers |
| Linux Kernel Debugging | Packt, August 2022 | 5.10 LTS | 638 | KASAN, KCSAN, ftrace, KGDB |
| Linux Kernel Development, 3rd Ed | Addison-Wesley, June 2010 | 2.6 | 480 | How the subsystems are designed |
| The Linux Programming Interface | No Starch, October 2010 | 2.6.35, glibc 2.12 | 1,552 | The system call API |
| System Programming in Linux | No Starch, September 2025 | Not stated | 1,048 | Learning system programming in C |
| Mastering Embedded Linux Development, 4th Ed | Packt, May 2025 | 6.6, Yocto 5.0 | 710 | Buildroot, Yocto, real boards |
Two of the three newest books do not name a kernel version at all, so you can’t tell from the listing which API they expect. That’s why we built their code instead of trusting the publication date, and why you should clone a book’s repository before you buy it if one exists.
1. Linux Kernel Programming, Second Edition
This is the book for a C programmer writing their first kernel module. Kaiwan N. Billimoria wrote the newest general kernel title from a trade publisher, and the only general one aimed at a 6.x kernel, and its repository is kept current:
You build the 6.1 LTS kernel from source across two chapters and write a first loadable module. The rest of the book works through process and thread internals, memory management, the kernel memory allocators, the CPU scheduler (including cgroups v2) and two chapters on synchronization. The companion repository says the code was tested on Ubuntu 22.04 and 23.04, Fedora 38 and 39, and a Raspberry Pi 4 running the author’s own 6.1 build. That means you can follow it on a laptop VM or a cheap board.
Its hello-world module from chapter 4 built without a single change on kernel 7.3.4 in our lab, and the author was still pushing errata to the repository in May 2026. The failure you’ll most likely meet with this book is not the code at all but Secure Boot, covered further down, because a self-built module is unsigned. The 6.1 branch you build in chapter 2 is still a supported longterm kernel on kernel.org.
The weak spot is scheduler internals. Its scheduler chapters describe CFS, and Linux 6.6 replaced CFS with EEVDF, so treat those two chapters as history. It sold for $25 to $35 when we checked. Check the current price on Amazon.
2. Linux Kernel Programming Part 2
Buy this one when you’ve finished your first modules and want to write a real character driver. It picks up where the first book’s module chapters end:

You write a misc class character driver, then connect it to user space through procfs, sysfs, debugfs, netlink sockets and ioctl. Later chapters handle hardware interrupts (IRQ allocation, threaded handlers, tasklets and softirqs), memory-mapped peripheral I/O, kernel timers, kthreads and workqueues. It was written for the 5.4-era kernel, a branch kernel.org no longer maintains.
Age is less of a problem than that suggests. The author kept the repository current after print, with a README and errata update as recent as October 2026, and its chapter 1 misc driver built cleanly on 7.3.4 for us. Clone the repository rather than typing the listings from the page, because the repository has moved on since the book was printed.
Pass on it if synchronization is all you need, since the second edition of pick 1 already has two chapters on it. Expect to pay $35 to $45, since it sells near list. Check the current price on Amazon.
3. Linux Device Driver Development, Second Edition
John Madieu writes for embedded developers bringing up a board, so this book spends its pages on the buses and subsystems an SoC exposes rather than on PC hardware:
Its 17 chapters start with building and tailoring the kernel, then cover these driver topics:
- Describing hardware with the device tree
- Platform drivers, I2C and SPI client drivers
- The regmap framework and DMA
- Timekeeping and concurrency managed workqueues
- The GPIO, IIO and input subsystems
The book assumes a Cortex-A board (a Raspberry Pi, BeagleBone or Jetson Nano works) because most of the subsystems only make sense with real pins and buses attached.
Of the books we built, this one ages worst on a current kernel. Chapter 4’s character driver, chapter 7’s platform driver and chapter 16’s I2C GPIO expander all failed to build on 7.3.4, and the repository has not had a commit since March 2024. All three predate the class_create() change in 6.4, the void remove() callbacks and the removal of gpiochip_add() in 6.11 in favor of gpiochip_add_data(). Each fix is a few lines, and the build section shows the errors so you can recognize them.
Don’t buy it for code that compiles as printed; buy it for the subsystem explanations, which have not changed much. It sold for $35 to $45 when we checked. Check the current price on Amazon.
4. Linux Kernel Programming by Thierry Gayet
Same title as pick 1, different book. Gayet’s 2025 book from BPB is for the reader who needs driver types the Packt titles skip, block devices, USB and network interfaces among them:

Its 13 chapters run from kernel history and the Linux device model through character drivers, block drivers and the VFS, USB drivers with libusb on the user side, and network drivers. Later chapters cover Linux Security Modules, kernel memory and DMA, the I2C, SPI, serial, PCI and RTC interfaces, process management and debugging. That’s the widest driver spread of any book here, at 462 pages, so each topic gets an introduction rather than the depth Madieu gives device tree work.
Publication year didn’t predict how its code built. We cloned the BPB companion repository and built five drivers on 7.3.4:
- Chapter 5 read-only and ioctl char drivers: built
- Chapter 5 read/write char driver: failed on
class_create() - Chapter 8 network driver: built once we added a Makefile
- Chapter 11 I2C driver: failed on
probe(),remove()andi2c_new_device()
The two char drivers that built check the kernel version before calling class_create(), and the one that failed does not. The I2C example calls i2c_new_device(), which left the kernel in 5.8, so parts of the code are older than the book. The repository also ships folders named Chapter 05 with a space, which the kernel build refuses, and some chapters have no Makefile at all; the build section shows both fixes.
Skip it if you only write board drivers, where pick 3 goes deeper. It sold for $30 to $40 when we checked. Check the current price on Amazon.
5. Linux Kernel Debugging
The third Billimoria title here is for the developer whose module loads but misbehaves. It’s the only pick built around finding what’s wrong:
The chapters open with instrumentation (printk and the dynamic debug framework), move to static and dynamic kprobes, then spend several chapters on memory defects with KASAN, UBSAN, SLUB debug and kmemleak. Data races get their own treatment with KCSAN, tracing is done with Ftrace and trace-cmd, and the last part single-steps module code under KGDB. The repository’s examples run on 5.10 kernels under Ubuntu 21.04 and 21.10.
Its code ages faster than its ideas. The first kprobe example in chapter 4 no longer builds, because the shared convenient.h header calls in_irq(), which kernel 6.19 removed:

Most of the examples include that header, so changing in_irq() to in_hardirq() once in convenient.h should get them past that line. Only make that edit on a 7.x kernel, because in_hardirq() first appeared in 5.11 and the 5.10 kernel the book targets does not have it. KASAN and Ftrace work the same way on 7.x, but menu paths and config option names will not always match your kernel’s make menuconfig. Pair it with our guide to compiling the kernel from source, because most of these tools need a debug build.
Leave it until you’ve written a few modules; it assumes you already know the code you’re debugging. It cost $40 to $50 when we checked. Check the current price on Amazon.
6. Linux Kernel Development, Third Edition
Robert Love’s book is for readers who want to know why the kernel is built the way it is. It’s sixteen years old and still explains the design better than it explains any API:
Its 20 chapters go subsystem by subsystem, from process management and scheduling through system calls, interrupts and bottom halves, synchronization, timers and memory management. Later chapters cover the virtual filesystem, the block I/O layer, the page cache, and devices and modules. Each one explains the design before the code, which suits readers who want to know why before they type anything.
Everything in it describes the 2.6 kernel, so read it for concepts and never for function signatures. The scheduler chapter is about CFS, which EEVDF replaced in 6.6, so treat the code excerpts as 2.6-era illustrations rather than something to compile.
If you learn by typing code, start with pick 1 instead. It sold for $25 to $35 when we checked. Check the current price on Amazon.
7. The Linux Programming Interface
Driver writers need to know what user space expects from them, and Michael Kerrisk’s reference answers that. He maintained the Linux man-pages project for years, and this is his book on the system call layer every driver is reached through:
At 1,552 pages it covers the whole API between user space and the kernel:
- Files, file I/O and filesystems
- Processes, signals, threads and timers
- Pipes, FIFOs, message queues, semaphores and shared memory
- Sockets and terminals
Kernel work needs it because you have to know what user space expects of the read(), ioctl() or mmap() your driver implements. A driver that returns the wrong error code from one of them breaks programs that followed the man page to the letter.
The book went to press current as of Linux 2.6.35 and glibc 2.12, but Kerrisk keeps a list of API changes since publication, kept up kernel release by kernel release. Read the two together and the age stops mattering much. There’s no second edition yet.
Price is the catch: the hardcover sold for $95 to $105 when we checked in December 2026, and Amazon had it temporarily out of stock. Print copies come and go, so order it and wait, or take the Kindle edition, which stayed in stock. Check the current price on Amazon.
8. System Programming in Linux
Stewart N. Weiss’s book is for the reader who finds Kerrisk too dense. It covers the same territory as pick 7, but as a course, so it’s the gentler way in:
Its 19 chapters start from core concepts and build up through file I/O, filesystems, signals, timers and process creation, then move on to pipes, daemons, threads, alternative I/O methods, terminals and NCurses. Each chapter has you write working programs rather than read a reference entry.
Kernel internals and driver code are out of scope, so it belongs on this list as the user-space half of the picture. Read it before pick 1 if you’ve written C but never called fork() or handled a signal.
You can skip it if you already own The Linux Programming Interface. It sold for $70 to $80 when we checked. Check the current price on Amazon.
9. Mastering Embedded Linux Development, Fourth Edition
This one is for engineers building a whole Linux system for a board, not just a driver. Chris Simmonds wrote the first two editions alone, and Frank Vasquez has co-written it since the third. The fourth is from May 2025, so its kernel and build tools are recent:

Its 21 chapters build complete systems with Buildroot 2024.02 LTS and Yocto Project 5.0 (Scarthgap) on a Linux 6.6 kernel, using a BeaglePlay, a Raspberry Pi 4 and QEMU as targets. It covers toolchains, U-Boot, the kernel build, root filesystems, over-the-air updates with Mender or balena, and talking to hardware from user space without writing a driver. That last part is often the right answer for a prototype.
The repository’s errata says the exercises need an x86-64 Ubuntu 24.04 host, so on an Apple Silicon Mac you’ll be working inside an x86-64 Ubuntu VM (the author suggests Parallels with Rosetta). Readers coming from microcontrollers will also want our IoT books for the device side.
Readers who only write drivers for PCs and servers can skip it. It sold for $20 to $30 when we checked. Check the current price on Amazon.
Start With the Free Kernel Books
You don’t have to spend money to write your first module. Four free resources are worth your time, and the module guide tracks current kernels more closely than any printed book:
| Resource | What it covers | Current to |
|---|---|---|
| The Linux Kernel Module Programming Guide | Modules, char devices, procfs, sysfs, interrupts, crypto | Actively maintained, kernel 5.10 or newer |
| linux-insides | Boot, initialization, interrupts, system calls, timers | Booting chapter updated for 7.3.0, the rest still under revision |
| Linux Kernel Teaching | University lectures and labs, drivers through networking | Course material, not version-tracked |
| Linux Device Drivers, 3rd Edition | The classic driver book, free under Creative Commons | 2.6.10, from 2005 |
The module guide, known as lkmpg, is the best free starting point, but even a maintained guide trips on a current kernel. Its very first example, hello-1.c, uses the old magic init_module() name, and objtool on 7.3.4 refuses it. The second example registers its functions through module_init() and builds:

Running make in the guide’s examples directory stops at that first file, so build examples one at a time from hello-2 onward: copy each .c file into its own directory with a one-line obj-m Makefile, as the screenshot shows. Skip startstop as well: it is a two-file module that also uses the init_module() name objtool refuses. LDD3 is still worth reading for the concepts, but treat every function signature in it as wrong until you’ve checked it against the current headers.
Build Book Code on a Current Kernel
Every one of these books asks you to build modules against your running kernel, and on a 2026 distribution that fails in a few predictable ways. On Fedora, install the compiler, the kernel headers and dwarves, which provides the pahole tool the build uses for BTF type data:
sudo dnf -y install gcc make elfutils-libelf-devel dwarves git
Then install the headers on their own line, so a missing headers package cannot take the toolchain down with it:
sudo dnf -y install kernel-devel-$(uname -r)
dnf treats an unavailable package as a failed transaction, so on one combined line a missing kernel-devel would also leave gcc and make uninstalled. Naming the package as kernel-devel-$(uname -r) asks for headers that match the kernel you’re running, not just the newest ones in the repository. If dnf answers with No match for argument, the troubleshooting entry for that error below has the fix. Otherwise, confirm both versions before building anything:
uname -r
rpm -q kernel-devel-$(uname -r)
Both lines should show the same version, as they did on our lab VM:
7.3.4-300.fc45.x86_64
kernel-devel-7.3.4-300.fc45.x86_64
With matching headers, clone a book’s repository and build a chapter through the kernel’s build system. This is the platform driver from chapter 7 of Linux Device Driver Development:
git clone https://github.com/PacktPublishing/Linux-Device-Driver-Development-Second-Edition.git
cd Linux-Device-Driver-Development-Second-Edition/Chapter07
make -C /lib/modules/$(uname -r)/build M=$PWD modules
The kernel’s own build flags turn incompatible pointer types into errors, whatever GCC version you have: scripts/Makefile.warn in the 7.3 headers adds -Werror=incompatible-pointer-types. A callback with the wrong return type therefore stops the build instead of printing a warning. These are the lines that stop it:
platform-dummy-char.c:61:19: error: too many arguments to function ‘class_create’; expected 1, have 2
61 | dummy_class = class_create(THIS_MODULE, "dummy_char_class");
| ^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
platform-dummy-char.c:104:19: error: initialization of ‘void (*)(struct platform_device *)’ from incompatible pointer type ‘int (*)(struct platform_device *)’ [-Wincompatible-pointer-types]
104 | .remove = my_pdrv_remove,
| ^~~~~~~~~~~~~~
Each error maps to one change in the kernel’s API. We checked the version that introduced each one in the kernel source, and these are the eight you’ll meet in the books’ code:
| Book code | Current kernel | Changed in |
|---|---|---|
i2c_new_device(adap, info) | i2c_new_client_device(adap, info) | 5.8 |
int I2C remove() callback | Returns void | 6.1 |
I2C probe(client, id) | probe(client), one argument | 6.3 |
class_create(THIS_MODULE, "name") | class_create("name") | 6.4 |
struct gpio_chip from <linux/gpio.h> | Include <linux/gpio/driver.h> | 6.4 |
int platform remove() callback | Returns void | 6.11 |
gpiochip_add(chip) | gpiochip_add_data(chip, NULL) | 6.11 |
in_irq() | in_hardirq() | 6.19 |
The fix for class_create() is a one-word edit. Chapter 4’s character driver fails only on that call, so move to that chapter and remove THIS_MODULE:
cd ../Chapter04
sed -i 's/class_create(THIS_MODULE, "dummy_char_class")/class_create("dummy_char_class")/' dummy-char.c
make -C /lib/modules/$(uname -r)/build M=$PWD modules
The missing-prototype warnings stay, but the build now links the module, which is how it finished on our 7.3.4 VM:
MODPOST Module.symvers
CC [M] dummy-char.mod.o
CC [M] .module-common.o
LD [M] dummy-char.ko
BTF [M] dummy-char.ko
Skipping BTF generation for dummy-char.ko due to unavailability of vmlinux
For the remove() callbacks, change the function to return void and delete its return 0; line. The probe change works the same way: drop the i2c_device_id argument and call i2c_client_get_device_id() inside the function if the driver still needs it. Chapter 16’s GPIO expander fails first with field ‘chip’ has incomplete type, because since 6.4 <linux/gpio.h> no longer provides struct gpio_chip. Include <linux/gpio/driver.h> instead and replace gpiochip_add(chip) with gpiochip_add_data(chip, NULL).
Makefile: *** building multiple external modules is not supported
The kernel build splits M= on spaces, so a directory name with a space looks like two module paths. Gayet’s repository names its folders Chapter 05, Chapter 08 and so on, and building straight from one fails before compiling anything:
make: Entering directory '/usr/src/kernels/7.3.4-300.fc45.x86_64'
Makefile:141: *** building multiple external modules is not supported. Stop.
Copy the chapter to a path without spaces and build there. Some of that repository’s chapters, including the network and I2C drivers, ship only a .c file, so write the one-line kbuild Makefile yourself before running make:
mkdir -p ~/books
git clone https://github.com/bpbpublications/Linux-Kernel-Programming.git ~/books/gayet-lkp
cp -r ~/books/gayet-lkp/"Chapter 08"/code_8_net_driver ~/books/
cd ~/books/code_8_net_driver
echo "obj-m += net_driver.o" > Makefile
make -C /lib/modules/$(uname -r)/build M=$PWD modules
On our VM that produced net_driver.ko with no compiler warnings at all, tied with the Linux Kernel Programming hello-world for the cleanest build of the test. You’ll need the same Makefile line, with the right object name, for any chapter you copy out of that repository.
insmod: ERROR: could not insert module: Key was rejected by service
This one is not the book’s fault. A module you build yourself is unsigned, and a machine with Secure Boot enabled refuses to load it. Loading the Linux Kernel Programming hello-world module on our lab VM failed like this, and the kernel log names the cause:

On a throwaway VM, the simplest fix is to turn Secure Boot off in the VM’s firmware settings. On a machine you care about, sign the module instead, using the kernel’s scripts/sign-file and a key you enroll with mokutil --import. On Fedora the script ships at /usr/src/kernels/$(uname -r)/scripts/sign-file, and the kernel module signing guide covers the steps. Check which case you’re in first:
mokutil --sb-state
Our GCP image printed SecureBoot enabled, which is why a module that built cleanly still refused to load.
No match for argument: kernel-devel
dnf prints this when the headers for your running kernel have left the repositories. Our Fedora 45 VM booted on 7.2.13 while the repositories had already moved to 7.3.4, so the headers install stopped at the first error:
Failed to resolve the transaction:
No match for argument: kernel-devel-7.2.13-300.fc45.x86_64
There is no package to install for that kernel any more, so the fix is to move to the newest one, as in the next error.
make: *** /lib/modules/…/build: No such file or directory
This is the error you get when there are no headers for the kernel you’re running. The build link in /lib/modules/$(uname -r) points into /usr/src/kernels, and only the kernel-devel package creates that directory, so without it the link dangles and make has nothing to build against. On our VM the booted 7.2.13 kernel had no matching kernel-devel left in the repos, as the previous error shows. Bring the system up to date, install the headers for the newest kernel, then reboot into it:
sudo dnf -y upgrade --refresh && sudo dnf -y install kernel-devel && sudo reboot
Use install for the headers rather than upgrade, because dnf upgrade kernel-devel refuses a package that is not installed yet. After the reboot, uname -r and rpm -q kernel-devel-$(uname -r) agreed again on 7.3.4. On Debian and Ubuntu the matching package is linux-headers-$(uname -r), and on Kali the same steps are in our guide to installing kernel headers on Kali.
warning: the compiler differs from the one used to build the kernel
The lkmpg examples Makefile passes CC=cc, so the build compares the string cc with gcc and warns even though both are the same GCC 16.2.1. It’s harmless. The related pahole warning appears when dwarves is not installed; with it installed, a distribution kernel only reports that it skipped BTF generation because vmlinux is not available, which doesn’t matter for learning modules.
Buy for the Kernel You’ll Ship
Start with Linux Kernel Programming, Second Edition, because it’s the only general book written for a 6.x kernel and its first module built unchanged on 7.3. Add Part 2 or Linux Device Driver Development for drivers, or Gayet’s book if your hardware is a disk, a USB device or a NIC, and expect to fix the older API calls yourself using the table above. Keep Love’s book and The Linux Programming Interface for the concepts that have not moved. When you need something newer than any of these, the kernel’s own documentation and our notes on what changed in kernel 7.1 are where the current APIs are written down. Our Linux books for sysadmins cover the administration side if that’s where you’re starting from.





