Compiling a module separately without compiling entire 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.
Compiling a module separately without compiling entire kernel
I just compiled a 2.6.26 kernel and installed on my Debian etch system.
Now I just realized that I need one more module in the kernel. I can get the module by copying a file called testlpp.c in the usr/src/linux/drivers/char/ directory and then compiling it. The module is called LPPTEST. Basically there is the PREEMPT_RT patch that gives this module.
How can I just compile this module and install it without compiling the entire kernel? I have copied the file testlpp.c in the drivers/char/ directory.
I tried what you suggested and I got loads of errors..I was not able to caputre the first error because the screen scrolled too fast and since there were so many errors the first error is not in the terminal's memory anymore i.e. even if I scroll up I cannot see the first error.
Put your driver source in a separate directory, including any .h files that go with it (usually you won't get away with just a .c file) and make it with this makefile (which you can copy into a file named Makefile).
Put your driver source in a separate directory, including any .h files that go with it (usually you won't get away with just a .c file) and make it with this makefile (which you can copy into a file named Makefile).
I think I am very close to compile the module successfully. I got a warning message:
Code:
debian:/usr/src/lpptest# make
make -C /lib/modules/2.6.26-1-486/build SUBDIRS=/usr/src/lpptest modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-1-486'
CC [M] /usr/src/lpptest/lpptest.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: "irq_desc" [/usr/src/lpptest/lpptest.ko] undefined!
LD [M] /usr/src/lpptest/lpptest.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-1-486'
debian:/usr/src/lpptest#
I check for the "irq_desc" in the include files and it seems that #include <linux/irq.h> file has the definition of the structure irq_desc. Wonder why it is still saying that irq_desc is undefined.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.