mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: sam@ravnborg.org
To: Idan Spektor <idan@imperva.com>
Cc: sam@ravnborg.org, linux-kernel@vger.kernel.org
Subject: Re: module name is KBUILD_MODNAME
Date: Wed, 21 Jul 2004 21:27:27 +0200	[thread overview]
Message-ID: <20040721192727.GA9188@mars.ravnborg.org> (raw)
In-Reply-To: <96242ACDF1723A4BBF70D21211FB9B23063690@shrek.webcohort.com>

On Wed, Jul 21, 2004 at 10:05:33AM +0200, Idan Spektor wrote:
> Here is the makefile I am using to create the .ko
> object. Please notice that I compile my objects
> by myself in a different makefile and only then
> use the kbuild infrastructure.
This may be a source of many problem in the future.
I advise you to use kbuild.

Try sending me ls -R in a clean tree,
your current Makefile or eventueally the src.
Then I will try to guide you.

> makefile:
>    
> ifeq ($(KERNELRELEASE),)
> 
> PWD		:= /home/idan/my_module
> KDIR	:= /usr/src/linux-$(shell uname -r)/
> 
> default:
> 	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
> 
> else
> 
> obj-m	:= my_module.o
> my_module-objs := my_module_main.o
> 
> $(PWD)/my_module_main.o:
> 	echo do nothing
> 
> endif

The above should not result in the error you describe.
KBUILD_MODNAME is defined to the name of the module
when compiling my_module.mod.c.
Take a look at the output when you use the V=1 option when running make.
If you do not see something like:

$> make -C ~/bk/mars O=~/o M=$PWD V=1
...
	  gcc -Wp,-MD,/home/sam/bk/external/sam/.sam.o.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/home/sam/bk/mars/include  -I/home/sam/bk/external/sam -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -msoft-float -mpreferred-stack-boundary=2 -march=pentium3 -I/home/sam/bk/mars/include/asm-i386/mach-default -Iinclude/asm-i386/mach-default -O2 -fomit-frame-pointer -Wdeclaration-after-statement -I/home/sam/bk/mars/ -I /home/sam/bk/external/sam/include -DMODULE -DKBUILD_BASENAME=sam -DKBUILD_MODNAME=sammy -c -o /home/sam/bk/external/sam/sam.o /home/sam/bk/external/sam/sam.c

...

[file is named sam.o, module is named sammy]

Then there is something wrong. You should see -DKBUILD_MODNAME=my_module

	Sam

  reply	other threads:[~2004-07-21 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-21  8:05 Idan Spektor
2004-07-21 19:27 ` sam [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-07-20 15:36 Idan Spektor
2004-07-20 19:17 ` sam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040721192727.GA9188@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=idan@imperva.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®