Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > The Linux Kernel
Reload this Page Device driver + static link library?
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

The Linux Kernel Compiling, theory, programming or other discussion about the linux kernel

Reply
 
Thread Tools Display Modes
Old 01-17-2008   #1 (permalink)
Just 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
evilquesadilla is offline   Reply With Quote
Old 01-18-2008   #2 (permalink)
Linux Newbie
 
Join Date: Dec 2007
Location: Canada, Prince Edward Island
Posts: 153
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
gerard4143 is offline   Reply With Quote
Old 01-18-2008   #3 (permalink)
Just 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.
evilquesadilla is offline   Reply With Quote
Old 01-18-2008   #4 (permalink)
Just 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.
evilquesadilla is offline   Reply With Quote
Old 07-25-2008   #5 (permalink)
Just 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?!
gripened is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
ATI x86_64 Display Driver 8.42.3 - Suse 10.3 gatekeeper SuSE Linux Help 16 06-10-2008 03:28 AM
NVIDIA glx problem (I think) Carlwatkins Ubuntu Help 13 07-14-2007 02:25 AM
Slackware rocks! But I have a small problem... :-/ MuD Slackware Linux Help 12 02-20-2005 03:27 PM
Mounting firewire cdrw lillusion Slackware Linux Help 5 09-23-2004 08:51 AM
About the 2.6 Kernel jasonlambert Linux Tutorials, HOWTO's & Reference Material 0 08-10-2003 05:54 PM

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 06:54 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0