LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-08-2008, 05:00 PM   #1
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Rep: Reputation: 31
Is it possible to compile a single module from the kernel?


I've been trying to get various things to work on my laptop, one of which is a synaptics touchpad, and I have made about 5 kernels so far. Is there any way in which I can just create a module for the device I want, without recompiling everything? If I have the module compiled into the kernel, and want just the module, will I need to compile the kernel image again?
 
Old 10-09-2008, 12:56 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
If the module is compiled in the kernel you just issue
Code:
modprobe module-name
 
Old 10-09-2008, 01:04 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
You can run something like "make drivers/usr/serial" to build te files in the drivers/usb/serial directory, or
"make drivers/usb/serial/visor.ko" to build only the visor.ko module.

Note: from Linux Kernel in a Nutshell, page 27
 
Old 10-09-2008, 12:38 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Each of the two previous responses to this thread represent two slightly-different interpretations of your problem... and both of them, it would seem, are slightly-different from yours!

(1) You seem to be concerned that the module has not been compiled. make modules should take care of that... "jschiwal" seems to address that interpretation in a slightly-different way...

(2) Bruce points out that the modprobe command may be necessary to ensure that the module has actually been loaded into the kernel...
 
Old 10-09-2008, 01:22 PM   #5
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
To completely rebuild a module in a kernel downloaded from kernel.org follow these steps.

1. Go into the top level directory of your compiled kernel source tree. It MUST be the one you're booted from.
2. Type "make M=subdir" where subdir is the directory that contains your driver.
3. Find your module - it will be xxx.ko and in the sub directory your compiled.
4. "rmmod xxx" where xxx is your module
5. "insmod xxx.ko" where xxx.ko is the path to your new module
6. Test it.

Note that you cannot use this method for the disk device for any mounted drive; most especially your root drive. If this is what you want, you will need a spare working kernel to fall back on, because your only option is to replace the xxx.ko file in /lib/modules/whatever and reboot.

Last edited by Quakeboy02; 10-09-2008 at 01:45 PM. Reason: Oops - make command was wrong
 
  


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
how to compile a single module Ibrahimbazar Linux - Kernel 6 06-28-2006 03:51 AM
single module compile in clean source tree henryquinn Linux - Software 3 02-15-2006 03:38 AM
how to compile a single module? linjia Debian 1 12-26-2004 05:30 AM
Compile A Single Module leohuang Linux - General 4 05-02-2004 06:20 AM
compile a single kernel module wr3ck3d Linux - General 10 03-01-2003 12:00 PM

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

All times are GMT -5. The time now is 06:33 PM.

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