From owner-freebsd-hackers Sun Jan 23 20:50:58 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from yana.lemis.com (yana.lemis.com [192.109.197.140]) by hub.freebsd.org (Postfix) with ESMTP id 099A8151A8; Sun, 23 Jan 2000 20:50:47 -0800 (PST) (envelope-from grog@mojave.worldwide.lemis.com) Received: from mojave.worldwide.lemis.com (j13.ktb6.jaring.my [161.142.234.27]) by yana.lemis.com (8.8.8/8.8.8) with ESMTP id PAA12824; Mon, 24 Jan 2000 15:19:41 +1030 (CST) (envelope-from grog@mojave.worldwide.lemis.com) Received: (from grog@localhost) by mojave.worldwide.lemis.com (8.9.3/8.9.3) id MAA02849; Mon, 24 Jan 2000 12:39:21 +0800 (MYT) (envelope-from grog) Date: Mon, 24 Jan 2000 12:39:21 +0800 From: Greg Lehey To: Bill Maniatty Cc: Jeroen Ruigrok/Asmodai , FreeBSD-doc@FreeBSD.ORG, maniatty@cs.albany.edu, freebsd-hackers@FreeBSD.ORG Subject: Re: Learning the FreeBSD Kernel Message-ID: <20000124123920.F2643@mojave.worldwide.lemis.com> Reply-To: Greg Lehey References: <20000123125439.A20851@daemon.ninth-circle.org> <200001231648.LAA53658@cs.rpi.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <200001231648.LAA53658@cs.rpi.edu>; from maniattb@cs.rpi.edu on Sun, Jan 23, 2000 at 11:48:39AM -0500 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sunday, 23 January 2000 at 11:48:39 -0500, Bill Maniatty wrote: > Hello Jeroen: > Jeroen Ruigrok (in response to Greg Lehey and myself): > >> -On [20000123 11:11], Greg Lehey (grog@lemis.com) wrote: >>>> 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. >> >> *nod* There are certainly people who are be able and willing 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? > > First we want to get the mechanism of driver installation down, then > try our hands at writing our own driver. I fear that if we roll our > own driver software we may find that if we have errors (not that we > ever have errors mind you :-) we may not be able to isolate the > cause. This is why I was leaning towards reinstalling a working > driver first. There are two almost completely separate issues in writing drivers: 1. Writing the code to deal with the device. Having good vendor documentation helps here. 2. Fitting this code into the BSD framework. Having good OS documentation helps here. I can't agree with Mike Smith that reading the code is adequate. It certainly doesn't apply to newcomers, but it doesn't even apply to seasoned hackers like Mike: the BSD style doesn't provide for adequate comments, and so what you see from the code is mainly tactics, not strategy. For the fun of it, go through the sources in /usr/src/sys/pci and try to identify the hardware which each driver supports. The newer ones are very good in this respect, but I'd guess there would be between 10% and 20% of the files where you will be left wondering what they do. Read the code and you'll see how they do it, but you may find that that isn't enough for you :-) >> You could try usb devices and contact Nick Hibma for his expertise on >> that area. > > How mature is the USB driver technology? If it is pretty > preliminary we may wish to visit that later. Please recall that we > are on a learning curve here. I've been meaning to look at USB stuff too. So far, I haven't been brave enough. I do think that the idea of taking an existing driver and cloning it is a good one. Maybe we can identify an old and mouldy one which needs rewriting. I've heard things about the floppy disk driver, but I'm not sure that it hasn't already been done, though the code suggests it's pretty old. 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