Beginning Driver Development

Hi Forum, I am hoping someone can give me a push in the right direction. I am trying to search for developing drivers for freebsdFreeBSD. I am going through the book by No Starch Press. The question that I seem to be getting stuck on (my googling-fu seems to be lacking here), is how would one build a driver for a 3rd party device. For example I have wireless card X and currently freebsdFreeBSD does not have a driver? Do companies produce specs for their devices and developers use those? Do developers use some kind of reverse engineering techniques?

Those are a few questions that I am trying to find.
 
Do companies produce specs for their devices and developers use those? Do developers use some kind of reverse engineering techniques?
BSDs and Linux generally have full driver support for all devices for which companies have released specifications (this kind devices are commonly known as open hardware). Sometimes companies not only provide specifications but also write open source driver and donate it to the projects. One example of such company is Areca which makes best hardware RAID controllers money can buy and has official FreeBSD and OpenBSD drivers for example.

Unfortunately some companies like NVidia, Broadcom, Raspberry Pi for example claim that their intellectual property will be stolen if the hardware specifications are released. They don't provide any documentations for their hardware and require their customers to run specific OS for which they release proprietary blob drivers. Those companies should be generally ignored and such hardware should not be purchased.

There are also companies which operate in between mode. Namely they are willing to release hardware specs to all parties willing to sign non disclosure agreements (NDA) but not to general public. FreeBSD community in generally tries to work with such companies. On another hand OpenBSD project is an example of community which has morally uncompromising point of view that NDA are unacceptable and no OpenBSD developer has ever signed NDA.

As I anticipate that some people will try to make this GPL vs BSD vs (whatever is your favourite license war) I will finish this paragraph with the statement that above has nothing to do with the licensing model. If the company decides to open its hardware and possibly write open source driver they can chose to license the driver anyway they like. A typically business friendly BSD license is preferred but not necessary.

For the record Linux is fully proprietary OS and about 40% of its drivers comes from the grey area which lies in between NDA and fully closed hardware. Raspberry Pi is an example of closed hardware which is fully "supported by Linux". In reality Raspberry Pi is a Linux version of Microsoft Office.

Reverse engineering of the closed hardware is possible but generally consider waist of time. If somebody is trying to close source its hardware there is a typically good reason (hardware sucks so they are trying to hide it). Non the less there are few examples of successfully reverse engineered drivers.
 
Thanks Oko for that explanation. So just to make sure I understand, the atheros driver for my wireless card was built by the manufacturer and not by a FreeBSD dev and given to the community? I do understand what you mean about a license war that may ensue, which I hope it doesn't. This was more about the theory and how to obtain some kind of information on how some companies hardware works and how to go about writing a driver for it and release it for FreeBSD use.

Again thanks for taking the time to really explain indepth how the driver world works. Probably should have mentioned that I am just getting started with lower level programming. Most of my programming has been more for system admin stuff, like install scripts, or utility scripts, and simple web programming.
 
Thanks Oko for that explanation. So just to make sure I understand, the atheros driver for my wireless card was built by the manufacturer and not by a FreeBSD dev and given to the community?
You typically can find out about the author of the driver from good man pages. Sorry but on this one I had to quote OpenBSD man pages which seems to be better

HISTORY
The ath device driver first appeared in FreeBSD 5.2 using a binary-only HAL module which was ported to NetBSD 2.0. The driver using a free HAL-replacement first appeared in OpenBSD 3.7.
AUTHORS
The ath driver was written by Sam Leffler, and was ported to OpenBSD by Reyk Floeter who also wrote a free replacement of the binary-only HAL.
CAVEATS
Different regulatory domains may not be able to communicate with each other with 802.11a as different regulatory domains do not necessarily have overlapping channels.
Host AP mode doesn't support power saving. Clients attempting to use power saving mode may experience significant packet loss (disabling power saving on the client will fix this).
BUGS
Performance in lossy environments is suboptimal. The algorithm used to select the rate for transmitted packets is very simplistic. There is no software retransmit; only hardware retransmit is used. Contributors are encouraged to replace the existing rate control algorithm with a better one.

The driver does not fully enable power-save operation of the chip; consequently power use is suboptimal.
 
Back
Top