Date: Sun, 23 Jan 2000 15:35:26 +0800 From: Greg Lehey <grog@lemis.com> To: Bill Maniatty <maniattb@cs.rpi.edu> Cc: FreeBSD-doc@FreeBSD.org, maniatty@cs.albany.edu, freebsd-hackers@FreeBSD.org Subject: Re: Learning the FreeBSD Kernel Message-ID: <20000123153526.I930@mojave.worldwide.lemis.com> In-Reply-To: <200001230406.XAA43423@cs.rpi.edu>; from maniattb@cs.rpi.edu on Sat, Jan 22, 2000 at 11:06:41PM -0500 References: <200001230406.XAA43423@cs.rpi.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
[adding -doc, which is more appropriate for some of the questions] On Saturday, 22 January 2000 at 23:06:41 -0500, Bill Maniatty wrote: > Hello All: > > I have a student this semester in my Operating Systems class who would like > to become a bit more knowledgeable about systems software. I suggested > that he learn a bit about how device drivers are written in FreeBSD > as a minor project. My questions are: > > 1) Does any current documentation of how to write and/or install a > device driver exist in English (note C != English)? Yes, with reservations. > We would love to have a level documentation like the document by > Pragmatic at http://thc.pimmel.com/files/thc/bsdkern.html, we are > looking for a how to guide. Somewhere we have a tutorial. I think it's been retired because it's out of date, but it could be a very rewarding starting point for somebody who wanted to work his way into the material and either update it or bring out a new document based on the structure. This would also give the student good visibility in the (Free)BSD community. > 2) If no existing documentation exists, would it be a good idea to > put together a sort of how to guide for a simple driver (with an > eye to generalization later if warranted)? > > 3) If the answer to 2 is yes, can we get constructive help from the FreeBSD > community? Definitely. -hackers would be the right forum there. I would also personally commit to helping within the constraints of my other work. > Assuming that this constitutes an interesting project, what would be > a good initial approach? I was considering: > 1) Get and build the FreeBSD kernel (4.0?) > 2) Choose a non-essential device with a simple preexisting driver. > 3) Remove all trace of the driver from the kernel source. > 4) Reapply the changes used to install the driver (perhaps one step at a time). > We could suggest some simple sanity checks to support stepwise refinement. (1) and (2) are a good start. You don't need to remove the old driver; it would in fact make it easier for debugging purposes if it remained. Instead, choose another major number and name, and write a new driver. This procedure is definitely *not* documented, but it's the way we introduce new drivers, and I think a couple of other people who have done it would be pleased to help. A possibly better alternative is to find a device which isn't currently supported by FreeBSD and write a driver for it. This would have the advantage that the work would also be a contribution to FreeBSD. The question that I can't answer here is: what would be an appropriate device? > If this is a good idea, I would like the following help from the FreeBSD > community: > 1) Identify a simple driver (perhaps something like a joystick > driver?) I don't know if anybody uses it any more. > 2) Identify all source code associated with the driver (including configuration > files, makefiles etc...). Some files may have only one or two lines > devoted to the driver, so we will need to know how to recognize such lines > and would appreciate pointers to such lines. That should be relatively straightforward after examination of the old tutorial, the sources and hier(7). If not, ask away. Important directories are: /sys symlink to /usr/src/sys; I'll use it below /sys/config generic configuration files /sys/i386/config configuration files for i386 /sys/dev sources for generic device drivers /sys/isa sources for generic ISA device drivers /sys/i386/isa sources for i386-only ISA device drivers Greg -- Finger grog@lemis.com for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000123153526.I930>