Improving Linux Driver Installation
by Jono Bacon09/09/2004
With any operating system, hardware drivers play a key role in ensuring that the hardware can talk to the software and vice versa. Although often riddled with specific information about how a device works, many of these drivers are very similar in their design and code. For example, many USB digital cameras use the same method of storing pictures; although the devices are different, the drivers are similar.
The increasing popularity and number of contributors to the Linux kernel have created a culture in which the kernel itself includes the driver source code. When compiling the kernel, you can select the drivers you want to use. Linux also has the capability to compile most drivers into special modules that it will load only when you use the device. These loadable modules allow the kernel to load certain drivers only when needed. This is particularly handy with rarely used devices and removable USB peripherals. Although loading drivers on the fly is flexible, the user experience of dealing with drivers has required that users know how to deal with modules, mount disks and devices, and low-level device information. These requirements have acted as a barrier to Linux adoption for nontechnical users.
Project Utopia
Over the past year, several developers from different projects have collaborated to form an effort called Project Utopia. The expressed aim of the collaboration is to make device handling in Linux as simple as possible for both the user and the developer. Among its results, this project has produced the Hardware Abstraction Layer (HAL), a specification and software tool that tracks devices on the system. The aim of HAL is to prevent developers from manually implementing code that deals with devices. Instead they can use a reliable layer that provides notifications about devices, such as when a user plugs in or unplugs a USB device.
|
Related Reading
|
As Project Utopia has matured, the idea of an easy-to-use method of dealing with devices has produced many potential use cases. In the eyes of the project's architects, a user should plug in a USB device and have it appear on the desktop, ready for use. When you plug in a camera, the photos should sync with your desktop photo application. A wireless card should log on to the network. Plugging in a printer should bring up the printer configuration tool automatically. These are some of Project Utopia's aims for how it will handle devices on the desktop of the future.
Drivers on Demand
Although the core goal of Project Utopia is to simplify device usage, one of the areas that is outside the domain of the project is making drivers easier to deal with. The main problem is that Project Utopia will need an appropriate driver for each device. If the running kernel does not have support for the device, the user will need to upgrade or possibly compile a kernel manually.
Andrew Leucke created a related project to continue this vision. The goal of Driver on Demand is that the user should be able to plug in a device and the software will then check whether a device driver module is present. If not, it will download the relevant driver from a secure Internet site and insert it into the kernel. The user will not have to run through the complex process of finding a driver or recompiling the kernel. With a well-designed, well-specified, and well-tested security model to prevent the installation of malicious drivers, this system could push Linux to a new level of ease of use.
Although the Linux kernel is an impressive and stable feat of distributed engineering, the incompatibility between different stable point versions of the kernel hampers the Driver on Demand concept. You could compile a driver for 2.6.5 and it would probably not work on 2.6.10 if you simply loaded the precompiled binary module; you would need to recompile the driver for each kernel version.
This problem worsens when you consider furnishing a driver for all distributions. Not only do you have the official 2.6 tree to consider, but you also have the slight modifications that different distributions add to the kernels. If you want to distribute a precompiled binary driver, you'll need to provide a binary for each point version in the kernel for each distribution. This can amount to hundreds of modules for a single stable kernel release.
The reason a single binary driver will not work across a kernel series is the lack of internal API and ABI (application binary interface) compatibility in the kernel. The API specifies a list of functions and facilities that the kernel exports to people writing other kernel features or modules. With the API you need to ensure consistency, as the code that uses the API will rely on the API staying the same. The compiled version of the kernel also needs to have a standard interface so that the programs that link to it will find the functions and structures they expect. This standard interface of a compiled program is the ABI; it is the interface that changes with almost every kernel release.
Linus Torvalds, the creator of the Linux kernel, has been quite clear on his position of ABI stability on the Linux Kernel Mailing List: "It's not going to happen. I am _totally_ uninterested in a stable ABI for kernel modules, and in fact I'm actively against even _trying_. I want people to be very much aware of the fact that kernel internals do change, and that this will continue." He continues, "I occasionally get a few complaints from vendors over my non-interest in even _trying_ to help binary modules. Tough. It's a two-way street: if you don't help me, I don't help you. Binary-only modules do not help Linux, quite the reverse. As such, we should have no incentives to help make them any more common than they already are."
Linus's position seems to be very much a black-and-white scenario--if you don't contribute to Linux, why should it support your device? Although this is a perfectly reasonable position, locking out binary-only modules also limits the reasonable use of binary versions of modules that do have available source code. If it is fair to assume a large proportion of the Linux community is against binary-only drivers, there is also a proportion of users who would prefer the convenience of using binary drivers based on open source code. David Zeuthen, the maintainer of HAL, sympathizes with the problem. "I think it's a difficult issue," he says. "I for one actually appreciate the fact that the kernel team doesn't want to be locked in, because maintaining stable API and ABI is expensive, and it surely makes it more difficult to innovate and improve the kernel."
Driver Overload
It is apparent that the kernel will never match the kind of ABI stability that is common in commercial operating systems that see kernel updates once every few years; the two different development models simply do not compare. The challenge that faces kernel developers is the question of driver overload versus driver convenience. On the one hand, it is convenient to have all Linux device drivers inside the kernel source tree. On the other hand, this produces an ever increasing kernel tree that needs to support every device for every supported platform.
Another problem is that many drivers have not yet made it into the kernel tree proper. Zeuthen cites this as a particular issue. "I feel that one of the biggest problems is that the bar to getting a driver in the kernel may be too high," he says. "I've got a number of devices for which there exist a driver, but I have to go and download the source and compile my own kernel module, which is bad."
Zeuthen has highlighted possibly the most critical problem with the current kernel framework for handling drivers. When Torvalds started work on the kernel back in 1991, the concept of including drivers with the kernel tree seemed to make inherent sense from an outsider's perspective, but with the huge interest and adoption of Linux since those days, the issue of keeping every driver in the kernel could cause problems as the kernel scales and supports hundreds more device drivers. Although the vetting process for drivers does ensure that the kernel is of a high quality, there are many third-party drivers available--although the complexity of finding and installing them may discourage regular users from trying.
Zeuthen continues: "An interesting side effect of the in-kernel API-ABI instability is that authors of drivers outside the kernel have to make a release for every released kernel. Throw in the fact that some vendor kernels are horribly patched, and you'll have people using kernels from kernel.org to get the device working. Now those users have a problem that other parts of the OS don't work because they are not using the vendor kernel, which is bad. Another problem is that when I upgrade my operating system and get a new kernel from my vendor, I manually have to recompile all my drivers--which is also bad, because lazy users don't do that, and then they are more prone to run unpatched, vulnerable systems."
Zeuthen proposes a possible fix to this problem. "[Perhaps] one solution would be to convince Linus to lower the bar on driver inclusion in the kernel and mark those drivers as experimental, in progress or something," he says. "It still doesn't solve the issues of closed source drivers, though--users will still have to drop to a text console and rerun the NVIDIA installer, for instance".
As the maintainer of Driver on Demand, Luecke also shares some of these concerns. "[Even] though Linux is scalable itself, its configuration interface isn't," he says. "At the moment, it's easy to configure which drivers we want to compile in, but in five years' time, when there are ten different new buses and a massive foray of new devices, it will take too long to configure which devices you need--which means that sometime in the future, the Linux kernel really needs to offer a way of detecting which drivers it needs to compile in itself, and try to show the user as little as possible (like if they want preemption or support for a device currently not in their computer)."
Mapping the Future
The kernel is possibly the most critical component in a Linux system. Although the facilities within the kernel have changed and improved, there have been few fundamental architectural changes in the software. The challenges of dynamically loading drivers, a growing kernel source code base, using drivers from outside the official tree, and making the drivers as easy to use as possible keep moving the goalposts for the kernel developers.
One of the problems with low-level software such as the kernel is its perception among Linux users. Should they rely on distributors who create their own binary modules for their distributions, or should regular users download and compile their own kernels? My view is that the common perception is a little bit of both. Linux development often means creating frameworks to present to users in prebuilt configurations typically found in distributions. An example of this is a graphical environment; if you install the environment from CVS, you need to know how to configure and tweak the environment to suit end users and to give them access to its different facilities. The kernel is in many ways a hybrid technology and falls into the hands of normal users and software architects.
Leucke suggests that until a better method of handling the increasing driver requirements appears, "probably the biggest current issue is that there is no mechanism in place to manage drivers. We currently have package managers, but what we really need now is a driver manager; one which records the external drivers' installation, their versions, where they came from, and includes a mechanism for them to be upgraded easily. It shouldn't be completely unexpected that in the future, drivers for devices will come on CDs, and at the very least, users will want to be able to just double-click the driver to install it, or they will want a way they can get a driver automatically installed without needing to do anything (which is what Driver on Demand is about). The truth is that Linux will never be able to include drivers for devices in its kernel as they are released, and Linux distribution installation CDs will never be 100 percent up to date--so such a system would compensate for that, and allow Linux distributions during installation to ask for a new driver on disk (for networking or whatever else) and install it with barely any intervention. A system like this would be particularly handy on a clustered system, which could automatically update its drivers if it had this available."
Heading into the Future
There is little doubt that the goals of Project Utopia aim to bring Linux forward into the desktop era, where hardware will work as users expect it to. Although the challenges of a Driver on Demand framework are high, the core functionality and original aims of the Project Utopia framework mostly works today. The developers are now stabilizing the different components, intending to add them to the next release of GNOME (2.8) to embed the functionality into the desktop.
With the core of Project Utopia complete, application developers from any desktop or project can HALify their software and use the HAL specification when they need to deal with hardware. Already CUPS has begun this process. If major tools such as X servers follow suit, that could resolve many of the configuration problems that have plagued hardware devices.
One of the true benefits of the collaborative open source model is how well it can fix and improve issues and problems. I have no doubt that this will continue to apply for the challenges of using Linux as a desktop operating system. It will be interesting to see whether these challenges can push the kernel into new areas and continue the evolution of the Linux desktop.
Jono Bacon is an award-winning leading community manager, author and consultant, who has authored four books and acted as a consultant to a range of technology companies. Bacon's weblog (http://www.jonobacon.org/) is one of the widest read Open Source weblogs.
Return to the Linux DevCenter
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 16 of 16.
-
So why would it not be possible ...
2004-09-13 08:48:55 George_Mitchell [Reply | View]
to create a module that, in effect, would be an interface. It would be entirely open source and versions could be created that would mimic the API/ABI's of all major Red Hat kernel releases. The source would be open and freely available and include its own /lib/modules entry. And a companion package would carry its own customised insmod/rmmod/mobprobe, etc tools. Thus one could install any number of these interface modules on whatever kernel they are running, and then install whatever proprietary module on the appropriate Red Hat module. It would be like a system of dynamic wrappers that would provide a measure of forward/backward compatibility. And since it would be fully opensource, there would be no danger that the old binary module would someday cease to work. The API/ABIs of these binary modules are open, they have to be in order to work with the opensource kernel for which they are designed. Thus it should be possible to create support for them across a wide range of kernels, and even for other unixes, MacOS for example. So why aren't developers looking into this type of solution? Modern hardware certainly should support the extra overhead with no problem.
-
Half the story
2004-09-13 01:51:10 AndyKirk [Reply | View]
I think the aims of Project Utopia are noble and hope the linux driver nightmare improves. Its a lot better for linux than other alternative operating systems though, and even if Utopia gains universal acceptance in the linux world, the availability of drivers for many devices will continue to be an issue.
I'd like to bring up the Uniform Driver Interface which would allow for portable binary drivers across platforms:
http://www.projectudi.org
I like this idea because its aims are like those of Java only it targets a much smaller application space. This is anathema to Microsoft however and I'm sure this has something to do with its slow road to acceptance.
Good article BTW!
-
A small suggestion
2004-09-12 23:36:44 vaibhav_khattri [Reply | View]
Hi,
I have a small suggestion, which I feel can address the ABI problem.
Why not extend the "Driver on Demand" thing, to include compilation on the fly?
Lets take an example scenario. I have some XYZ device which I plugin into my system. The system doesn't have the required driver. It sends the specification to the "Driver on Demand" site. Besides the device specification, the reuqest also contains the machine and the kernel specification, in all every parameter that is required to compile the driver.
The site only contains the source code of the driver plus details like which platforms and kernel versions its stable.
Based upon the request parameters and the driver specification, the site server automatically directs the source to a pre-configured machine of that type. And then the binary so obtained is sent to the user.
However this scheme places a good amount of load on the server. Their is another scheme in which we can compile on the user site, just like gentoo distribution does. For that we can embed a C/C++ compiler in the kernel, which is tuned according to the kernel configuration.
If the kernel versions and driver specifications do not match we can inform the user of the unavailability. -
A small suggestion ?
2004-09-13 10:09:19 mmarq [Reply | View]
You start from the principle that there is widely available proper documentation to make open source
device drivers for any piece of hardware out there.
But AFAIK the contrary is true. Most Open Source drivers, though some are very good, are *guessed* implementations of poor documentation, years or trial and error, and reverse engineered methods... and it has been so for the last 20 years...
It always has been, IMO, that the biggest mistake of Open Source to force an all open source approach, that has made this divorce with the hardware industry.
There are already plenty of interfaces, inside Linux kernel, but in colorfull examples,Nvidea and ATI prefer to ignore, and not contribute to the advancement of what is already inside, and make "yet more differente interfaces from on to another, that load their proprietary closed "userland" binary modules.
-
Driver model
2004-09-12 13:48:09 mmarq [Reply | View]
" The reason a single binary driver will not work across a kernel series is the lack of internal API and ABI (application binary interface) compatibility in the kernel. "
From the limited knowleadge i have of the matter, and from what i can understand of D-BUS...
http://www-106.ibm.com/developerworks/linux/library/l-dbu...
... you could extend D_BUS *down* to deal with hardware device drivers, in a way that it only need to augment the messages types (and other fearures probabily), dealed by D_BUS system to create a messaging based device driver model, similar to how I2O works, and that way pass altogether the need of a proper ABI that could take years to stabilize.
-
We need user space drivers
2004-09-11 08:57:46 bilou [Reply | View]
Yes, maybe we should the kernel and the drivers independent from each other. We need a standard framework for the drivers.
-
DoD: use the source, Luke!
2004-09-10 14:52:26 MadScientist [Reply | View]
Maybe I missed something. Why does DoD have to download a binary driver (assuming of course that the driver is not proprietary)? Why can't it just download the source to the driver, build it on the user's system, and install it?
Obviously this won't work all the time: if the driver source is too old it might not work with a newer kernel, and some kinds of patches might break some drivers, etc. But it would solve most of the problems relating to distro-patched kernels exponentially increasing the number of binary modules that need to be kept for download, and the DoD could hide all of this from the user and if the insmod of the newly-compiled kernel failed it could report this to the user maybe with a link where they could go to report the problem and get help.
Obviously there are some assumptions here, such as the kernel build needs to support external module builds in a robust way (but I thought 2.6's kbuild did this?); distros all would need to provide at least enough infrastructure to build external modules (which is not all that much really) and a compiler (but just C, not C++/Java/etc.) on every system as part of the base install; distros should release kernels with MODVERSIONS enabled (don't they all do that already?); kernels need to ensure their numbering scheme is lexicographically rigorous so you can associate versions of the driver source with versions of the kernel and pick the most likely fit.
And of course, as mentioned above, this does not much help proprietary kernel module vendors (although if the DoD wished they could allow binary modules to be distributed through the framework on a "best effort" basis, and give the vendor's contact info if the insmod fails instead of the OSS community info). This might even give yet more incentive for vendors to provide source rather than binary.
Just some thoughts... -
DoD: use the source, Luke!
2004-09-10 19:42:58 Welington [Reply | View]
"Users just click" ???
Why the people wants to make the Linux so similar to (R)Windows ?
If the user wants just to "click" an see the things happening, use the SO made for that, but pay the price.
If the user wants the better and cheaper SO, use the Linux SO and pay the price (learning a few about it). Is the minimum that he can do.
Otherwise, in the future, when the (R)Windows will became history, we'll have just upgrade the software (SO), but the users (still) will be the same ...
-
DoD: use the source, Luke!
2004-09-13 10:02:01 MadScientist [Reply | View]
> Why the people wants to make the Linux so similar to (R)Windows ?
I've been using UNIX since 1984 and Linux since 1993 and I have heard this "argument" made by some people since day 1. In that time of course, Linux has gotten much simpler and more straightforward to use for those who haven't spent any time learning to love UNIX. I can't understand why adding a user-friendly interface over Linux, or any UNIX, is so frightening for people. It doesn't mean that anything will change "underneath". No one is talking about removing the shell or making it less powerful. No one is going to take away your ability to compile your own kernel, go traipsing through Google and various murky sites from the far reaches of the world looking for a driver for your favourite obscure bit of hardware, etc. What is so intimidating about allowing people who don't have the time or understanding to still be able to use Linux if they want to? Why does the barrier to entry have to be so high that only the most intrepid will attempt it? What is gained by blocking out everyone else? I just can't understand this attitude.
And finally, why does any mention of a graphical interface immediately invite comparison to Windows? Why can't we assume that the Linux interface will be significantly better? Just because it's graphical, it must be avoided, is that it? Sorry, I don't buy it. -
DoD: use the source, Luke!
2006-01-11 08:31:10 OlderSchool [Reply | View]
I agree with your last statement, (and actually the spirit of everything you've said and questioned here), about the continuous comparison between any GUI and (R)Windows. Many people don't realize that it wasn't Microsoft or Apple for that matter that brought GUI to computers. It was Xerox, at PARC. Xerox brought us the mouse, GUI, Ethernet, IPX/SPX, and many other technologies that so many others have taken or been given credit for. I'm at a loss why Xerox didn't sue Apple when they came out with a system that had a GUI and used a mouse; instead it was Apple, years later, suing Microsoft as if they (APPLE) had originated GUI technology on computers.
Just something to think about when associating GUI or ease of use with Microsoft. Xerox did it first, and the underlying operating system was Unix, or a Unix like operating system. From the Wikipedia.org web site:
"Xerox PARC was the incubator of many elements of modern computing. Most were included in the first personal computer, the Alto, which included many aspects of now-standard personal computer usage model:
the mouse1, computer generated color graphics, the WYSIWYG text editor, InterPress (a resolution-independent graphical page description language and the precursor to PostScript), Ethernet, and fully formed object-oriented programming in the Smalltalk programming language and integrated development environment. The laser printer was developed at the same time, as an integral part of the overall environment.
Among PARC's distinguished researchers were two Turing Award winners: Butler W. Lampson (1992) and Alan Kay (2003). The ACM Software System Award recognized the Alto system in 1984, Smalltalk in 1987, InterLisp in 1992, and Remote Procedure Call in 1994. Lampson, Kay, Bob Taylor, and Charles P. Thacker received the National Academy of Engineering's prestigious Charles Stark Draper Prize in 2004 for their work on the Alto system."
http://en.wikipedia.org/wiki/Xerox_PARC
-
API problem much worse than indicated
2004-09-10 10:54:02 elanthis [Reply | View]
The unstable API provides far worse problems than (clearly) indicated in the article. One solution proposed was to include drivers in the tree earlier - that *DOES NOT* fix the problem!
Imagine this _common_ situation. I install Linux Foo 1.2. It has kernel 2.6.5. Some new hardware is invented, a driver becomes available in-tree, and is released for 2.6.7. Guess what? That hardware does not work with Linux Foo 1.2. Vendors do not distribute all new kernels for their distributions, because due to all the other changes in kernel revisions (far more than just driver bug fixes) and their kernel patching, it would be dangerous to try to push a new kernel out. Instead, Linux Foor 1.2 will only ever have small security and bug fix patches applied. There will never be a 2.6.7 kernel package for Linux Foo 1.2.
However, the kernel API has, of course, changed between 2.6.5 and 2.6.7. There is no way to just go grab a copy of the driver for 2.6.5 and install it. No, you must use 2.6.7. And not "2.6.7 or higher," because higher might break the API again. Just 2.6.7. Since Linux Foo 1.2 will only ever have kernel 2.6.5, the user cannot simply install the driver for his new hardware.
The user, in order to use this new hardware, must upgrade his entire OS. But wait, Linux Foo 1.3 won't be out for another 3 months. The user must instead manually install a new kernel. Assuming that you actually had a user who's willing to upgrade their OS at all, you've now alienated and lost the vast majority of remaining users, because the number of people who even know how to, much less are willing to, manually download and install a kernel (possibly adding various patches for compatibility with their distro's special features) is very, very small in relation to the total number of computer users.
The end result really is that the hardware is useless on Linux in general until 3+ years down the road when everyone is using a kernel newer than 2.6.5. Of course, the users who got burned previously may not be using Linux anymore. And there will be new hardware out that won't work with Linux then, either.
The in-tree drivers do absolutely nothing of usefulness *now*. They only make hardware work for any appreciate fraction of the user population a *long* time after the driver is added to the tree.
The solution requires it to be possible for a user to install a driver for whatever OS they currently have installed. This does *NOT* require ABI stability; it is acceptable to require drivers to be distributed as source and require compilation, so long as there is an easy to use method for doing so. It does require a stable API so that a driver can actually be able to compile without needing to match it to the specific kernel running.
(I imagine a special kind of "Linux Driver Package" with tools that compile and install the packages for the user. Users just click on the driver on the CD that came with the hardware, or from a driver web site, and the GUI tool pops up and does the work, prompting for verification and authorization. This will work even if drivers are distributed as source, so long as all user systems have the basic compiler/development tools installed.) -
API problem much worse than indicated
2004-09-14 13:51:11 CodifexMaximus [Reply | View]
At the risk of being flamed, I must say the following...
Microsoft has a great idea with their Interface Contract idea. They will create an interface (API) with certain methods and properties; then they will update the interface with new methods and properties WHILE RETAINING THE OLD INTERFACES.
I suppose some API's in Linux are using this model for backwards compatability but all are not. The idea has good and bad points: good are that old programs will keep running; bad are that api bloat will occur.
Choose yer poison.
Microsoft also had another good idea back in 1994: minidrivers. MS realised that alot of the monolithic driver code in Win3.1 was similar if not flat out identical. The only differences were the device specific portions. Therefore, MS implemented the stub (or whatever they call it) that contained the generic code for a device then the minidriver made by the device company completed a full device driver. Simple, easy, concise.
There may be reasons why one would not want interface contracts and stub modules; at this point, I don't see much of a reason not to have them myself.
Now for the Driver on Demand idea - I think it's good. There could be a central database possibly at the distro maker's site. It could contain minidrivers for each device (submitted by the device manufacturer) with each device having an ID (I assume they already have this ID) and a database onboard the user's computer to complete the identification and driver selection process.
Compilation on Demand could be a boon AND a bust depending on the accuracy and testing of the builds. I use Gentoo so I'm comfortable with this model - others may not be.
There's my buck fifty,
Codifex Maximus -
API problem much worse than indicated
2004-09-13 01:01:12 nmailhot [Reply | View]
Don't be silly. Do you think hardware devices are manufactured out of thin air ? There is a large window between hardware design and appearance where drivers can be written, vetted and included in the source kernel tree.
<br/>
And the more innovative a device is, the more it is true (for stupid variants you have just to add a hardware PCI/USB id to the already-written driver).
<br/>
In fact drivers have been written in the past for top-secret devices not yet aven announced, even full subsystems were included before for yet-to-be released standards. Kernel inclusion is only a problem for lazy vendors (and those won't maintain correctly their out-of-tree trash anyway)
-
API problem much worse than indicated
2004-09-12 06:24:57 CharlesEllis [Reply | View]
Another solution to this situation is to be a bit more windows like...
For the more user-friendly distributions, instead of having 2.6.5 and 2.6.7 and 2.6.8, etc. They could release a new version of the distro for 2.6 (presumably this would be the last new version to the 2.6 tree), and then release another version of the distro for 2.8
I realize that this is not the best solution in the world, however it has been proven to work with the commercial OSes, and would help driver compatibility for those not willing/not knowledgeable enough to compile drivers specifically for a specific version of the kernel. -
API problem much worse than indicated
2004-09-12 03:40:17 Dragonheart73 [Reply | View]
Dosn't the latest detonater-Driver original from nVidia follow a similar approach?
You have the Kernel-Sources to be present, but no more user action is required than calling a shell-skript. Then the driver is compiled and installed.






http://linux.dell.com/dkms/