[ale] You are here Home » Articles » Xavier Calbet's articles Writing device drivers in Linux: A brief tutorial

Ed Cashin ecashin at noserose.net
Fri Aug 24 09:48:28 EDT 2012


That looks like a really nice article.  Are you using it to learn so
that you can write a driver?

I just skimmed it, but I think there wasn't much about "when things go
wrong".  But things do go wrong when you mess with the kernel.  To
make a nice short tutorial, he probably couldn't cover all this, but
it would be great to give the reader some clues about:

  * capturing console output

    When the driver breaks things, you get most of the information you
need in the Oops that's printed to the console.  If that's just a
virtual console, most of it is not available.  By using a serial
console...

   console=tty0 console=ttyS0,9600n8

   ... or netconsole (see Documentation/networking/netconsole.txt
http://is.gd/34MhCz) ...

   netconsole=6666 at 10.220.76.1/eth4,514 at 10.220.5.229/00:30:48:F9:BD:69

   ... you can get all the information.

  * printk levels

    There are different levels for printk.  You can be lazy and use
KERN_CRIT so that the debugging printks you add will always show up in
the output you examine, especially if you intend to remove the
debugging printks.

  * BUG and WARN_ON

   You can use BUG to put assertions in your code.  If your code
relies on something being true, assert that it's true.  If BUG goes
off, you'll have a nice oops to look at and think about.

On Tue, Aug 21, 2012 at 9:41 AM, Boris Borisov <bugyatl at gmail.com> wrote:
> http://www.freesoftwaremagazine.com/articles/drivers_linux
>
> Probably most of advanced guys on the list already know how to do it.
> I find it informative !
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo



-- 
  Ed Cashin <ecashin at noserose.net>
  http://noserose.net/e/
  http://www.coraid.com/


More information about the Ale mailing list