LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-25-2005, 08:28 AM   #1
raid517
Member
 
Registered: Feb 2002
Posts: 393

Rep: Reputation: 30
Building new kernel modules?


Hi this is a long shot I guess... But anyway, I wonder, does anyone know if there is a way in Debian to compile modules from my kernel sources without compiling the entire kernel again? Say for example I bought a new network card and it needed specific drivers from the kernel which I had not compiled into my kernel on any previous kernel compile - isn't there any way just to compile that single driver from the kernel sources and load it, or must I compile everything from scratch again?

I hope I'm being clear about what I want. Basically I would like the ability to add new hardware without compiling my entire kernel again just to enable the driver for it. I would much rather just compile the driver itself.

I know compiling a kernel when it has been compiled at least once already is fairly fast, but there are various cirumstances where this is not helpful. I am experiencing one of those conditions right now - where recompiling the kernel would simply be impractical for what I hope to achieve.

Best regards,

GJ
 
Old 05-26-2005, 02:23 AM   #2
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
I'm not sure about debian.

But in the kernel you can run
"make menuconfig" or "make xconfig"
you tick "M" for module that you want and compile it again.
Then run make modules modules_install
If it's just a driver you shouldn't need to reboot to load it up.

Recompiling little bits seems to go faster with 2.6 kernel than 2.4.

If you want to recompile without using the kernel compiling system, then that'll depend on what driver you're talking about and what kernel version.
 
Old 05-26-2005, 03:07 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I think that it depends whether the support for that type of module was already compiled in.
I would start with "make oldconfig" before "make xconfig" in the above instructions. This will use your last .config options before you make changes. It also validates your .config file.

If you are adding a sata drive and your kernel was compiled without sata support,
i.e.:# CONFIG_BLK_DEV_IDE_SATA is not set
in .config, then you would need to recompile the kernel with this option changed.

On the other hand if this is a module for an ide drive, then for the 2.6 kernel, you might be able to just
make modules && make modules_install

The nvidia installer does something like this to compile and install the nvidia.ko kernel module.

So to use your network device example. You are adding a device that uses the apricot network device driver. If the .config file says "CONFIG_APRICOT=m" then either a new driver isn't needed or you need only to install the source-code and run "make modules && make modules_install"

Also, there are howtos and README documents in the kernel source. Be sure the read through them. The source code the you are installing will probably have documentation with the source that will give you detailed instructions. There are also instructions on how to install drivers with the source code.

When I just looked in my /usr/src directory, there was a sub-directory "kernel-modules" present. Two kernel module source directories were inside. Each module's Makefile had a "make all" target to compile the module and "make install" target to install the module. Each module also had a README and INSTALL file.

This is the first of two methods for recompiling a kernel module given in the /usr/src/linux/SuSE-README file:
The first method involves the following steps:

(1) Install kernel-source.$ARCH.rpm.

(2) Change to the /usr/src/linux directory. Configure the kernel
(for example, ``make oldconfig'' or ``make cloneconfig'', see
HOW TO CONFIGURE THE KERNEL SOURCES).

(3) Create files required for compiling external modules:
``make modules_prepare''.

(4) Compile the module(s) by changing into the module source directory
and typing ``make -C /usr/src/linux M=$(pwd)''.

(5) Install the module(s) by typing
``make -C /usr/src/linux M=$(pwd) modules_install''.

If I hadn't read the README file in the kernel source, I would of missed the "make modules_prepare" step that my system requires.
 
  


Reply



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
Building driver modules to work with Install kernels? Erik_FL Slackware 4 10-06-2005 09:05 PM
Problem building RH9 kernel modules dominicporter Red Hat 1 09-25-2005 12:53 PM
problem building modules david_deng Linux - Newbie 2 09-22-2004 01:12 AM
Strangeness (or pilot error) building network driver modules cacheout Fedora 0 07-27-2004 06:39 PM
Building modules for the kernel... Nichole_knc Slackware 3 04-13-2004 08:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:57 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
Open Source Consulting | Domain Registration