LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-23-2012, 03:21 AM   #1
demon007
LQ Newbie
 
Registered: Sep 2011
Posts: 13

Rep: Reputation: Disabled
Creating Driver


Hello Guys,
I am new to system programming and wanted to write some small drivers like of keyboard and mouse

I am not able to figure out from where to start and what should I read to write it.

Please help me with it.

Thank You
 
Old 08-23-2012, 03:54 AM   #2
zwitterion-241920
Member
 
Registered: Nov 2011
Location: AccountKiller
Distribution: AccountKiller
Posts: 89

Rep: Reputation: 39
You want to look into 'linux kernel module programming', which is a nontrivial task for actual hardware drivers. This howto from The Linux Documentation Project explains it.
If you want to write some small and easy drivers, it would be easier to write a kernel from scratch, using James Molloy's Kernel Development Tutorial.
 
Old 08-23-2012, 08:16 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
"Use the Source, Luke!"

If you install the kernel source packages for your distro, you'll find the source-code for literally hundreds of device drivers. If one of these is not exactly what you need, it will be "damm close." And so, that is the proper place to start. Find existing tested source-code that is 99.9% of what you're looking for, and tweak it.
 
Old 08-23-2012, 08:23 AM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
No one should start touching device drivers without reading this book: http://lwn.net/Kernel/LDD3/ For some reason I still don't understand this excellent source is freely available.

Furthermore a rich source of information is http://www.comedi.org.

jlinkels
 
Old 08-25-2012, 11:28 AM   #5
demon007
LQ Newbie
 
Registered: Sep 2011
Posts: 13

Original Poster
Rep: Reputation: Disabled
Thankx for all your replies.

Actually I dont want to design the driver for a specific device. I want to just design a driver to learn how a driver(for eg keyboard) is working and how it is created. So from where should I start for it??
 
Old 08-28-2012, 08:00 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Quote:
Originally Posted by demon007 View Post
don't want to design the driver for a specific device. I want to just design a driver to learn how a driver(for eg keyboard) is working and how it is created. So from where should I start for it??
"Use the Source, Luke." The best way to learn how to write a driver is to follow the path that others use to write their drivers: they study what has already been successfully done for their particular distro, find the closest match from existing work, and tweak it. That's the important power of open-source: you don't have to start from the beginning on anything, so no one does.

Do bear in mind that the Linux kernel has evolved considerably over time, so, although books are fine, the documentation directory that comes with the kernel tree, and the kernel itself, should be your primary reference. Once you've got the essential concepts and ideas straight in your head.
 
  


Reply

Tags
drivers, programming, systems



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
Creating a Filesystem Driver Zymus Linux - Newbie 6 07-16-2010 05:34 PM
Creating custom driver disk. DDoS YourseLF Red Hat 1 08-07-2005 08:27 AM
Compiling/Creating a driver for Fedora?? teodavinci Fedora 1 10-28-2004 06:44 PM
Creating driver files from Makefiles bluseychris Linux - Software 3 05-04-2004 05:42 PM
Creating new Printer Driver neilcuk Programming 2 04-13-2004 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:05 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