OpenBSD Journal

Writing device drivers for OpenBSD?

Contributed by jose on from the /dev/my_stuff dept.

Josh Ziering writes:
"Are their any primers to start hacking out device drivers in OpenBSD like their is for linux? Having been told, 'Just go through the code', I have concluded I just wont pick it up that way. Ideally, I want to hack out a sound driver for a laptop so I can go BSD on the road too. Any help, or links are greatly appreciated.


Every time I start down this path I quickly run away, as I'm just not skilled enough. Anyone care to share some resources for Josh?

(Comments are closed)

  1. By Anonymous Coward () on

    NetBSD Documentation: Kernel programming

    1. By Pedro Bastos () on

      "Writing UNIX device drivers" by Pajari
      Nice book - should help you out.

  2. By Anonymous Coward () on

    there is no quick/easy/painless way.

    going through the code is basically just what you do. its how many, many people have learnt. it is quite logical really. just dont be afraid of trying, edit an existing driver, add a few printfs here and there and see what happens, then start making more serious changes unitll you understand how it all works together.

    find a driver that is a) documented (ie proper vendor documentation (i think 3com relases its specs)) b) for actual hardware you have (so you can play with it) then just mess with it, tweak it, watch it break, fix it. your kernel will panic, you will spend a lot of time looking at fsck running, and (more or less) no-one will help you. but dont worry about, enjoy it, fsck time is a good time to look over the documentation you have and try and work out what happened. if you panic the kernel, who cares? it doesnt matter, just work out what happened and keep going. no-one will say its an easy thing to learn, but many people have and i honestly believe with patience and hard work nearly anyone could learn it (after all, this is real-world science :P).

    if i were starting again i would've gotten a sparc to learn on as its architecture is much easier to understand than i386 (imho of course). understanding how your architecture really works is crucial (most bigger libraries have vendor manuals).

    i will say, dont ask for help on the openbsd lists, they are there for problems with openbsd not to help you to learn how to program.


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 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.]