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

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to