Linux Kernel Modules

Hey everyone. I have a question, doing an lsmod gives me a list of all the loaded modules for my system. But how did they know to load? my /etc/modules files is empty, so how did these modules know to load themselves on boot time? If I were to take this hard drive to another computer with a different architecture and devices, would a different set of modules be shown when I did an lsmod?

Also is there any way to see what each of the modules really is? Their names are rather vague.. ehci_hcd, libphy, dcdbas..

Yes

modinfo might give you some insight, what a module is for, like:

$ modinfo dcdbas
filename:       /lib/modules/2.6.32-431.3.1.el6.i686/kernel/drivers/firmware/dcdbas.ko
alias:          dmi:*:[bs]vnD[Ee][Ll][Ll]*:*
license:        GPL
author:         Dell Inc.
version:        5.6.0-3.2
description:    Dell Systems Management Base Driver (version 5.6.0-3.2)
srcversion:     0AFF90155EABD0524320AF0
depends:
vermagic:       2.6.32-431.3.1.el6.i686 SMP mod_unload modversions 686

Thanks hergp!

But to my earlier question, how does the kernel know to load these specific modules for my specific hardware?

Plug-and-play makes this relatively straightforward, devices contain identification codes. Linux drivers use PCI and USB ID's to tell what drivers it should use for what hardware. Drivers keep a list of ID's they're compatible with.

Sometimes the only update a driver needs, to use a new piece of compatible hardware, is another ID added to its list.

Great, now what's the relationship between plug n play and the udev daemon? Is it udev's job to query the device, get the ID number and determine what hardware is plugged in, thus adding or removing the needed modules?

udev manages device nodes. The kernel sends events to the udev daemon whenever a device is discovered or removed. Then udev uses a collection of rules to create or remove device nodes in the filesystem or perform other actions.

udev does not load or unload kernel drivers.