LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices

Reply
 
Search this Thread
Old 08-29-2004, 08:44 AM   #1
Crunch
Member
 
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162

Rep: Reputation: 30
Writing hardware drivers


I know this might be pure rudimentary, although I'm pretty interested. I was wondering what the steps were for creating hardware support for a certain operating system (in this case OpenBSD). Am I going to need the schematics of the device? Obtain any of the white paper information from the hardware creator (edit: vendor) itself?

Thanks ahead of time guys.


Edit:
I was also wondering if OpenBSD would support my driver? I'm only 15 years old, I'm not sure if there would be an age restriction or as to why there would be. Oh and also with them accepting my work... should I go through and audit twice for potential problems and faults? I realize how picky they are about their source so would this help them out? (I'm just wondering before I go ahead and start on something =))

Last edited by Crunch; 08-29-2004 at 08:58 AM.
 
Old 08-29-2004, 09:53 AM   #2
ZooL
Member
 
Registered: Aug 2004
Location: England
Distribution: Slackware 10.1
Posts: 41

Rep: Reputation: 15
The easiest way to learn how a piece of hardware work IMO is to reverse engineer existing drivers. As far as I'm aware this is legal as long as you don't actually modify the drivers or use code from them. I'm currently coding a linux driver for a certain Smartcard reader which uses the serial port, as an example. I am using PortMon (on Windows) to monitor how the Windows driver interacts with the card reader.
 
Old 08-29-2004, 11:08 AM   #3
Crunch
Member
 
Registered: Feb 2003
Location: York, PA
Distribution: Slackware, FreeBSD, OpenBSD
Posts: 162

Original Poster
Rep: Reputation: 30
Ah, is this normally how others do so? I currently have nothing planned at the moment, although I intend on doing this in a bit. Well... only if I find some hardware that needs (to) / can be ported that is.

Edit:
I see that you were using Windows to watch the card... anyway to evade having to use Windows?
 
Old 08-29-2004, 12:54 PM   #4
ZooL
Member
 
Registered: Aug 2004
Location: England
Distribution: Slackware 10.1
Posts: 41

Rep: Reputation: 15
Well most of the time hardware vendors are reluctant to give out details and white papers, so this is the only way possible. For example, ATI hasn't released data on their Radeon cards so no open source 3D drivers can be made unless someone reverses their Linux binary drivers.

I had to use Windows to monitor the card because they were the only drivers available for the card. Most of the time, you will find that drivers are only available for Windows or maybe DOS. Seeing as Windoze is on most typical users PC's, I don't think any hardware vendor would make hardware that doesn't have Windoze drivers. Also, if there are drivers for other platforms they are often outdated and/or incomplete.
 
Old 08-29-2004, 05:44 PM   #5
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 69
Usually it's nearly impossible to create a driver without documentation. Most of the card left that don't have drivers are that way because the vendor doesn't provide documentation (ATI, HiFn, etc). Most Open Source drivers are imported to a particular OS by copying and modifying the driver from another OS. The BSDs do this frequently. Occasionally a driver will be created by referencing a driver from Linux.

Writing drivers is a pretty arcane persuit. You need to be intimately familiar with hardware--stuff like registers, timing, etc... Things like NICs often do some processing on the card itself, such as doing TCP checksums. You need to know how to enable that through your driver rather than have it passed off to the CPU.

If you're not already an excellent programmer, I wouldn't start by trying to write drivers. That being said, there's no real age limit on contributing to Open Source projects. If your code is really well done and it does something that's necessary (e.g. adds support for a previously unsupported device), then chances are it will be accepted. If you write sloppy code, it doesn't matter how old you are or how much education you have, it's going to get rejected (at least in OpenBSD--they're really, really picky about quality).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Writing Linux Device Drivers pr@vn_t Programming 3 08-22-2005 09:52 PM
Writing USB Drivers hoagland Linux - Hardware 3 05-15-2005 09:42 AM
writing device drivers jessy jane Linux - Newbie 2 11-04-2004 01:25 AM
Writing Drivers-question turls Programming 5 01-08-2004 12:44 PM
how to get started writing drivers ? boy Linux - Hardware 3 08-03-2003 12:25 PM


All times are GMT -5. The time now is 06:16 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration