Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 07-04-2012, 06:24 AM   #1
LQ Newbie
Registered: Jun 2007
Location: Mumbai, India
Distribution: centos, opensuse
Posts: 15

Rep: Reputation: 0
Question 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 and then I did a
menu xconfig
on it to create a .config file. After having done that, I run
on the top level directory which seems to work fine.

make modules
fails with the following errors:

No rule to make target 'net/ipv4/netfilter/ipt_ecn.c', needed by `net/ipv4/netfilter/ipt_ecn.o'. Stop'
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
make: *** Waiting for unfinished jobs....
I believe this just means that it was NOT able to build the 'ipt_ecn' module ('iptables' module which is typically used as a filtering, network traffic sniffer/shaper..and many other things. Thats out of topic for this). And thats fine with me. What has got me concerned is, since it apparently failed in the middle, it may have missed out on any book-keeping task(s) which it does at the end of 'make modules'?

Nonetheless, I ran a
make modules
and it seemed to have went fine (note that ive already installed the modules under /lib/modules/ by doing a
make modules_install
at the top of the vanilla kernel source tree). I then cd into the directory where my kernel module source code is located. My Makefile in it looks like this:
obj−m += hello−1.o

make -C /lib/modules/ M=$(shell pwd) modules

make -C /lib/modules/ M=$(shell pwd) clean
I DID NOT use the /lib/modules/`uname -r`/build path as I do not want to have these modules linked against the currently running kernel. I will only do an 'insmod' after having booted into the '' vanilla kernel later. So am I allowed to build a kernel module against a kernel which is not currently running?

Anyways, I try doing exactly that, by doing a
make all
in the directory where I have my kernel module source. However I get the following errors:
make -C /lib/modules/ M=/home/aijazbaig1/modules modules 
make[1]: Entering directory `/home/aijazbaig1/linux-'
test -e include/linux/autoconf.h -a -e include/config/auto.conf || ( \
echo; \
echo " ERROR: Kernel configuration is invalid."; \
echo " include/linux/autoconf.h or include/config/auto.conf are missing."; \
echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo; \
mkdir -p /home/aijazbaig1/modules/.tmp_versions ; rm -f /home/aijazbaig1/modules/.tmp_versions/*

WARNING: Symbol version dump /home/aijazbaig1/linux-
is missing; modules will have no dependencies and modversions.

make -f scripts/ obj=/home/aijazbaig1/modules
(cat /dev/null; ) > /home/aijazbaig1/modules/modules.order
make -f /home/aijazbaig1/linux-
scripts/mod/modpost -m -a -i /home/aijazbaig1/linux- -I /home/aijazbaig1/modules/Module.symvers -o /home/aijazbaig1/modules/Module.symvers -S -w -s
make[1]: Leaving directory `/home/aijazbaig1/linux-
After searching a lot over the internet, ive come across many different opinions but I couldn't figure out a single reason as to why it fails to find the autoconf.h or auto.conf files. These files are present under the source tree

[root@MyCentOS-VM linux-]# find . -name autoconf.h
[root@MyCentOS-VM linux-]# find . -name 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.
[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-

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.


Last edited by aijazbaig1; 07-04-2012 at 06:27 AM.
Old 07-05-2012, 12:48 AM   #2
LQ Newbie
Registered: Jun 2007
Location: Mumbai, India
Distribution: centos, opensuse
Posts: 15

Original Poster
Rep: Reputation: 0
Moderator, could you please delete this thread from here? It should have been posted under Linux-kernel and I've done that now.

Thanks again and sorry for the wrong address this time

Aijaz Baig
Old 07-05-2012, 03:35 AM   #3
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
Try this

In the makefile for the module use the path to the kernel source along with make i.e.

obj−m += hello−1.o

make -C <Path to kernel source> M=$(shell pwd) modules

make -C <Path to kernel source> M=$(shell pwd) clean
Old 07-05-2012, 04:41 AM   #4
LQ Newbie
Registered: Jun 2007
Location: Mumbai, India
Distribution: centos, opensuse
Posts: 15

Original Poster
Rep: Reputation: 0
Hello bsat

Could we continue the discussion here:

Im going to ask the mod to close this one so more people interested in kernel development can take a look there.


Closed Thread

autoconf, build, building, kernel

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Fedora kernel / vanilla kernel compiling chipotphe Linux - Kernel 2 09-13-2008 01:06 PM
loadable kernel module compilation error for SHA1 functions nikhil86 Programming 1 03-25-2008 09:08 PM
Error compiling NVIDIA kernel module on kernel Slaco Linux - Hardware 6 10-31-2007 07:57 PM
reboot kernel from kernel from loadable module ? jeff price Linux - Kernel 1 01-11-2007 05:22 AM
kernel version 2.4 loadable kernel module mhuman1 Linux - Kernel 2 05-11-2006 01:08 PM

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration