Linked by Thom Holwerda on Thu 1st Feb 2007 14:41 UTC, submitted by Oliver
FreeBSD "Linux has a large amount of device drivers for hardware not supported on FreeBSD, especially USB devices. Not rarely, such drivers have been written based on information derived by protocol sniffing, reverse engineering and the like. This makes the code highly undocumented, and renders the porting effort extremely error prone. To help with this task, I decided to start working on an emulation layer that would let us recompile the linux source code on FreeBSD, and provide a sufficiently complete emulation of the kernel APIs so that device drivers (or at least certain classes) could be used without modifications to their source code."
Permalink for comment 208173
To read all comments associated with this story, please click here.
RE: Back on Topic
by Morin on Thu 1st Feb 2007 23:18 UTC in reply to "Back on Topic"
Morin
Member since:
2005-12-31

Finally, somebody is back on-topic ;)

As for the magic numbers, many of them have no proper documentation and have a very device-specific meaning. Documenting them is not really a problem of porting the driver, but writing a clean driver in the first place. This would help Linux as much as it would help FreeBSD, but it's going to be a tough job. And it's a particularly uninteresting job if the device is a hardly-known and old one from a hardly-known company that already went out of business.

As for the porting itself, I think its a really bad idea. You can only emulate the OS/driver API properly if there is such an API in the first place. This isn't the case with Linux. I have actually written a kernel module once and I have to classify the kernel as "unstructured spaghetti code" - there simply aren't properly defined interfaces between the different parts.

If you want to emulate that mess in FreeBSD, you have to port half the kernel just to make sure every little bit behaves as intended. If you don't, you'll get headaches again and again for every single driver to be ported. I don't know if FreeBSD has similar code structuring problems, but if it does, a FreeBSD kernel with Linux emulation is going to be an unmaintainable mess that will never work.

Reply Parent Score: 3