I've never understood how you manage kernel modules at boot time

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Feb 25 18:49:20 UTC 2008


On Mon, Feb 25, 2008 at 01:25:38PM -0500, Mike Oliver wrote:
> Quoting Lennart Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org>:
> 
> >Another way to make things load is with aliases such as:
> >alias char-major-195-* nvidia
> >
> >That means whenever something tries to open a /dev node for major 195
> >then load the module named nvidia to try and provide such a device.
> 
> OK, this is the exact spot where neither the documentation nor anyone
> else ever seems to explain what's going on.  Exactly *why* does
> "something try to open a /dev node for major 195"?  How can I predict
> that that's going to happen -- or make it happen if it otherwise 
> wouldn't -- so
> that the alias command will make the module load?

If you have a static /dev directory, then you might have something like
this:

crw-rw---- 1 root video 195,   0 2008-02-17 10:39 /dev/nvidia0

This character device has majpr 195 and minor 0.  So if you try to open
it, and the kernel goes "No driver is handling that major/minor right
now, so I will ask modprobe for help".

modprobe then sees an alias that says anything with major 195 on a
character device should load something named 'nvidia' so it loads the
module nvidia and returns to the kernel.  Hopefully the nvidia module
then loaded and now provides a driver for the character device 195,0 and
the original request can proceed, otherwise the kernel returns -ENODEV
to the program trying to open /dev/nvidia0.

--
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list