Live data from Hacker News

The Linux Kernel Module Programming Guide

github.com

21–30 of 32 posts

Re: The Linux Kernel Module Programming Guide

#23
post #22

Tried to make text size larger at https://sysprog21.github.io/lkmpg/ and could not, it stays fixed. It would be great to fix this problem.

Yeah, he needs to float his paragraph boxes so it can change text size when going from portrait to landscape (like rotating mobile device for better viewing).

Re: The Linux Kernel Module Programming Guide

#24

Just a warning if you do embedded work with Linux (RPi, Beaglebone, etc)... this guide doesn't cover the Devicetree APIs. Doesn't even acknowledge their existence.

> this guide doesn't cover the Devicetree APIs Is there a guide for that?

Read the Documentation/devicetree directory in the kernel sources and look at how a few drivers implement their documented bindings.

This isn't a snarky RTFM comment. The usage model file in the kernel documentation gives good motivation for what device trees are used for and their basic structure, and the APIs to pull data from them are straightforward enough that you can probably figure them out by looking at an example.

Re: The Linux Kernel Module Programming Guide

#25
post #16
post #15

Earlier quoted context omitted.

Yep. The device tree and kernel modules are actually two seperate concepts - the former is just a data structure that describes the hardware for a system and the latter is a way of delivering the drivers independently of the kernel. Just make sure to run `depmod -a` after copying it into /lib/modules.

nice! I wasn't sure exactly how the ordering happens between (kernel loads the device-tree) and (kernel scans /lib/modules for stuff to autoload).

There is (or can be) some overlap between the two.

As an example, you may want to create a kernel module that can be configured through the device tree (e.g. binds to an arbitrary SPI/I2C bus, requires hardware-specific config). You can add a node for your module to the device tree and assign it a "compatible" property, which is just an arbitrary string you define to represent your module. If you then make your module export the same string using the MODULE_DEVICE_TABLE macro, the kernel will figure out that your module is the one that implements that node in the device tree, and it will call your module's probe callback to initialize the module, passing in the context from the device tree node (e.g. you can get a reference to the SPI/I2C bus hosting your device).

As I understand it, this is the standard way to implement drivers for devices that sit on buses that don't support automatic detection (e.g. not PCIe / USB).

Re: The Linux Kernel Module Programming Guide

#26
Not sure if the eating555 is the author or whether the author is watching this thread...

This is awesome.. my only comment is the first thing I went to do was to copy and paste the code blocks and found end of line whitespace and double line breaks were included (presumably for the line numbering etc.)

e.g.

sudo apt-get update

apt-cache search linux-headers-`uname -r`

Re: The Linux Kernel Module Programming Guide

#27
post #10

can you update the Makefile so it generate a PDF only? Also, the "make all" doesn't seems to be working as expected here. Probably missing some dependency.

https://github.com/sysprog21/lkmpg/releases # Check the item "Assets", and you can get latest PDF and HTML files.

Re: The Linux Kernel Module Programming Guide

#28
post #22

Tried to make text size larger at https://sysprog21.github.io/lkmpg/ and could not, it stays fixed. It would be great to fix this problem.

https://github.com/sysprog21/lkmpg/releases # Alternatively, check the item "Assets", and you can get latest PDF file. I am looking for the feasible solutions to render LaTeX scripts in HTML.

Re: The Linux Kernel Module Programming Guide

#29

Earlier quoted context omitted.

The author is pretty open to any kind of criticisms and suggestions. It would be great if you open an issue to inform him the missing contents.

Already did

Thanks for submitting issue(s). The motivation of updating "The Linux Kernel Module Programming Guide" was for educational purpose. I agree with the idea to mention new kernel features such as Devicetree.

Re: The Linux Kernel Module Programming Guide

#30

Not sure if the eating555 is the author or whether the author is watching this thread... This is awesome.. my only comment is the first thing I went to do was to copy and paste the code blocks and found end of line whitespace and double line breaks were included (presumably for the line numbering etc.) e.g. sudo apt-get update apt-cache search linux-headers-`uname -r`

I am maintaining the content referred by the above hyperlink. At the moment, my students and I do not have sufficient understanding of publishing tools. Please check the PDF instead. https://github.com/sysprog21/lkmpg/releases
Post reply on HN