Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 11-19-2009, 03:50 PM   #1
LQ Newbie
Registered: Jul 2002
Posts: 27

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


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!

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

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
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
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:
Old 11-19-2009, 08:19 PM   #4
Senior Member
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210

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:

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.


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

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

It works much better than this:
make prepare
make scripts
make M=./drivers/usb/storage


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 > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:09 PM.

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