A couple of really simple Linux compatibility questions
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Slackware, CentOS. Red Hat Enterprise Linux
Posts: 216
Rep:
Quote:
Is it possible to write a Linux driver that will work on all Linux distributions without having to give away any source code?
Yes. Graphics card manufacturers like NVidia release binary-only drivers with no source code access. Such drivers are always installable kernel modules. However, you will need to release a new binary-only driver with (possibly) each new kernel release since only you will be able to compile the driver for new kernels. You will also need to ready to support the driver and take responsibiliy for it braking things. Since it's a binary-only driver, it will (generally) not be included in any of the Linux distributions, meaning that the end-user, should they want to use it, will have to obtain and install it for themselves. How useful your driver turns out to be will depend on how desparate users are for it (does it operate hardware for which no open source driver exists), how up-to-date your releases are (do you keep up with the 2.6 kernel releases in a timely fashion and is a backport available for the 2.4 kernel), how active your support is (can someone connect you and expect a timely, helpful reply) and if you plan to charge for it.
If this a driver for a piece of hardware that you manufacture or that you have exclusive, non-disclosure knowledge of, and it's not easy for someone in the open source community to develop one (and someone will try, if for nothing else than to prove it can be done), then it might be worth it to you to develop a binary-only driver. Keep in mind the points above or it won't see much use in the Linux community. No one likes being locked in to a particular kernel version because of a binary-only driver.
Quote:
Same as above but for a commercial software package (e.g. Photoshop)?
Much easier because as long as you adhere to the standard APIs, your program should work under any version of Linux. Generally your issues are going to be the libraries installed on the system rather than the Linux kernel, and with good coding practices, this should not be a difficulty. There are more examples for closed source applications than there are kernel drivers.
Simple question, complicated answer. A kernel module compiled on one system will not work on all. For a kernel module to work it needs to have been compiled against the source for the running kernel and with the same version of gcc. With the number of combinations of kernel versions plus patchsets plus gcc versions, you can't provide a binary module.
The way Nvidia handle it is their driver ships with the kernel module source as it obviously needs to be built and binary versions of libGL and a binary X11 driver. The LICENSE file that comes with the driver distrobution is pretty explicit in it's terms and obviously judging by their track record they have everything under control. Now the binary libGL and X11 driver will work on all systems (this gets tricky with 64 bit distrobutions though), it's only kernel stuff that is all fiddly.
In regards to a software package, that should be simple enough and to make things even easier you can compile against your own static versions of libraries that it links against and ship those with it so it's 100% self-contained.
Just out of interest, why does a driver have to be recompiled for every new version of the Kernel? Surely if the driver API stays the same a driver should continue to work.
It is my understanding that Windows uses the Portable Executable File format for its drivers along with a standard interface which allow for a driver to be compatible will all versions of the OS built on the same tech (ie 9x or NT). Is this assumption correct? If so couldn't Linux adopt this kind of strategy?
I apologise if these are dumb questions, I should say that I have never touched driver development myself.
The reason I ask is because the compilation of software and drivers seams to be quite a stumbling point for newbie’s and I was wondering if there was another way.
It is my understanding that Windows uses the Portable Executable File format for its drivers along with a standard interface which allow for a driver to be compatible will all versions of the OS built on the same tech (ie 9x or NT). Is this assumption correct?
Unfortunately, no.
Just try and find/install a driver for any recent piece of hardware on a Windows 95, Win98 (pre-SE), or WinNT machine. Go ahead and try it. Grrrr....
Conversely, try installing WinXP on an old WinNT machine with older hardware. Grrrrr again....
Oh sorry I didn't explain my self very well. I meant that there is a generic driver for all 2000/XP systems and another generic driver for all 9x systems no matter which kernel version is being used or which updates are installed etc. At least I think its a generic driver, It could be lots of drivers bundled into single self-installing .exe but jugging by the fact that my old WinTV 2000 driver works in XP I think they are generic.
From cs-cam's post I assume this is not possible for Linux but am unsure of the pacific reason.
My question put very simply is: Why would I have to rebuild a driver for every new version of the kernel?
Oh, I got exactly what you meant. And unfortunately, it simply doesn't work out that way in Windows. If you're lucky, the same driver will work on different versions of Windows which are similar enough. If you're lucky. But between Win95 and WinMe? Between WinNT and WinXP? Just ask anyone who has the misfortune of having to do IT support for a wide mix of computer systems.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.