OpenBSD Journal

OpenBSD kernel modules?

Contributed by jose on from the option-LKM dept.

chris writes :
"Recently I have been increasingly interested in OS level programming. Since I love OpenBSD, I figured it would be a good place to start. I am very interested in the support for LKMs as this will allow me to ease into kernel level programming without taking all that time for recompiles. However, the struggle to find up to date documentation is daunting and can be discouraging. Have any of you played with OpenBSD LKMs in 3.0/3.1/-current? What resources are there for people interested in learning about the OpenBSD kernel? I have taken theoretical classes on OS design, but implementation is another ball gaem. Yes there is man and /usr/src.. but what other avenues are there? "
As Art recently said , fix something that you'd like to have working, that's the best way to learn.

(Comments are closed)


Comments
  1. By Anonymous Coward () on

    I think Theo and the crew have said many times in the archives that the best way to do it is to just jump in, make something better, and submit it. They can't do it and document *how* to do it at the same time.

  2. By fansipans () on

    it took me a week of reading kernel code to understand how to write a /dev/fansipans driver which would do a simple printf() back with whatever was given to it. ymmv. rtfs. byob. grep is your friend. find is your friend. also there was an article on deadly a little while ago about this very subject. though i'd say the best way to learn (as in getting to know the whole system) is to study each and every file that touches lkms. start with /sys/kern/kern_lkm.c. if you _really_ want to learn this stuff then get familiar with the source itself (though it does take patience and much napkin doodling).

  3. By chris () on

    I understand that with limited resources and the rapid development of projects like obsd there is little room for extensive documentation. While I am grateful for the work that the team does... where else in the computing industry can you get away with [absolutely] no formal documentation? (save the it's free BS please.. just saying no docs is an extreme) Maybe it would be a good idea to have volunteers for starting to make up some loose docs on *BSD or obsd (besides man pages or am i starting a huge whining thread on deadly?) I can read the source, and run the tools grep/find/man with the best of them. I am looking for some insight into what's going on, through docs, examples or chats with those who know what is going on. Daemon news has some lkms for obsd help but it's outdated and finding out what is wrong and what is changed is nearly impossible. It's just sad to see the state of affairs for BSD based systems when there is so much Linux-centric documentation floating around [ of course the user base is larger but ...]

    Thanks for the input. I'll keep reading the source like I have... maybe it will all must make sense! ;)

    ::chris

  4. By chris () on

    I understand that with limited resources and the rapid development of projects like obsd there is little room for extensive documentation. While I am grateful for the work that the team does... where else in the computing industry can you get away with [absolutely] no formal documentation? (save the it's free BS please.. just saying no docs is an extreme) Maybe it would be a good idea to have volunteers for starting to make up some loose docs on *BSD or obsd (besides man pages or am i starting a huge whining thread on deadly?) I can read the source, and run the tools grep/find/man with the best of them. I am looking for some insight into what's going on, through docs, examples or chats with those who know what is going on. Daemon news has some lkms for obsd help but it's outdated and finding out what is wrong and what is changed is nearly impossible. It's just sad to see the state of affairs for BSD based systems when there is so much Linux-centric documentation floating around [ of course the user base is larger but ...]

    Thanks for the input. I'll keep reading the source like I have... maybe it will all must make sense! ;)

    ::chris

  5. By Oogly () oogly@boogly.com on mailto:oogly@boogly.com

    When you track -current you will get a better understanding of how things are glued together. You do not have to rebuild userland everytime either, just try tracking the kernel for awhile (you may have to update tools - but again, you learn more). Then take a look at some of the drivers, see if you can grok how the driver framework works. It is not too difficult once you master grep. Look in conf/files for a particular driver and just start looking. All the while when you hit problems tracking -current, try to fix them. Do not complain if you cannot, someone else has probably seen the problem as well. When you see the solution, remember it. Eventually you will get a good feel for how it is all glued together.

  6. By Matt () on

    3 examples in /usr/share/lkm

    good luck!

  7. By Chris Humphries () chumphries@drauku.net on http://drauku.net

    http://www.blahonga.org/~art/openbsd/todo.html

    (ps-> this is on a related note)

  8. By RC () on

    For the Administrators, LKMs are a horiffic idea. If you've taken a look at Linux or FreeBSD, you realize you need to make a great number of changes when you change a piece of hardware. What I've loved about OpenBSD is that no matter what, you can plug the hard drive into an entirely different system with practically no modifications.

    Or do we want Linux... insmod with most modules corrupted, manually editing /etc/modules.conf, recompilation of the kernel every week. Et Al. Ex-Linux users know exactly what I mean. (or, like me, they had forgotten the horror until forced to use it recently).

  9. By panda () on

    a while ago , peter werner submitted a nice tutorial for openbsd lkm's:

    http://deadly.org/article.php3?sid=20010812210650

    this should give you a good start

  10. By Mike () mike@blandest.org on mailto:mike@blandest.org

    The above URL (http://deadly.org/article.php3?sid=20010812210650) rocks..

    I wrote a couple of LKMs after reading the tutorial above.. one to do process hiding and the other to do kernel-mode keystroke logging. They're free/open source & located @ http://www.insidiae.org/~mike/code/misc/index.html.

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]