LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 01-23-2009, 03:38 AM   #1
narender.d
LQ Newbie
 
Registered: Jan 2009
Posts: 2

Rep: Reputation: 0
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp


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 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.6make: 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[1]: 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[2]: *** No rule to make target `make.h'. Stop.
make[1]: *** [_module_/home/kernel/TOS/code/my_module] Error 2
make[1]: 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.

Regards
Narender
 
Old 01-23-2009, 11:01 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,989

Rep: Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611
Welcome to Linux Questions.

Quote:
Is it mandatory to have the name of the makefile as 'Makefile'
Yes, make will go for "Makefile" or "makefile".

If you want to keep the original Makefile,
you will have rename it temporarily,
while using your own Makefile.

'mv Makefile Makefile.orig'
'mv Makefile.2.6 Makefile'

And rename back after compiling.
( Suggest : keep backup copies of both,
if something goes wrong .. overwriting, etc.)
....

Last edited by knudfl; 01-24-2009 at 04:32 AM.
 
Old 05-27-2009, 09:18 AM   #3
antiregulator
LQ Newbie
 
Registered: Apr 2009
Posts: 13

Rep: Reputation: 0
what about the Kbuild name for a km makefile? is it valid? in modules.txt inside usr/src/linux/Documentation/kbuild (on a slackware distro) it says it can also be be valid in the recent kernel versions. but when i use make to build a kernel module (on a 2.6.x kernel) accordingly to my Kbuild file, make will say this:

make: *** No targets specified and no makefile found. Stop.

does anyone have anything to say on this!?

thx!
dave.

Last edited by antiregulator; 05-27-2009 at 09:20 AM. Reason: spelling...
 
Old 05-29-2009, 06:26 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,989

Rep: Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611Reputation: 2611
@ antiregulator
If you don't see a makefile, there isn't one.

But in fact a makefile can have any name, then
you can call it with the ' -f flag ' :

make -f <filename>

.....
 
  


Reply

Tags
kernel, module


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
automake, makefile, makefile.in and makefile.am Fond_of_Opensource Linux - Newbie 1 09-12-2006 08:35 PM
what is the meaning of Makefile,Makefile.am,Makefile.in cynthia_thomas Linux - General 3 12-08-2005 05:00 AM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 12:23 PM
kernal makefile error tony Linux - Software 4 11-27-2000 02:15 PM


All times are GMT -5. The time now is 04:54 AM.

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