Linux Kernel Module Programming Guide
sysprog21.github.io
sysprog21.github.io
Perhaps one of the authors could update the old page to notify/direct users to the new version? Still ranks first when I google for it
Old version: https://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html
Bit disappointed that this doesn't cover custom parsing of module parameters: always thought that was a bit underused.
Pity it's on GitHub Pages though, so people using IPv6 only can't access it. :(
https://github.com/sysprog21/lkmpg/releases/download/latest/... [PDF]
I’ve heard some dumb complaints in my time but the real beauty of this one is you made it on another site that’s IPv4 only (HN doesn’t yet support IPv6 either).
Thanks for the correction :)
Saying that it's a "dumb complaint" to point out that large parts of the world can't access the content is kind of taking the piss though. :(
You do actually realise that even users with only an IPv6 address can still get access to IPv4 sites via bridges (the names of which escape me off hand)?
Seems to be mainly people located in South East Asian countries, though I'd have to go trawling back through log history to get the exact details.
It doesn't work for protocols that embed IP addresses, like BitTorrent, since you'd need a protocol-aware proxy for that rather than just an IP firewall, but for something like HTTP there won't be any problem.
You could think of the userspace side as the gui you get with gpu drivers which interacts with a separate kernel space side
The general vibe I got when looking in to this is that the Linux kernel has more than enough contributors right now so they make no effort to make it beginner friendly or offer an easy on ramp. IIRC Linus said they have trouble simply reviewing all the changes they receive and if you want to help out Linux, your time would be better used on the non kernel projects.
Things like Gnome or Libre Office would be more than happy to receive help.
A lot of work goes into refactoring and cleaning up code, making things cleaner, adding documentation, adding static and dynamic checkers for locks, memory errors, and various other things, making useful common data structures and code into libraries, inspection and debugging tools, reimplementing as much hand-coded assembly as reasonably possible in C, adding a staging area in the tree and moving to a distributed vcs, there are automated CI tests that get kicked off when you post a patch to a mailing list.
In my opinion it is far nicer to develop for, and a lot of code is far nicer to read than it was 20 or even 10 years ago. It's simpler to write some basic hello world filesystem or device driver module because APIs have become a lot cleaner and there are a lot more checks. It is also now far easier let's say to develop a high performance multi-queue block IO subsystem that is mostly lock free and can steer interrupts to specific CPUs based on context and have all the platform specific PCI and interrupt issues and the different memory ordering behaviors of different CPUs all just work. Linux already has one of those though.
Outside of device drivers and new hardware enablement for really simple device types or minor updates to an existing device type, what the kernel is doing now is vastly more complicated. So it is a lot of work to make a significant useful change. This isn't because there is no interest in making it beginner friendly, it's because a lot more of the "easy" things are done.
The kernel has never had any official development guide or book. Various tutorials and howtos and books come and go along the way. Another good one,
https://www.kernel.org/doc/gorman/pdf/understand.pdf
They don't really scale at all. The device driver book scratched the surface of device drivers even back then. You can still read things like that and get an idea of the concepts which remain pretty similar, but the best way to really learn it beyond hello world stuff is getting into the code. If you want to write a device driver, start with a copy of a different driver of the same class which is well maintained, for example.
> and when asked about an updated version the response was something like "Back when it was written we needed more developers on linux but not anymore".
Not sure of the "we", but Linux kernel developers are in pretty decent demand today and the number of paid contributors seems to be pretty well growing. Certainly a lot since 2004.
> As well as the comment from linus which I can't find anymore where he says other OSS projects need help more than linux.
Yes that has long been true.
I'm not saying you're simply wrong, and I'm sure some people would find great benefit in more or more up to date books on it, but there has been no point where developers just decided that's enough of making Linux more friendly to newbies or have an easier learning curve. Nor has there ever been a great deal of effort to make it easier for newbies mind you. But as I said, people are always trying to clean things up and improve docs and add more seat belts trying to do staging and mentoring and things etc.... but it's just a difficult thing to improve.
My source is only my anecdote of contributing to Linux for ~20 years, so I admit I could well be biased or blind to some of these issues.
Bash handles several filenames specially when they are used in redirections, as described in the following table:
/dev/fd/fd
If fd is a valid integer, file descriptor fd is duplicated.
/dev/stdin
File descriptor 0 is duplicated.
/dev/stdout
File descriptor 1 is duplicated.
/dev/stderr
File descriptor 2 is duplicated.
/dev/tcp/host/port
If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open
a TCP connection to the corresponding socket.
/dev/udp/host/port
If host is a valid hostname or Internet address, and port is an integer port number or service name, bash attempts to open
a UDP connection to the corresponding socket.
Edit: Not to imply it's not a good idea. I think it is, so much so that the only reason it wasn't done long ago is because often a "good enough for most people" solution can sap the need for a different solution which has other benefits.These are usually a Google search away and the way people develop drivers even in professional settings.
For simple devices (e.g. I2C/SPI sensors) the functionality, number of registers, and procedures are usually very limited and it is not difficult.
Learn about FTRACE - https://jvns.ca/blog/2017/03/19/getting-started-with-ftrace/
Use ftrace to trace your favor .ko
- simple one such as serial port driver.
- usb driver
- usb to serial port driver,
- usb camera driver
- gpu driver (opensource intel/amd)