Re: Auto kernel module loading

From: Alastair G. Hogge <agh_at_tpg.com.au>
Date: Thu, 17 Apr 2003 14:20:29 +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
Received on Wed Apr 16 2003 - 19:20:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:03 UTC