Technical difference between haiku and Linux drivers

Who can explain the difference exactly?
There would be to write a way translation code, so that the driver of Linux would work?

There is not much difference. Quite similar to any program, the drivers rely on APIs provided by the respective kernel to do its work.

I'm not very familiar with the Linux kernel, but you will probably need a lot of specific case handling (network buffers, video card dedicated memory allocators, etc).

The main reason the Haiku devs decided to go with FreeBSD drivers instead is that the driver APIs are more stable. In Linux they change and rewrite things in a "continuous improvement" way, which means by the time you have managed to port drivers from one Linux version, there are 2 or 3 new kernels released and you have to do a lot of work to integrate all the changes again.

The interface with the hardware is always the same, no matter which OS is used. The interface with the userspace is also quite similar (the driver exposes a file descriptor, on which there can be open/close/read/write/ioctl operations - with the ioctls possibly being incompatible). The main difference are the way the driver scans for the hardware and decide to load (on Haiku the driver does it by itself, and all drivers probe all hardware parts - on Linux I think udev is involved), and the interface with the kernel itself (how do you allocate memory, manage locking between interrupt handlers and regular tasks, etc) and sometimes a part of the driver is moved to userland (in Haiku this is mainly the case with the grphics driver offloading most of the work to the userspace accelerant).

then it ought to take no longer a problem wireless card and network card drivers. Perhaps one can a bounty start it and transmit at least 10 current and wireless network card driver freebsd.
I need a driver for the network adapter killer 2000 and atheros wlan.
You would need as much money per driver.
50-100 €?

It is not simple to use code from Linux as a shortcut. It is important to have an understanding of what the code is trying to do at the register level and why. Also, any driver copied from the Linux kernel couldn’t be distributed with the rest of Haiku without the resulting OS itself being licensed under the GPL.

You could probably create the driver as an add-on, however - but it is still generally best to (1) understand, (2) implement, based on that understanding. That is unless you feel like lifting the whole set of drivers, spaghetti and all from FreeBSD or NetBSD, for example instead. Even then, that is thousands of lines of code to be understood.

We would probably benefit from more guides in this area, to encourage students to work on drivers. I have attempted on several occasions to get into Haiku driver development but have found the complexity prohibitive due to lack of understanding (still) despite being programming for 16 years, having taken courses on operating systems, the kernel, locking, assembly language, PCI bus layout and having read and mostly understood the Minix book, etc. This stuff requires a lot of time and focus - a diminishing resource as time goes on.

Also openbsd changes api slower than Linux, from what i know, we are behind the current implemention of freebsd stack. So there are new drivers for freebsd but they cant be compiled because our compatiblity layer is to old.
I guess if you can find someone who is updating the compatibiliy layer we will get more drivers for wifi.
That would wiser to spend the money in. Once this is done ist “easy” to port over the driver. From what i know somone is working behind the sences on this task for some time now…

Just to understand how much it would cost to write a driver… bountys for driverdevelopment in linux range from 800 € up to way over 3000 €

Landon Fuller (FreeBSD contributor and active on Haiku’s IRC channel) is willing to mentor anyone who wants to update our compatibility layer for FreeBSD. You will also need help from Haiku developers but they are reading the mailing list and usually take the time to answer if you have clear questions.

The FreeBSD compatibility powers most of our network drivers (including all the wifi ones) so it would make sense, and be much less effort, to continue in that way, than to start over with the Linux version of the same.

For the bounty side: I don't need money, I need time, and access to the hardware. Unless you are willing to pay high enough so that I can quit my paid job without the bank looking strangely at me (so that would be something like 3000 euros per month, on a long term (years) basis). The situation may be different for other developers, but my contract with my employer doesn't allow me to spare any time for personal projects out of my worktime, so I would need it the all-or-nothing way.

Even more conservative than the current choice to import drivers from FreeBSD would be to implement NDIS, the Windows network driver framework.

Whereas Linux releases occur about five times a year, and even FreeBSD releases occur about twice per year, Windows NDIS changes are slower, with only a handful of versions this century and with a lengthy preview period before end users are expected to use the new drivers.

I think moving to NDIS would allow Haiku to be about five years behind the state of the art comfortably. For example, Haiku could have begun work on NDIS support for the Windows Vista era drivers in 2007, completing that work in 2010, and still in 2016 most users would have at least somewhat satisfactory experience, but Haiku would have now started work on NDIS 10 support.

I can’t say for sure how viable this is, other systems have largely abandoned NDIS wrappers as they were able to do their own driver development so they stopped with XP era NDIS, but as we’ve seen Haiku just doesn’t have the manpower for something like that.

Thats a great idea … could you open a bounty for it? Maybe we can find someone like Bill Gates to give some technical details or even better Steve Balmer to cheer up the devlopers:



:smiley:

[quote=NoHaikuForMe]Even more conservative than the current choice to import drivers from FreeBSD would be to implement NDIS, the Windows network driver framework.

Whereas Linux releases occur about five times a year, and even FreeBSD releases occur about twice per year, Windows NDIS changes are slower, with only a handful of versions this century and with a lengthy preview period before end users are expected to use the new drivers.

I think moving to NDIS would allow Haiku to be about five years behind the state of the art comfortably. For example, Haiku could have begun work on NDIS support for the Windows Vista era drivers in 2007, completing that work in 2010, and still in 2016 most users would have at least somewhat satisfactory experience, but Haiku would have now started work on NDIS 10 support.

I can’t say for sure how viable this is, other systems have largely abandoned NDIS wrappers as they were able to do their own driver development so they stopped with XP era NDIS, but as we’ve seen Haiku just doesn’t have the manpower for something like that.[/quote]

FreeBSD have an NDIS API implementation and a lot of time ago I looked into porting it, at this point I guess it shouldn’t be hard to import their implementation in our layer. What I’m not sure is if we need additional kernel support to translate the Windows binary format. Under FreeBSD there’s need to compile an explicit module to do this work.

It is clear that Linux has the largest open source drivers database. And I think that most of what we need is a clear documentation of how the use of Linux information and write drivers for Haiku-OS.
Who will write the Manual?

As with other operating systems that these days rely on their native WiFi drivers, the FreeBSD NDIS implementation is equivalent to that from Windows XP, NDIS 5. In some senses of course Windows XP is a similar vintage to Haiku, but unlike Haiku, Microsoft actually does ship new versions of their OS, and they’ve shipped Windows Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 since then. Fifteen years is probably just too long. So before you start work, I’d spend a few minutes for new chipsets you want to support finding out if 32-bit Windows XP drivers for those chipsets are readily available.

The other downside to NDIS compared with the FreeBSD ports is that Haiku probably can’t obtain permission to ship NDIS drivers with the OS itself, and so users would have to dig out (and test) suitable drivers for themselves to get WiFi working, whereas the FreeBSD drivers can be included out of the box.

Again, for wifi it makes more sense to go with FreeBSD,
because everything is already “in place”.
It just needs an update. The compatibilty layer dates back to 2011
https://dev.haiku-os.org/ticket/7773
As you can see we use the version from freebsd 8.2 wich was released in the beginning of 2011
Sometimes there was “just” one module missing to be able to run driver:
https://dev.haiku-os.org/ticket/6534

Now freebsd is at version 10.2 and supports much more drivers
https://www.freebsd.org/releases/10.2R/hardware.html#wlan

There are dokumentations about the freebsd compat layer, not like a “manual”,but way enought for people who are able to write drivers, to understand everything they need :).

https://www.haiku-os.org/node/10432
https://www.haiku-os.org/news/2007-05-08/haiku_getting_a_freebsd_network_driver_compatibility_layer

For graphic chips and cards there is already a manual
https://www.haiku-os.org/legacy-docs/writing-video-card-drivers

So the lack is not the manuals or the informations ist just the developers an the time they have… since its a different OS than linux or Freebsd it needs to be newly written, rewritten or ported to Haiku… there is no short cut, we just need manpower and free time for the devs.

I Would happly see NoHaikuForMe stepping in to help in mediadevelopment … i am shure he would be able to write drivers e.g. for usb media or so :-).