Error compiling loadable kernel module with vanilla kernel
Hello Folks
Ive been trying to compile a vanilla kernel just for the purpose of refreshing some long forgotten loadable modules concepts. By the way, Im running centos 6. what ive done is, ive downloaded a vanilla kernel image 2.6.32 from kernel.org and then I did a Code:
menu xconfig Code:
make However Code:
make modules Code:
No rule to make target 'net/ipv4/netfilter/ipt_ecn.c', needed by `net/ipv4/netfilter/ipt_ecn.o'. Stop' Nonetheless, I ran a Code:
make modules Code:
make modules_install Code:
obj−m += hello−1.o Anyways, I try doing exactly that, by doing a Code:
make all Code:
make -C /lib/modules/2.6.32.59/build M=/home/aijazbaig1/modules modules [root@MyCentOS-VM linux-2.6.32.59]# find . -name autoconf.h ./include/linux/autoconf.h [root@MyCentOS-VM linux-2.6.32.59]# find . -name auto.conf ./include/config/auto.conf Ive also created a soft link (since it wasn't there by default to begin with) '/usr/src/linux' to point to the directory where the stock kernel is located. Here: [root@MyCentOS-VM modules]# ls -l /usr/src/ total 8 drwxr-xr-x. 2 root root 4096 Sep 23 2011 debug drwxr-xr-x. 3 root root 4096 Jun 27 16:08 kernels lrwxrwxrwx. 1 root root 33 Jul 2 16:05 linux -> /home/aijazbaig1/linux-2.6.32.59/ I fail to understand what exactly is causing the build to fail. Please enlighten me or give me some pointers as to where should I be looking at. Keen to hear from you soon. Regards, Aijaz |
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread should be closed because it is a duplicate of http://www.linuxquestions.org/questi...el-4175414846/.
|
Hello
Id rather keep this thread open and close the 'other one' since that one was in the 'wrong' section and ive already put in a request there to the mod So if you know how to close that one, please do tell me. |
Please use the report button on your original post (http://www.linuxquestions.org/questi....php?p=4719607) and ask a moderator to close / move / whatever the thread for you.
|
I have already reported the other thread so the mod will soon close that one. But THIS one need not be closed as I believe more 'kernel' folks will take a shot at it if its here.
|
Try this
In the makefile for the module use the path to the kernel source along with make i.e. Code:
obj−m += hello−1.o |
Hi Bsat
Heres how my Makefile looks now: Code:
obj−m += hello−1.o Code:
make -C /home/aijazbaig1/linux-2.6.32.59 M=/home/aijazbaig1/modules modules By the way, Ive even tried pointing make explicitly to the include folder within the top level source tree but to no avail. Additionally in both these cases, module.symvers and modules.order get created but they both are empty (0 byte) files |
Are you sure the compilation of kernel has completed successfully,did you get the bzImage ?
Did you run make oldconfig and make prepare as suggested in the error message ? |
I think I had already done that. To make sure, I prepared the vanilla kernel source by issuing a
Code:
make oldconfig Code:
make prepare Code:
make Code:
modules_install Code:
make install After that, I booted off the new vanilla kernel so Code:
uname -r Im confused. Ive never had this problem a few years back when I first started out...:( |
See if this helps
https://www.centos.org/modules/newbb...topic_id=35068 Also try installing the kernel-devel tools . |
Hi. I was unable to understand what was going wrong in that extremely simple code. So perhaps in a bout of frustration, I downloaded a sample from the link below:
http://www.cyberciti.biz/tips/build-...urce-tree.html . After making a simple change in the Makefile (which was causing the compile to fail), I compiled it and voila! it works!! Modpost did post the module and I could see the ko and the o files. What was unusual though was that I had to use the module name alongwith the ko extension to insert it. So insmod hello wouldnt work but insmod hello.ko does. This wasnt the case earlier as far as I remember. Any comments? |
As far as i have used insmod, it has always been with the ".ko" extention. It is modprobe to which we can pass the module name with out extention.
Any way what was the problem with your makefile, what did you change ? Mark the thread solved if it is. |
Na..i meant there was a problem in the makefile of the downloaded sample code. And after fixing that, it started to work.
I still don't know what is the problem with mine :( |
Please ignore, for a moment, whether the kernel in question has been decomposed into "modules" or not. The total kernel logically consists of all of its pieces, no matter what module they are (or are not) in. Effectively, conceptually, the entire kernel is linked as-one even though multiple output modules are produced. It must be a logical whole. If your kernel is "vanilla," this implies that it is minimalist; that pieces of it, which some module might require, might not be there. And if so, that's your (only) problem.
|
All times are GMT -5. The time now is 06:50 AM. |