Results 1 to 2 of 2
I have a very basic makefile to compile a kernel module.
I am specifying the objects as follows:
obj-m := mymodule.o
mymodule-objs := obj1.o obj2.o
Another post I saw on ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-06-2012 #1Just Joined!
- Join Date
- Apr 2012
- Posts
- 5
Including a 3rd party library in a kernel module.
I have a very basic makefile to compile a kernel module.
I am specifying the objects as follows:
obj-m := mymodule.o
mymodule-objs := obj1.o obj2.o
Another post I saw on this forum suggested simply tacking on the .a file to the my module-objs line:
mymodule-objs := obj1.o obj2.o dalibrary.a
However, when I run make I get an error indicating that there is no rule to make "dalibrary.a".
I have also attempted to add -L<dir> -ldalibrary.a just after $(EXTRA_CFLAGS) in the following stanza to no avail:
depend .depend dep:
$(CC) $(EXTRA_CFLAGS) -M *.c > .depend
So... how do I include a pre-compiled 3rd party library in my kernel module Makefile?
- 04-07-2012 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,233
In the rules to create the .ko module, you would include the .a file with a -l rootname option, where rootname refers to librootname.a. Do note that you need to be sure that the static library librootname.a is a kernel library. If it has user-space code in it, you will not be successful in linking it to the kernel module.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote
