LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 05-07-2013, 08:11 AM   #1
mamsadegh
LQ Newbie
 
Registered: May 2013
Posts: 1

Rep: Reputation: Disabled
How Linux Kernel Understands Which Driver it should load for a specific hardware?


Hi
Sorry for newbie question!
Actually after more than 10 years of using Linux and even developing several linux kernel drivers, when I ask this question from myself, still I can't give a clear answer to it.

In a fairly new Kernel, 3.0 or newer,

Suppose you have a usb device.
And a bunch of .ko drivers in /lib/modules folder.

You attach the usb device to your system.

How does the linux mechanism decides which USB driver it should load into the kernel?

So, the driver gets loaded before an event get dispatched to udev.
I want to know who is loading the driver?

Best,
Thanks.
 
Old 05-07-2013, 02:43 PM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,442
Blog Entries: 4

Rep: Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503Reputation: 1503
Member Response

Hi,

Welcome to LQ!

Linux Kernel Interactive Map is good resource with link referenced topics. Map is zoom-able and you can direct link to expanded reference by hovering mouse cursor to get a link to open informational link. Great visual reference for Kernel dissection & understanding.

http://www.ibm.com/developerworks/li.../l-initrd.html provides;
Quote:
excerpt from "Inside the Linux boot process" (developerWorks, May 2006) explores the Linux boot process from the initial bootstrap to the start of the first user-space application;

When the second-stage boot loader is in RAM and executing, a splash screen is commonly displayed, and Linux and an optional initial RAM disk (temporary root file system) are loaded into memory. When the images are loaded, the second-stage boot loader passes control to the kernel image and the kernel is decompressed and initialized. At this stage, the second-stage boot loader checks the system hardware, enumerates the attached hardware devices, mounts the root device, and then loads the necessary kernel modules. When complete, the first user-space program (init) starts, and high-level system initialization is performed.
That's Linux boot in a nutshell. Now let's dig in a little further and explore some of the details of the Linux boot process.
I like IBM's Technical library for in-depth detailed information for Linux & Gnu/Linux. Great White papers!

Above links are from SlackwareŽ-Links ! More than just Slackware links.
 
Old 05-07-2013, 11:17 PM   #3
jefro
Guru
 
Registered: Mar 2008
Posts: 12,073

Rep: Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518Reputation: 1518
A very simple statement would be that host os and hardware usb function watches for some change. Then it asks the usb what it is. The usb would report the type of device along with specific chipset and vendor id. There is some more usb data but to make it simple let's stop there. Then that data is compared to available support usually it has to directly match some device by name and vendor and chip id. If match then it is loaded.


The answer could get quite complex if you really want to know the nuts and bolts of the process.

Reference resources would include usb hardware and software specifications.

http://www.linux-usb.org/

https://en.wikipedia.org/wiki/Universal_Serial_Bus

http://www.intel.com/content/www/us/...fications.html
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
is there a hardware specific kernel builder tool? gtludwig Slackware 5 11-24-2012 01:25 PM
[SOLVED] Kernel 2.6.39.1 --> load only a specific module lfs_mm Linux - Kernel 2 11-17-2011 04:37 AM
How to load a specific device driver hasmak Linux - Newbie 11 01-02-2009 02:07 PM
CentOS 5.2 Linux Kernel 2.6.18-92.1.10.el5 - Cannot Load e1000e driver jreige Linux - Hardware 1 09-18-2008 01:57 PM


All times are GMT -5. The time now is 11:27 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration