Hi all,
Although some people say that merely looking through the linux source code should be enough for somebody to learn how to write device drivers, I just think it wouldn't be as fast as learning from a book. However, all the books I see on amazon are ancient(covers linux 2.x my ubuntu 16.04 is linux 4.4). Does anyone know of a newer book published or to be published?
If the old books are still relevent then I will buy them and learn what I can. I just wanted y'alls opinion on the matter.
The problems with reading from a book in this case is that by the time the book is finished, there's probably already an API described in the book that has changed.
I'm of the opinion that interfaces should be documented. I've run into more than one interface in the kernel that feels more like a minefield than an interface. One in particular (the haptic feedback API) had a completely undocumented case of memory marshaling that had been causing a bug in my driver for months. I had been freeing it and it was causing a free on an invalid pointer.
The best way to learn how to work with the kernel is to write code. Setup a VM, setup a virtual serial port, and write code, starting with examples. You can crash the VM as many times as you need to in order to learn. Look at other drivers for examples. If you need to accomplish something, look at the subsystem provided by the kernel in order to do that. If they don't provide it, you might have to implement it yourself.