From: Dipti Ranjan Tarai <dipti@innomedia.soft.net>
To: kbuild-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: Re: Link lib to a kernel module
Date: Tue, 24 Oct 2006 16:42:07 +0530 [thread overview]
Message-ID: <453DF507.8050101@innomedia.soft.net> (raw)
In-Reply-To: <20061024105518.GA55219@server.idefix.loc>
Hi,
As per my knowledge kernel module can not access to a library
function. Library function are only accessible to user level program.
Module can access exported symbol only.
Regards
Dipti Ranjan Tarai
Matthias Fechner wrote:
> Hi,
>
> I tried today to link a lib (.a) to my kernel module but I could not
> found howto do it.
> I prepared a little example:
> hello.c:
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/io.h>
> #include <linux/version.h>
> #include "hello_lib.h"
>
> MODULE_LICENSE("GPL");
>
> int init_module(void)
> {
> printHello();
> return 0;
> }
>
> void cleanup_module(void)
> {
> printk("remove module\n");
> return;
> }
>
> hello_lib.c:
> int helloWorld(void)
> {
> printk("Hello World\n");
> return 0;
> }
>
> hello_lib.h:
> int helloWorld(void);
>
> Makefile:
> KDIR := /lib/modules/$(shell uname -r)/build
> PWD := $(shell pwd)
> EXTRA_CFLAGS+=-I/usr/home/idefix/programming/kernel_hello_world_lib/
>
> obj-m := hello.o
> hello-obj := hello.o libarinc653.a
>
> all:
> gcc -c -o hello_lib.o hello_lib.c
> rm -f libhello_lib.a
> ar cru libhello_lib.a hello_lib.o
> $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
>
> Can please someone help me here?
>
> Thx a lot,
> Matthias
>
>
next prev parent reply other threads:[~2006-10-24 11:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 10:55 Matthias Fechner
2006-10-24 11:12 ` Dipti Ranjan Tarai [this message]
2006-10-24 23:35 ` Matthias Fechner
[not found] ` <453EFA4C.9000502@innomedia.soft.net>
2006-10-25 12:30 ` Matthias Fechner
2006-10-24 12:11 ` Oleg Verych
2006-10-25 12:26 ` [kbuild-devel] " Matthias Fechner
2006-10-25 18:24 ` Oleg Verych
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=453DF507.8050101@innomedia.soft.net \
--to=dipti@innomedia.soft.net \
--cc=kbuild-devel@lists.sourceforge.net \
--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
Powered by JetHome