Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-08-2002, 06:49 AM
|
#1
|
|
Member
Registered: Dec 2001
Location: New Zealand,Auckland
Distribution: debian
Posts: 86
Rep:
|
compiling only one module without recompiling the kernel
Hi guys..
want to compile some driver as a module without recompiling the kernel,do you know how?
without make modules && make moudles_install
directly by using gcc,how?
|
|
|
|
05-08-2002, 06:53 AM
|
#2
|
|
Member
Registered: Apr 2002
Location: Brazil
Distribution: Slackware
Posts: 184
Rep:
|
You just need to tell gcc you want object code.
I can't remember which option it's but 'man gcc' surely can do
You type something like this:
gcc [options] module.c
HTH,
vfs.
|
|
|
|
05-08-2002, 07:25 AM
|
#3
|
|
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316
Rep:
|
For a kernel module usually you would do something like this:
Compile it:
gcc -DMODULE -D__KERNEL__ -O6 -c module.c
Then you can test it with:
insmod module.o
If everything works fine then install it:
install -m 644 module.o /lib/modules/`uname -r`/destdir
Change the module.c and module.o to the name of the module. The destdir is the directory you want to install it in.
|
|
|
|
05-08-2002, 07:46 AM
|
#4
|
|
LQ Newbie
Registered: Apr 2002
Location: Utrecht, Netherlands
Distribution: Slackware
Posts: 16
Rep:
|
I'm not sure, but i believe i've read somewhere that you don't have to recompile the whole kernel when you want to compile a module.
Just run make menuconfig (or whatever is your choice of configuring the kernel), select the module you want to compile. Save the kernel options, make dep and make modules && make modules_install. The kernel will not be compiled, only the modules will.
But then again.. I might be wrong
And so that I can learn something too:
IF I'm wrong, please tell me! 
|
|
|
|
05-08-2002, 09:24 AM
|
#5
|
|
Senior Member
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316
Rep:
|
That would work if you have previously compiled your kernel in the same source tree. If you haven't or if you have done a make clean. Then all the modules will be recompiled not just one specific module.
|
|
|
|
05-09-2002, 01:22 PM
|
#6
|
|
LQ Newbie
Registered: Apr 2002
Location: Utrecht, Netherlands
Distribution: Slackware
Posts: 16
Rep:
|
Okay, that makes sence. But compiling the modules doesn't take that long unless you have a slow system of course.
I think figuring out how to compile the source of just one module takes longer than compiling all the modules 
|
|
|
|
07-06-2009, 10:59 AM
|
#7
|
|
LQ Newbie
Registered: Jul 2009
Location: Delhi, India
Distribution: Ubuntu 8.10, RHEL
Posts: 3
Rep:
|
i tried make modules and make modules_install
it does make the first module as the new module, but then alas it continues with all of the modules...
By the way, i want to compile and insert isicom.c module
|
|
|
|
07-06-2009, 08:47 PM
|
#8
|
|
Senior Member
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 4,548
|
You should always make your kernel, each time you change any module, and thus allow "make" to figure it all out.
Each module will become "part of the kernel, in every respect," as soon as you install it. Therefore it is imperative that it exactly matches the rest of the installed kernel. There is "a correct way to do it," and you should religiously follow it. Don't try to shortcut.
|
|
|
|
07-06-2009, 10:00 PM
|
#9
|
|
Senior Member
Registered: Dec 2003
Posts: 3,142
Rep: 
|
Yes, allow the makefile to determine module dependencies. Sometimes compiling a single module might need to recompile other parts of your kernel, so never invoke gcc directly on the kernel source tree.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:48 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|