[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: link a lib into the module
Hi,
On Mon, Dec 8, 2008 at 6:38 AM, pl ice <telent997@xxxxxxxxx> wrote:
> hi,
>
> everybody who can tell me how to link a lib like lib.a to the module,when i
> set libs-y = PATH,but seem it doesn't work.
>
>
> Best Regards
`Documentation/kbuild' directory in your linux sources.
`makefiles.txt' about `lib-y',
`modules.txt' about modules.
A sample Makefile:
KDIR := /lib/modules/$(shell uname -r)/build
obj-m += test.o
test-y := hello.o libhello_lib.a
all:
gcc -I/usr/include -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=$(CURDIR) modules KBUILD_VERBOSE=1
Also, keep in mind that you can link a static library and not a shared
library in a kernel module.
Shared libraries can only be accessed in user space.
--
Regards,
Sandeep.
"To learn is to change. Education is a process that changes the learner."
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ