Results 1 to 2 of 2
Hi. Is it mandatory to have the name of the makefile as 'Makefile' for kernal module compilation ? I have written a small kernel module for 2.6 kernel. I have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-23-2009 #1
- Join Date
- Jan 2009
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module compilation ?
I have written a small kernel module for 2.6 kernel. I have written the make file as required for 2.6, but named the makefile as 'Makefile.2.6'.
When I execute make using the command "make -f Makefile.2.6", Compilation starts and when kbuild has to call my Makefile, instead of calling Makefile.2.6 it calls Makefile (which is available in the same directory, for user space compilation).
Can't I have any userdefined name for my kernel module Makefile like Makefile.2.6
Below is the error log.
make -w -f Makefile.lk.2.6
make: Entering directory `/home/kernel/TOS/code/my_module'
make -C /lib/modules/2.6.18-EP80579_8K/build M=/home/kernel/TOS/code/my_module SUBDIRS=/home/kernel/TOS/code/my_module
make: Entering directory `/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386'
/home/kernel/TOS/code/my_module/Makefile:4: ../LR/make.h: No such file or directory
/home/kernel/TOS/code/my_module/Makefile:5: ../LR/make.rule: No such file or directory
/home/kernel/TOS/code/my_module/Makefile:6: make.h: No such file or directory
make: *** No rule to make target `make.h'. Stop.
make: *** [_module_/home/kernel/TOS/code/my_module] Error 2
make: Leaving directory `/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.i386'
make: *** [all] Error 2
make: Leaving directory `/home/kernel/TOS/code/future/ipsecv4'
[root@localhost ipsecv4]# vim /lib/modules/2.6.18-EP80579_8K/build/Makefile
Any help will be appreciated.
Thanks in advance.
- 01-23-2009 #2
If you look at the lines in your make file or my example:
obj-m += test.o
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
make -C /lib/modules/$(shell uname -r)/build
on my system that path would be:
make -C /lib/modules/2.6.27-9-default/build/
where there exists a file called Makefile...Hope this helps...Gerard4143
so is it mandatory to call it Makefile...no...but it probably should be...enter and change at your own peril...