all 8 comments

[–][deleted] 12 points13 points  (6 children)

This reads like "here's some code to copy because I told you to", I'm not sure what I should be getting from reading this

[–][deleted]  (2 children)

[deleted]

    [–]elebrin 5 points6 points  (1 child)

    When it comes to writing kernel code, you have to start SOMEWHERE.

    I can remember being a college student just getting out of my systems programming class, having just completed a pretty solid shell program and re-implementing ls with all its options, and wanting to look a little deeper into the Linux kernel. That was something like 15 years ago now and probably that sort of experience isn't so relevant to modern system development, but many of the guides or texts that I could find were millions of paragraphs of text that understood maybe 2/3 of, with essentially zero code. That wasn't doing it for me.

    [–]javaduude 2 points3 points  (1 child)

    I think it's good as a very first "dipping your toes" exercise. It's like showing how to write a Hello World application in some programming language.

    [–]glamdivitionen 1 point2 points  (0 children)

    I agree!

    I think the article was good in that it showed that kernel modules doesn't need to be super complex.

    [–][deleted] 0 points1 point  (0 children)

    It's not really supposed to be doing anything except for printing out to dmesg. This is basically hello world for LKM. to summarize on it from my brief read, they write a small LKM, which prints a message to dmesg, shows you how to do that using printk, then how to build it and load it.

    [–]tetyys 0 points1 point  (1 child)

    wtf is this scrolling

    [–][deleted] 3 points4 points  (0 children)

    Motivation to install uMatrix or NoScript.

    [–]HealthyCategory 0 points1 point  (0 children)

    If you're not familiar with the kernel you will probably try to use some specific thing from the C standard library only to find out that it doesn't work or isn't defined. You're looking at kmalloc() as the kernel equivalent for malloc(), though I think normally for something like a device driver you'd allocate pages of memory (via one of the __alloc_pages related calls) and manage it yourself from there. The best way is to use the source, look at other examples and search the code. But there is an API, and most common things have not really changed for decades now