Refer to an earlier email where Greg mentioned about the loading order of modules. And possibly the following (out of many others) URL: http://ubuntuforums.org/showthread.php?t=304491 http://wiki.archlinux.org/index.php/Udev after building the modules, the tool "depmod" is used to analyze for dependencies, and the file /lib/modules/version/modules.dep is created. this file is then used by modprobe to determine the correct loading order of the modules. this tool in turn will depend on "insmod" tool to load the module. this describe the loading of module by user or automated script. but a module can be loaded from within the kernel itself: just search for "request_module()" API usage. For network: /hdc1/download/2.6/linux-2.6_latest/net>grep request_module *.c socket.c: request_module("bridge"); socket.c: request_module("8021q"); socket.c: request_module("dlci"); socket.c: request_module("net-pf-%d", family); (request_module() in turn depend on call_usermodehelper() to call modprobe to load the module from userspace) For hotplugging (when a new device is connected to a hotpluggable bus - PCI, Firewire, USB etc) - the tool /sbin/udevd is used. (where the kernel communicate information via netlink socket with udevd). For PCI bootup details check: http://www.makelinux.net/ldd3/chp-12-sect-1.shtml (LDD3) and http://www.xml.com/ldd/chapter/book/ch15.html (LDD2) ("Boot Time", "where configuration transactions" are explained), and then: http://wiki.ubuntu.org.cn/UbuntuWiki:HardwareDetection http://linux.chinaunix.net/techdoc/develop/2008/06/26/1013420.shtml where netlink sockets information are sent to userspace udevd are described. >From drivers/pci/hotplug, u can search the board_added() where the board is dynamically added and detected. PCI hotplug is implemented in pci_hotplug_core.c. Check out udevmonitor (I don't know much) for more info. On Sat, Oct 18, 2008 at 6:32 PM, J. H. Kim <frog1120@xxxxxxxxx> wrote: > I'm reading kernel source code for the first time. First, I'd like to > know how the PCI driver works. > I found the routines which scans PCI bus and and add data structure of > the found devices into bus data structure as linked list. > But I got lost there. Each device probe routine seems to be called after > the related module is loaded. > I cannot find the routines which call modprobe or insmod for desired > modules related to found devices and I wonder how the module for each device > is selected. > So, I'm finding where the PCI network driver module is loaded, for example. > Any advice would be greatly appreciated. > > Regards, > J.H.Kim -- Regards, Peter Teoh -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ