Kernel Code

Some years ago when I was looking for good reference books on the Linux kernel I didn't find anything very contemporary. The best I could find were books on the 2.6 version from a decade previous, and someone I was working with at the time mentioned that there aren't many recent books because anyone with that depth of knowledge on kernel hacking tends to get hired quickly by companies wanting drivers for their electronics gadgets. The kernel has its own documentation folder within the repo, and although possibly that might be technically accurate it's still not the best learning resource.

So in the usual DIY fashion I forked the Linux Kernel Module Programmer's Guide (LKMPG) and tried running the examples. Of course on more recent kernel versions nearly all of the examples other than the most simple ones failed to compile, and that then became a learning exercise to find out how the kernel had changed since 2001 when that guide was originally written, and possibly why the changes were made. I made it a low priority project to keep maintaining the guide and update the examples whenever new kernel changes introduced breakage.

As you might imagine, there have been a few changes since 2001. Recently I've added basic stuff about blocking, crypto, hash functions, the missing sysfs chapter, tasklets and the driver model. I expect there's also a fair amount more stuff which could be documented with examples which a beginner could follow. It may sound complicated, but I think one of the main reasons for the success of the Linux project is that writing a kernel module is actually not as hard as you might expect and so the barrier to entry is quite low. If you know C or C++ then there's a good chance that you can also write a kernel module, although subsequently getting it back upstream into mainline is a whole other skill set.

As far as I'm aware the version of LKMPG which I maintain is the most up to date anywhere. If you search around for it you can find many copies, but they're nearly always of the original long out of date book version. You can find my version at:

The future of kernels

Perhaps the main reason why I've done software development all my adult life (and a large proportion of childhood) is that it's something which is always changing, and so never gets boring.

Kernels and operating systems are no exception and if I were to speculate then I'd guess that perhaps Linux won't be king of the kernels in another five or ten years. Haiku never caught on, but Google appears to be developing a microkernel and Redox is also an early stage microkernel based system which might be of particular interest for security-related things. You might think that microkernels are a failed evolutionary lineage, but potentially if they can be made to run well then they're small and so very attractive in terms of security auditing compared to the giant monolith of Linux. Possibly you might want something like that running a server or for "internet of things" devices.