From: "Devesh Sharma" <devesh28@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Compiling dependent module
Date: Sat, 7 Oct 2006 17:42:47 +0530 [thread overview]
Message-ID: <309a667c0610070512y47718898i4a664ef6cce7c312@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 621 bytes --]
Hello all,
I have a situation where, I have one parent module in ../hello/
directory which exports one symbol (g_my_export). I have a dependent
module in ../hello1/ directory. Both have it's own makefiles.
Compiling of parent module (hello.ko) is fine, but during compilation
of dependent module (hello1.ko) I see a warning that g_my_export is
undefined.
On the other hand when I do depmod -a and modprobe, dependent module
inserts successfully in kernel.
I want to remove compile time warning. What should I do?
The source and makefile of both parent and dependent module is
attached with this mail.
Thanks
Devesh.
[-- Attachment #2: hello.c --]
[-- Type: text/x-csrc, Size: 346 bytes --]
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
int g_my_export = 0xA ;
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
EXPORT_SYMBOL(g_my_export) ;
module_init(hello_init);
module_exit(hello_exit);
[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 486 bytes --]
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
endif
[-- Attachment #4: hello1.c --]
[-- Type: text/x-csrc, Size: 382 bytes --]
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
extern int g_my_export ;
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world1\n");
printk("Value in g_my_export=%d\n",g_my_export) ;
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world1\n");
}
module_init(hello_init);
module_exit(hello_exit);
[-- Attachment #5: Makefile --]
[-- Type: application/octet-stream, Size: 487 bytes --]
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := hello1.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
install:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
endif
next reply other threads:[~2006-10-07 12:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-07 12:12 Devesh Sharma [this message]
2006-10-07 18:19 ` Sam Ravnborg
2006-10-10 5:26 ` Devesh Sharma
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=309a667c0610070512y47718898i4a664ef6cce7c312@mail.gmail.com \
--to=devesh28@gmail.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®