Messages in this thread |  | | Date | Sat, 24 Apr 1999 17:48:36 -0400 (EDT) | | From | Greg Zornetzer <> | | Subject | Re: How/When does the kernel know to load a module? |
| |
look at kernel/kmod.c That contains the basic autoloading logic. Note the request_module call - this is the important one.
Grep the kernel sources for instances of request_module: this is how the kernel knows when to load a module. In the case of your network card, I believe that ifconfig calls somekind of function to activate the first ethernet device. If the ethernet device is not active already (the driver isn't already loaded into the kernel), it makes a call to request_module("eth0") (or the like) to load the driver. Also, remember that the linux kernel WILL NOT autodetect which of a series of network cards you have, and autoload the "right one". I think you're confused about net card probing. AFAIK, net card probing only goes on at kernel startup (for compiled-in drivers) or at module-load time (for modular drivers). If you have an NE2000 compatible card, you need to tell the module utilities (in /etc/conf.modules) that eth0 is really the ne2k driver: alias eth0 ne or the like for different drivers (I don't remember if that's the correct name for the ne2000 driver - I don't have one).
When you run ifconfig eth0 up and you've got a modular net driver, the order of events goes something like this: 1. ifconfig make a kernel call to set up eth0 for networking. 2. the kernel realized that it doesn't have a network driver bound to eth0 3. it calls request_module(eth0) 4. modprobe eth0 gets called. Modprobe uses the info in /etc/conf.modules to figure out that it needs to load the ne2k driver. 5. modprobe loads the ne driver 6. the ne driver probes any ne cards in the system, and initializes them 7. the kernel goes on its way, now that there's a network driver that's bound to eth0
Greg Zornetzer - gaz+@andrew.cmu.edu "Light shines brightest in the darkest night" http://www.contrib.andrew.cmu.edu/~gaz
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
|  |