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

Robert P. J. Day rpjday-L09J2beyid0N/H6P543EQg at public.gmane.org
Mon Feb 25 19:37:38 UTC 2008


On Mon, 25 Feb 2008, Mike Oliver wrote:

> Quoting "Robert P. J. Day" <rpjday-L09J2beyid0N/H6P543EQg at public.gmane.org>:
>
> > On Mon, 25 Feb 2008, Mike Oliver wrote:
> > > 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?
> >
> > i'm not sure if this is addressing your question, but you *seem* to be
> > asking exactly what it is that attempts to create a special device
> > file.  is *that* what you're asking?
>
> Possibly.  If you would be kind enough to answer that question, I might
> be able to figure out whether it's the one I'm asking.

well, it's the job of kernel code to "register" for a major device
number and possibly multiple minor numbers with a call to, say,
"register_chrdev".  if that call succeeds, then a record of that is
made in /proc/devices:

$ cat /proc/devices
Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
 14 sound
 21 sg
 29 fb
 81 video4linux
...

  in addition, in the old days, once that succeeded, it was still
*your* job to use "mknod" to create a device file with the appropriate
attributes.

  these days, that's normally done automatically via "udev" and the
udev rules.  but in terms of where the whole process starts, it's the
kernel code that gets things rolling by attempting to allocate a major
device number as above.

rday
--


========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================
--
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