LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-09-2010, 02:21 PM   #1
kislaykishore
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Rep: Reputation: 0
Makefile of Device Driver


I have to compile a driver and for this I have to give these flags
-L/usr/X11R6/lib -lX11

Can anyone help me with the makefile plzzzz

The format which I am trying is

obj-m := module1.o

KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
 
Old 10-11-2010, 02:20 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
The following links might help you:
 
1 members found this post helpful.
Old 10-11-2010, 05:19 AM   #3
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I thought the kernel had to be completely standalone, i.e. it can't make use of any external libraries. It doesn't even make use of the standard C library - you can't use printf() in kernel code, for example (you have to use the kernel's own printk()).

Where did you get this driver? It might help if you gave us more information about it.

Last edited by Nylex; 10-11-2010 at 05:30 AM.
 
Old 10-12-2010, 02:05 AM   #4
kislaykishore
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks anishakaul.... I later found this out....
 
Old 10-12-2010, 02:15 AM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Well you are welcome, see if you can answer Nylex's questions in post 3, it might help you.
 
Old 10-13-2010, 04:15 AM   #6
kislaykishore
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Unhappy

Yes Nylex, u r correct....
now I think I should have done some more research before posting it here....

I wanted to write a driver based to control mouse functions using C library functions.

Last edited by kislaykishore; 10-13-2010 at 04:17 AM.
 
Old 10-14-2010, 02:44 PM   #7
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
I'm not really sure how you would do that. You may be able to create a userspace program that does such a thing, but again, that isn't something I know about.
 
Old 10-15-2010, 07:51 AM   #8
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by kislaykishore View Post
I wanted to write a driver based to control mouse functions using C library functions.
Using C library functions for the device drivers means you want to write the user-space device drivers since libc provides a wrapper to the functions used by the kernel.

Check out the links shown here:
http://www.gnu.org/software/hurd/ope....html#index3h1

and I found this interesting:
http://www.freesoftwaremagazine.com/...nux?page=0%2C0

C library cannot be used to writing kernel space device drivers since it works in user space.
However as a replacement you have to use kernel level functions.
cd to this directory:
Code:
/usr/src/linux-<your kernel version>/include/linux
You'll find here the source files of functions used by the kernel replacing the glibc library functions.

and check out this too:
http://tldp.org/HOWTO/Module-HOWTO/

Last edited by Aquarius_Girl; 10-15-2010 at 07:56 AM. Reason: added link
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about usb storage device and device driver balteo Linux - Hardware 2 11-21-2009 09:37 AM
problem while compiling driver Makefile biswajit.2k3 Linux - Newbie 1 07-06-2009 06:34 AM
Multiple Device driver from single device driver???? rickhg12hs Linux - Kernel 3 05-25-2008 12:11 AM
Can I Modify a Driver Makefile? YAOMK Red Hat 3 04-11-2008 03:09 PM
device makefile problem tanalam Programming 1 02-18-2006 03:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration