LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 11-19-2009, 03:50 PM   #1
balteo
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Rep: Reputation: 15
Compiling a device driver only and not the whole kernel... Is this possible?


Hello,

I run ubuntu. i have recently installed the sources for 2.6.28 and being very new to device driver development I have the following question:

-can I compile the usb-storage (/home/julien/src/linux-source-2.6.28/drivers/usb/storage) module without compiling the whole kernel?
-If so, how?

Any clue welcome!

Julien.
 
Old 11-19-2009, 08:16 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Simply select it as a module in the configuration and run "make modules" followed by "make modules_install".
 
Old 11-19-2009, 08:17 PM   #3
sarum1990
Member
 
Registered: Dec 2008
Distribution: Gentoo, Debian
Posts: 31

Rep: Reputation: 21
I believe this is possible, and I found a website that appears to agree:

http://www.cyberciti.biz/tips/compil...el-module.html
 
Old 11-19-2009, 08:19 PM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 208Reputation: 208Reputation: 208
Julien,

The procedure to build only a specific portion of the kernel is as follows:

From the root directory ( /usr/src/linux or what have you ) issue make, with the desired subdirectory as a target. For example:

Code:
sudo make drivers/usb/storage
would accomplish what you describe.

Note, though, that what you are requesting is somewhat unusual. Ordinarily, one would build the entire source tree. They might then edit some kernel code. At that point, you can just rebuild the kernel and GNU make will only recompile those areas of the tree that you affected -- in effect, doing so quite quickly.

Cheers,
Jameson

Last edited by jhwilliams; 11-19-2009 at 08:22 PM.
 
Old 11-20-2009, 02:25 AM   #5
balteo
LQ Newbie
 
Registered: Jul 2002
Posts: 27

Original Poster
Rep: Reputation: 15
thanks jhwilliams! it works.

jhwilliams,
It works much better than this:
Code:
make prepare
make scripts
make M=./drivers/usb/storage
!
Julien.
 
  


Reply

Tags
compilation, device, drivers, usbstorage


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
Problem in compiling a device driver program p.arun Linux - Kernel 4 01-23-2008 02:14 AM
Problem in compiling a char device driver formerly for kernel 2.4 on kernel 2.6 payretep Linux - Newbie 6 09-24-2007 06:43 AM
Compiling Device Driver in Linux i_love_linux Linux - Kernel 13 09-04-2007 10:24 AM
compiling raw source code of device driver bishalpoudyal Linux - Hardware 1 04-08-2006 04:09 AM


All times are GMT -5. The time now is 07:23 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