Rewriting Drivers

Unee0x

New Member

Reaction score: 1
Messages: 15

Suppose I want to rewrite a driver that was already written for Linux / Windows. What parts (if any) could I use ? And what parts essentially must change in order to make a whole BSD driver free and clear of any blow back?

thanks in advance
 

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,017
Messages: 2,017

You will need:
  1. The book "FreeBSD device drivers".
  2. The book "Design and Implementation ..."
  3. A good memory because c&p is out of question.
  4. Skills in async programming.
  5. Knowledge of the hardware in question.
  6. Errata sheets.
  7. Coffee.
  8. Knowledge of kernel debugging.
  9. Highspeed camera (don't laugh. That one actually came in quite handy!)
  10. More coffee.
  11. If available, logic analyzer with tracer.
  12. A test system with LAN connection and SSD for fast booting (no testing on your development system).
  13. Backups
The list may not be complete, but those items are what I found handy or absolute neccessary.
 

Crivens

Moderator
Staff member
Moderator

Reaction score: 1,017
Messages: 2,017

Oh, and depending on the origin of your original driver, you may well need some legal counsel.

What hardware would that be, by the way, if I might ask?
 

rigoletto@

Daemon
Developer

Reaction score: 1,043
Messages: 2,104

If IIRC ralphbsz already give some hints about this subject (porting/license inssues) before, but I may be wrong.
 

rigoletto@

Daemon
Developer

Reaction score: 1,043
Messages: 2,104

Unee0x drivers often born BSD/MIT licensed (by the device manufacturer) and later Linux people manage somehow to stamp a GPLx license on it later. You may want to look for an eventual original code from the manufacturer.
 

_martin

Aspiring Daemon

Reaction score: 169
Messages: 815

Don't know, it's just maybe me ... I'd first attempt to write the driver and worry about legal things later ..
 

sidetone

Daemon

Reaction score: 431
Messages: 1,164

Don't know, it's just maybe me ... I'd first attempt to write the driver and worry about legal things later ..
If going that route, it's better to publish it first as the undisputed author or organization before publicly plugging it into GPL code.

But it's better to sort things out first.
 

DriverBuilder

New Member

Reaction score: 4
Messages: 7

Take a look in /usr/src/sys/compat/linuxkpi/common/include/linux , it helps to identify correct alternative for linux functions.
Ex: gfp.h contains FreeBSD equivalents for gfp_* flags.
 

fnoyanisi

Active Member

Reaction score: 101
Messages: 219

Join the appropriate mailing list, ask questions.
There most probably are people who have done what you want to achive. For wireless NIC drivers, the list is freebsd-wireless for example.

Even if you port a driver, you may still be bound to the original licensing terms (remember, you are modifying the code to get the driver work in FreeBSD, it is a derivate work not something new). Understanding the licensing constraints, if there is any, is important here.
 
Top