I tried to compile my first loadable kernel module and failed :(
Here is the error:
r@ubuntu:/$ sudo make -C /lib/modules/`uname -r`/build/ M=`pwd`
[sudo] password for r:
make: Entering directory `/usr/src/linux-headers-2.6.38-8-generic'
scripts/Makefile.build:76: kbuild: Makefile.build is included improperly
make[1]: *** No rule to make target `kernel/bounds.c', needed by `kernel/bounds.s'. Stop.
make: *** [_module_] Error 2
make: Leaving directory `/usr/src/linux-headers-2.6.38-8-generic'
I need help knowing what is wrong.
Here is the makefile i am using:
obj-m += sample_module_for_techblog.o
all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean
clean-files := Module.symvers
i found out the following piece of code (which is printing the piece of error that i ma getting) from here
ifndef obj
$(warning kbuild: Makefile.build is included improperly)
endif
i hope this helps solve the issue.
/usr/src/linux-2.6.38.2/kernel/bounds.c
on my system, I would suspect that on your system a file named/usr/src/linux-headers-2.6.38-8-generic/kernel/bounds.c
is missing, for whatever reason.apt-get source linux-image-$(uname -r)
should install the missing sources.