Linux module priorities?

Clint Savage herlo1 at gmail.com
Fri Aug 10 05:14:32 MDT 2007


On 8/9/07, Andrew Jorgensen <andrew.jorgensen at gmail.com> wrote:
>
> Does anyone know how Linux (modprobe, udev, whoever else might be in
> control of this) currently chooses which module gets bound to a device
> when more than one module claims to support it?  It looks to me like
> it just loads all the modules that claim it and the one that gets
> loaded first (or the one that binds first?) gets the device.
>
> If that's true it causes all sorts of problems, like the USB HID
> driver grabbing a more specific device (like my nifty USB phone's
> keypad) and the mess that is the four prism-related wireless drivers
> (wvlan, prism2, orinoco, and hostap).
>
>
> Is there any way to control it, other than blacklisting, recompiling,
> or forcing a particular module into memory before another?
>
>
So, Linux isn't quite *that* stupid.  But it does have some limitations.
I'd say that Linux does have some limitations, and indeed from what I
understand, modules do get loaded as you suggest.  However there are several
things that help.

/etc/modprobe.conf (at least that's where it is in RH based distros) can be
informed of aliases.  For example, the following line will tell the kernel
that when I say "ifup eth0" it will activate the e1000 module:

alias eth0 e1000

And if you have two network cards (whether they be the same type or not),
mobprobe can't tell them apart, except they have different mac addresses.
Again, Linux has a simple solution for this.  Check out
/etc/sysconfig/network-scripts/ifcfg-ethX (e.g. eth0, eth1, etc.  again RH
based distros).  In there is a two lines that tells the network commands
which card is bound to which device.

In my /etc/sysconfig/network-scripts/ifcfg-eth0 file right now I have:

# Intel Corporation 82573L Gigabit Ethernet Controller
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:16:41:55:6a:38
ONBOOT=yes
IPADDR=192.168.22.200
NETMASK=255.255.255.0
GATEWAY=192.168.22.254
PEERDNS=no
TYPE=Ethernet

Note HWADDR= and DEVICE= lines.  These help when modules can't.  Clarifying
to the system that "hey, I'm the correct network device!" as needed.

Of course, if you use NetworkManager or some other device controller, ymmv.
Hope this helps.

Thanks in advance!
> - Confused and worried that Linux is rather stupid in this area
>   (Andrew)


Never worry, Linux Rules!  And if you don't like the way it works, you could
always submit a patch. :)

Cheers,

Clint



More information about the PLUG mailing list