Results 1 to 5 of 5
Hi,
To compile a loadable module, as far as I know you add something like this to the make file:
obj-m := my_module1.o my_module2.o
But what if I want to ...
- 01-17-2008 #1Just Joined!
- Join Date
- Jan 2008
- Posts
- 6
Device driver + static link library?
Hi,
To compile a loadable module, as far as I know you add something like this to the make file:
obj-m := my_module1.o my_module2.o
But what if I want to link with a static library? Is there a way to do this? Seems like simply adding 3rd_party_library.a to obj-m I get something like
target '3rd_party_library.a' doesn't match the target pattern
If I were to write the makefile from scratch I'd try something like
ld -r -o my_module.ko my_module1.o my_module2.o 3rd_party_library.a
But within the framework of the existing directory structure and multi-level make files and all that I don't know how to do it.
Thank you,
Ben
- 01-18-2008 #2
Try this it might help
This web site shows the proper way to compile multi modules...Hope this helps
http://tldp.org/LDP/lkmpg/2.6/html/x351.html
- 01-18-2008 #3Just Joined!
- Join Date
- Jan 2008
- Posts
- 6
Thank you for your help. However, that page didn't mention anything about static libraries. I could extract the objects out of the static library (since static libraries are basically archived object files), however then make will attempt to recompile the object files, which I do not have the source to (since it's 3rd party static library).
The linker ld knows how to handle .a (static library) files. I just need to find a way to let make know that the .a file should be passed to the linker, but should be ignored by the compile commands.
I'll check out the rest of the site you posted and see if I can find anything.
Thank you.
- 01-18-2008 #4Just Joined!
- Join Date
- Jan 2008
- Posts
- 6
Ok, I found it.
It's as described in the document that gerard4143 provided, except it wasn't spelled out exactly.
obj-m := mymodule.o
mymodule-objs := my_module1.o my_module2.o 3rd_party_library.a
Make file knows how to handle .a files, I just had to find the right way to include it.
- 07-25-2008 #5Just Joined!
- Join Date
- Jul 2008
- Posts
- 1
Kernel module static linking without source of the static object
Hey
Need help concerning the same issue...
How do we include a .o or .a file so that the make process just links with this file instead of trying to compile it?!


Reply With Quote
