LinuxQuestions.org
Register a domain and help support LQ
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 03-08-2011, 11:11 PM   #1
morris chen
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Rep: Reputation: 0
How to adjust the order of loading device driver(built-in type)


Dear Guys,

Would you know how the kernel decides the order of loading device driver(built-in type)?
For the ko type, I could control the order by editing rc.c file.
However, for the built-in type, I don't know how to control it.

Thanks a lot.

Regards,
Morris
 
Old 03-08-2011, 11:38 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
If you need one to load before another, compile the one you want to load first into the kernel and the one you want to load second as a module.
 
Old 03-09-2011, 12:12 AM   #3
morris chen
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by andrewthomas View Post
If you need one to load before another, compile the one you want to load first into the kernel and the one you want to load second as a module.
So, you mean that it depends on who is compiled firstly.
For first to compile and insert into kernel, it will fistly load in the order of loading device driver.
Is it right?

Regards,
Morris
 
Old 03-09-2011, 12:24 AM   #4
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
No, what I mean is: say you want your pata drive to be sda and your sata drive to be sdb, then when you compile your kernel you would want to have the driver for the pata drive to be compiled into the kernel <y> and the driver for your sata drive to be a module <*>.

The kernel will load the drivers that are compiled into the kernel first and then the modules next.

This is the only way that I know of how to influence the order of loading drivers. If two drivers are both compiled into the kernel, I have no idea of what decides which one to load first.
 
Old 03-09-2011, 12:38 AM   #5
morris chen
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by andrewthomas View Post
No, what I mean is: say you want your pata drive to be sda and your sata drive to be sdb, then when you compile your kernel you would want to have the driver for the pata drive to be compiled into the kernel <y> and the driver for your sata drive to be a module <*>.

The kernel will load the drivers that are compiled into the kernel first and then the modules next.

This is the only way that I know of how to influence the order of loading drivers. If two drivers are both compiled into the kernel, I have no idea of what decides which one to load first.
Got it. Thanks

Morris
 
Old 03-09-2011, 12:40 AM   #6
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
You're welcome.

If you are satisfied with the solution, then mark the thread as [SOLVED] using the thread tools menu.
 
Old 03-09-2011, 12:47 AM   #7
morris chen
LQ Newbie
 
Registered: Mar 2011
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by andrewthomas View Post
You're welcome.

If you are satisfied with the solution, then mark the thread as [SOLVED] using the thread tools menu.

I think it's a good alternative.
But I still want to know how to adjust or control the order of loading linux device driver without using ko module.

Thanks

Regards,
Morris
 
Old 04-27-2011, 03:47 PM   #8
dpstrand
LQ Newbie
 
Registered: Dec 2008
Posts: 2

Rep: Reputation: 0
I am dealing with this problem today with a custom flash driver that hooks to mtd, and I need to make sure the mtd core driver is loaded first (otherwise add_mtd_device causes a kernel panic). If my driver is a module it works fine, but now I want to make it built-in. Did you ever figure this out?
 
Old 04-27-2011, 06:57 PM   #9
dpstrand
LQ Newbie
 
Registered: Dec 2008
Posts: 2

Rep: Reputation: 0
For now I switch my module_init call to late_initcall, and that worked for me. My builtin driver gets loaded last now. If there is a better way to handle this, please post it.
 
  


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
Changing device loading order and driver loading before X enygma Red Hat 2 10-18-2008 12:38 AM
how to make device driver built-in in initial ramdisk suo Linux - Kernel 2 08-12-2008 04:25 PM
Controlling kernel device loading order? katayamma Linux - General 1 06-20-2006 09:57 PM
built-to-order PC or ready-built PC from well-known companies? kpachopoulos General 6 11-03-2004 03:14 PM
simplest type of device driver to learn? infamous41md Programming 5 04-05-2004 11:09 PM


All times are GMT -5. The time now is 04:27 PM.

Main Menu
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