I wrote my first kernel model code today. It was in the form of a loadable module which I compiled and loaded into the running kernel. Interesting how easy it was. They really do seem to try and make it as easy as possible. I guess this is in the spirit of having other people do stuff for you because a) they can and b) its easy so you don't have to do it. Veru clever.
I tried to load my module into Fedora and it frankly wasn't impressed. It told me that my module was unsigned and that it 'tainted' the kernel... Mphh! Anyway thats because the kernel in Fedora 25 is compiled such that it only accepts signed code. Fine I guess so short of compiling a new kernel for Fedora 24, I switched to my Debian VM and loaded it module and its was all good.
A quick dmesg revealed the power of my achievement - 2 words - "hello kernel!".
What's particularly gratifying is the usage of the kernel's printk() function from the kernel API which is similar to user-mode printf().
I couple of weeks back I started reading a book about Linux device drivers and while it was interesting I slowly lost interest somewhere between block drivers and graphics drivers, piqued interest around the USB subsystem drivers and then well put the book down. The problem is just that. Unless you have a problem to solve, it just doesn't do enough for you. So, I having thought about it I'd like to write a USB device driver. The problem now is for what?
Maybe its time to 'make' a device. Oh yes. That's a suitable problem to overcome. Then it will be to plug that device into a computer and have it commnuicate with it - that's right a device driver!
Anyway today, I downloaded the latest kernel source code, compiled a default configuration for x64 and had a quick browse through the source - time to put my bib and start feasting.