LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-09-2009, 03:40 PM   #1
Dims
Member
 
Registered: Feb 2009
Posts: 151

Rep: Reputation: 15
How kernel knows what modules to load?


While doing

make menuconfig

I see, that I am pointing directly which driver or component should be compiled "as module". This makes me think, that the names of modules to use by kernel are hardcoded into the kernel.

But recently I have installed infiniband drivers and installer created /lib/modules/<name>/kernel/drivers/ infiniband directory with many *.ko files.

Did installer recompiled my kernel? Or it is possible for kernel to load modules which names are not hardcoded into it?
 
Old 06-09-2009, 03:43 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
What distro are you using? For me, the file /etc/modules tells the kernel which modules it wants loading at boot.
 
Old 06-09-2009, 03:49 PM   #3
Dims
Member
 
Registered: Feb 2009
Posts: 151

Original Poster
Rep: Reputation: 15
I am using Fedora 9, and /etc/modules is absent here.

But does distro affects modules stuff really?

I was thinking, that kernel and modules as a part of it, are independent of distribution.

What command

make modules_instal

does while compiling kernel?

Doesn't it copies *.ko files from kernel source to systemwide place? If so, then how it is possible for this kernel to work if I have downloaded it form kernel.org site which is unrelated with distribution?
 
Old 06-09-2009, 03:53 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The kernel modules for a kernel are located under /lib/modules/$(uname -r)

Some of the modules are copied to the initrd file. Others are loaded later. Look in your /etc/modprobe.conf, /etc/modprobe.d/* & /etc/modprobe.conf.local files.
 
Old 06-09-2009, 03:55 PM   #5
Dims
Member
 
Registered: Feb 2009
Posts: 151

Original Poster
Rep: Reputation: 15
Okay, but what is the algorithm? Who decides, what file to load and what file to read?
 
Old 06-09-2009, 05:26 PM   #6
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 299

Rep: Reputation: 62
Ok, you are on Fedora 9. The configuration file is /etc/modprobe.conf or if the directory /etc/modprobe.d exists, then the entries in that directory.

A few modules are compiled directly into the kernel. Modules that are needed at boot time are loaded by GRUB from initrd.
 
Old 06-09-2009, 05:39 PM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
I don't think the OP is asking about that. Those that you all mention are just userland scripts.

He might be more concerned about the mechanism that triggers the mechanism and how a kernel knows that a given module is the one that should handle a given device. And I guess that this post could get a better answer in the kernel subsection of the forum, where someone with a real knowledge about the issue will possibly be able to give a much more accurate response than I could give him.

That's why I am reporting this to be moved to a more convenient section.
 
Old 06-09-2009, 07:48 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Modules have to be loaded into memory - they then are effectively extensions to the kernel itself. When you installed the drivers (using rpm or yum presumably), it will have updated the modprobe.conf or modprobe.d as mentioned above. These are used by the (distro specific) init scripts at boot time to determine what modules should be loaded. A module can in need be loaded at any other time - it's possible for the install process to do this for you as well.
See "man modprobe" and "man modprobe.conf".

As for the later question, modules register their interest(s) with the kernel- it determines when they get control.
 
Old 06-10-2009, 02:11 AM   #9
Dims
Member
 
Registered: Feb 2009
Posts: 151

Original Poster
Rep: Reputation: 15
Does kernel tries to boot a driver for each specific graphics card during boot?

If "yes", then where I can find a dozens of lines, prescribing it to do that?

Or kernel knows my card model beforehand?

If "yes", then what will happen if I remove graphics card?
 
Old 06-10-2009, 05:08 AM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Moved: This thread is more suitable in <Linux - kernel> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 06-10-2009, 05:30 AM   #11
vamsiguturu
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
Module installation FAL

Hi am trying to install tcp probe tool

1) Downloaded new kernel.
2) Installed new kernel with tcp probe enabled in Networking category.
3) Restarted the laptop on new kernel.
4) But I dont see tcp_probe getting installed.
5) Giving following error when I try to do modprobe
FATAL: Module tcp_probe not found.

Let me know how to install tcp_probe
 
Old 06-17-2009, 11:56 PM   #12
vamsiguturu
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
Got the solution

Quote:
Originally Posted by vamsiguturu View Post
Hi am trying to install tcp probe tool

1) Downloaded new kernel.
2) Installed new kernel with tcp probe enabled in Networking category.
3) Restarted the laptop on new kernel.
4) But I dont see tcp_probe getting installed.
5) Giving following error when I try to do modprobe
FATAL: Module tcp_probe not found.

Let me know how to install tcp_probe

After changing the MakeFile of the Kernel it got worked
 
Old 06-18-2009, 06:12 PM   #13
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Generally speaking, the mechanism which is used to handle device-insertion is called hotplug.

When a USB device is attached or removed, the kernel has the means of broadcasting a notification to "anyone who might be listening," and that "anyone" will be the hotplug daemon. Using various information tables, hotplug figures out if any drivers need to be loaded.

It's a bit more complicated than that, but there's the idea.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtualbox kernel modules won't load after updating kernel in openSUSE 11.0 JamesHall SUSE / openSUSE 6 02-03-2009 04:36 PM
how to load modules in kernel? shariefbe Linux - Newbie 1 08-14-2008 10:31 PM
Kernel Modules, to load or not to load VampireL0rd Linux - Software 3 07-24-2007 09:20 PM
How to load kernel modules ginda Linux - Software 2 01-12-2007 06:06 AM
new kernel 2.6.7 cant load modules short101 Debian 8 08-21-2004 09:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration