[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <453DF507.8050101@innomedia.soft.net>
Date: Tue, 24 Oct 2006 16:42:07 +0530
From: Dipti Ranjan Tarai <dipti@...omedia.soft.net>
To: kbuild-devel@...ts.sourceforge.net
CC: linux-kernel@...r.kernel.org
Subject: Re: Link lib to a kernel module
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
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists