Is it possible to compile a single module from the kernel?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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...
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.