From owner-freebsd-current@FreeBSD.ORG Wed Apr 16 21:20:44 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F3FB137B401 for ; Wed, 16 Apr 2003 21:20:43 -0700 (PDT) Received: from mail2.tpgi.com.au (mail.tpgi.com.au [203.12.160.58]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6011443FCB for ; Wed, 16 Apr 2003 21:20:42 -0700 (PDT) (envelope-from agh@tpg.com.au) Received: from pen-ts1-2600-181.tpgi.com.au (pen-ts1-2600-181.tpgi.com.au [203.213.3.181]) by mail2.tpgi.com.au (8.12.9/8.12.9) with ESMTP id h3H4KKXX003244 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Thu, 17 Apr 2003 14:20:33 +1000 From: "Alastair G. Hogge" To: Terry Lambert Date: Thu, 17 Apr 2003 14:20:29 +0000 User-Agent: KMail/1.5.1 References: <200304171136.57515.agh@tpg.com.au> <3E9E1D1D.307F8CA7@mindspring.com> In-Reply-To: <3E9E1D1D.307F8CA7@mindspring.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304171420.29892.agh@tpg.com.au> X-Kaspersky-Antivirus: Passed cc: freebsd-current@FreeBSD.ORG Subject: Re: Auto kernel module loading X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Apr 2003 04:20:44 -0000 On Thursday, 17 April 2003 03:18, Terry Lambert wrote: > "Alastair G. Hogge" wrote: > > Hello list, > > > > Just the other day I was configuring/striping my kernel to the barest I > > could manage. I was doing this to hopefully reduce kernel build time. > > > > Now after adding 60 lines to loader.conf to load the modules I need, I > > began thinking is there a way for FreeBSD to load the modules automaticly > > at boot time itself? > > No. Bugger. > > If not, would be hard to implement such a feature? How would someone go > > about doing such a thing? As I would be happy to give it a go....but > > don't know where to start. > > It would not be too hard. You could implement seperate sections > in the modules for the probe routines, and then load the section > seperately, only loading the module itself if it probed true. Most > likely, you would want to reuse the same area of memory for each of > the seperate probe routines, to avoid fragging kernel memory (any > more than it already frags itself). > > If you felt that were too much work, you could implement a seperate > data section with PCI ID and other information. You could probably > fit each and every one into a single 4K page in each individual > driver. This would probably cover most of the drivers that you > would ever have to worry about seeing be actively needed. OK. Already this appears way out of my league. What I was planning: Using the PCI Id database provided by Martin Mares. Modifying the DB to include FreeBSD (maybe any *BSD) modules for the matching/implemented devices. Then with that info when FreeBSD loads and picks up an device id it checks the list, gets the info, checks if there is an module and then loads it. I don't know if I'm making much sense at all, but something of the sort: Kernel loaded. Kernel scans for device ids. Kernel has found PCI Id 0x4567a. Kernel calls Foo(0x4567a). Foo() Found 0x4567a in DB. Module exists...loading... Exit. I just don't know where to start, my knowledge of the FreeBSD source tree is "I know my kernel config is in /sys/i386/conf/" > > Does the documentation project have some info to help? I'm cvsup-ing them > > right now as I once recall seeing an article titled something like > > "Programmers guide to FreeBSD" > > www.freebsd.org, under documentation. It has a link to the > programmers guide, online. Great :-) I'm just installed my local copy, this will save me tieing up the phone constantly while resorting to an online resource. > -- tErry -Alastair