Rewriting Drivers

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
 
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.
 
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?
 
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.
 
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.
 
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.
 
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.
 
Back
Top