Subject: Module Load order

Is there any specific module load order in Linux? If there is a GPL
driver and binary driver for a particular device which will be loaded?
Is there any logic to load GPL driver built inside the kernel? Or is the
module search and load is handled by some other component (like udev)
and not the kernel? Sorry for my ignorance if I have asked this to a
wrong list.


2012-02-26 13:38:12

by Alan

[permalink] [raw]
Subject: Re: Module Load order

On Sun, 26 Feb 2012 13:38:27 +0530
Prasanna Kumar T S M <[email protected]> wrote:

> Is there any specific module load order in Linux? If there is a GPL
> driver and binary driver for a particular device which will be loaded?
> Is there any logic to load GPL driver built inside the kernel? Or is the
> module search and load is handled by some other component (like udev)
> and not the kernel? Sorry for my ignorance if I have asked this to a
> wrong list.

There should never be two drivers for one piece of hardware. There may be
two for the same PCI ID however which grab different device versions. In
that case both drivers get loaded and the probe routine figures out which
to bind.

Alan

2012-02-26 14:30:19

by Kay Sievers

[permalink] [raw]
Subject: Re: Module Load order

On Sun, Feb 26, 2012 at 09:08, Prasanna Kumar T S M
<[email protected]> wrote:
> Is there any specific module load order in Linux? If there is a GPL
> driver and binary driver for a particular device which will be loaded?
> Is there any logic to load GPL driver built inside the kernel? Or is the
> module search and load is handled by some other component (like udev)
> and not the kernel? Sorry for my ignorance if I have asked this to a
> wrong list.

The order is defined by the link-order of the kernel build, the order
of appearance in the Makefile. The kernel build system creates
compiled-in modules which always have a defined link-order of init
functions. Loadable modules create a file modules.order which is
installed along with the kernel modules. The modules.order file read
by the modprobe tool, and if multiple modules match on the same
hardware alias, the modules are always loaded in the order specified
by that file.

In general, the compiled-in order and the loadable-module order are
always predictable and reflect the order of appearance in the kernel
Makefile.

Out-of-tree/proprietary modules do not hook into that facility and
there is usually no predictable order.

It is possible though, that the out-of-tree module can be installed in
a separate directory in lib/modules and the search order is defined in
/etc/depmod.d/*.conf. Not sure, if that always works, it's something
that usually only enterprise Linux versions use, need and test, and
which might not be available and doesn't get tested in usual
distributions which do not care at all about driver priorities.

Kay