Subject: Re: Sample device-driver-as-LKM code?
To: Rafal Boni <>
From: Bill Studenmund <>
List: tech-kern
Date: 04/02/1999 10:56:55
On Fri, 2 Apr 1999, Rafal Boni wrote:

> I'm thinking about hacking up a device driver for some custom hardware on
> one of the systems I own.  To make my life easier (and to refrain from
> rebooting thousands of times), I'd like to code this driver up as an LKM
> first.

Good idea.

> However, I don't see any sample LKM code for device drivers, and was wondering
> if anyone had (a) a sample LKM device driver, (b) ideas on what parts of the
> system an LKM'd device-driver needs to interface with (autoconfig machinery,
> interrupts, ...) and any restrictions on those interactions.

Forget about the autoconfig machinery. You won't need it.

Interrupts will depend on the architecture you're targeting and how it
handles interrupts.

There is one device driver which might be interesting. In
sys/lkm/arch/mac68k/iwm, there is a floppy driver. It's registered as a
misc (rather than a device) lkm as it is both a character and block
device. The stock routines help you with being one or the other, not both.

I realize that's sketchy, so ask questions!

Take care,