Slashdot Mirror


Migrating Device Drivers to the 2.6 Kernel

An anonymous reader writes "While it's all well and good to find out how to upgrade your kernel to 2.6, as this recent /. story pointed out, developers, especially device driver developers, might be more interested in the kernel's new device driver model. Over at Linux Devices, there's a new article on Migrating device drivers to Linux kernel 2.6. The short version: That little ole Hello, World! kernel module is a heckuva lot more complicated than it used to be."

59 of 269 comments (clear)

  1. uhh... by epiphani · · Score: 4, Insightful

    how is the extra added line of MODULE_LICENCE("x"); make the simple sided 2.6 kernel module substantially more complicated?

    --
    .
    1. Re:uhh... by Narchie+Troll · · Score: 5, Informative

      The build process is substantially different. Actually, it's simpler, provided you have a Linux source tree handy. But you can't develop your kernel modules just anywhere anymore.

      Actually, the license macro isn't even necessary, 2.6 is just bitchier about kernel taints.

    2. Re:uhh... by megabeck42 · · Score: 5, Informative

      I gotta just reinforce the fact that the new kbuild system makes compiling kernels outside of the build tree much easier.

      First of all, there's now a symbolic link from /lib/modules/.../build to the kernel source, further with kbuild, it handles all the dependencies and symbols, etc.

      Basically, compiling a module outside of the tree in the old 2.4.x was difficult and if you were using modversions, almost impossible - you need to have the kernel source and kernel configuration - its necessary anyways. Now, all I need to do is

      make -C /usr/src/linux-2.6.2 SUBDIRS=$PWD modules

      and voila, kbuild handles everything for me.

      --
      fnord.
  2. If it means we're one step closer to... by rokzy · · Score: 4, Funny

    fully-functional ATI drivers (with newbie-proof installer), then I for one welcome our complicated-new-kernel overlords.

    1. Re:If it means we're one step closer to... by SHEENmaster · · Score: 4, Funny

      My best computer doesn't even have a framebuffer, you insensitive clod!

      --
      You can't judge a book by the way it wears its hair.
  3. Re:Upgrade now? by MarcQuadra · · Score: 4, Interesting

    Why did it take so long? I just upgraded all four of my boxes last night. It took five hours to upgrade them all.

    emerge development-sources
    cd /usr/src/linux-2.6.2
    make menuconfig ... set options and save
    make && make modules_install && cp arch/i386/boot/bzImage /boot/vmlinux-1.krnl
    reboot

    How hard is that? Are you running a 486 or something? Compiling took under 30 mintes on my 350MHz box.

    --
    "Sometimes, I think Trent just needs a cup of hot chocolate and a blankie." -Tori Amos on Nine Inch Nails
  4. Linux Device Drivers by rjoseph · · Score: 5, Informative

    Supposedly the third edition of Linux Device Drivers will be released soon, and will be geared towards 2.6 development (obviously). Anyone who's ever wanted/needed to do linux module programming should definitely take a look at this book, it's basically *the* reference.

    1. Re:Linux Device Drivers by wdebruij · · Score: 5, Informative

      I couldn't agree more. A month ago I started serious kernel programming and my code wouldn't have been what it is if I hadn't found out about the free, online version of the second edition.

      Some other useful sites :
      the Linux kernel API reference

      Linux cross reference, especially the `identifier search'.

      the driver porting series over at LWN.net (which Rufus211 alreay pointed out).

      the module init tools FAQ

      this document, aptly titled `the linux kernel'

      apart from these there are many more interesting links, but mostly those have to do with specialty domains, such as networking or memory management. I pasted my bookmarks.html to my personal website.

      And lastly, if you want to do cross-version /dev (mknod and devfs), mmap, module or networking development, please take a look at our project's cvs server through our website (webcvs) at ffpf.sourceforge.net. The directory ffpf/srv/v1.1/generic contains some files I created that work on both 2.4.24 and 2.6.1 and which I'll test on a 2.3.99 system shortly.

  5. LWN by SecMF · · Score: 5, Informative

    LWN has some documentation on this for some time now: http://lwn.net/Articles/driver-porting/

  6. a lot more complicated ? by pytheron · · Score: 5, Informative
    From the article linked:-
    ...the most significant change to working with device drivers for the 2.6 Linux kernel are the changes in the build process described in the next section


    The only difference in the skeleton modules described in the article is a MODULE_LICENSE("GPL"); and a "return 0;".


    Breathtakingly difficult ! In fact, the only 'hard' part seems to be changing how (if at all) your module interacts with other kernel components ! If you wrote a module that utilises these aspects of the kernel, moving to a new API would not be that difficult.

    --
    "I am not bound to please thee with my answers" [William Shakespeare]
  7. LWN has far more depth by Rufus211 · · Score: 5, Informative

    There's a 30 article series over at LWN about porting drivers to 2.5/6 with both overview articles (like this hello world one) and specifics (like how the block layer changed).

  8. Linux 2.6... by Ianoo · · Score: 5, Interesting

    Linux 2.6 really is the best thing since, erm, sliced bread. I've been helping my Linux friends install it on their machines this week, and the difference is rather noticable, to say the least. Hopefully it'll get in place across all the main distros pretty soon and the upgrade path will be easier for those who are afraid of recompiling for themselves (i.e. the vast majority if we want more Linux-on-the-Desktop use).

    One of my biggest problems with the current driver model is the poor-ish support for loading drivers across minor revisions. I prefer GPL, and agree with a lot of the idealogical reasons behind Free and open source software. Companies, OTOH, do not. We need companies to write device drivers, since the complexity of something like an nVidia GeForce GPU is simply too much for a small team of people to reverse engineer.

    One of the biggest problems at the moment is not being able to go to nVidia's website, download a precompiled binary module for your arch and load it into the kernel. Equally drivers off of a manufacturer's floppy or CD-ROM need to work this way too. Unfortunately it seemed that with Kernel 2.4, even a 0.0.1 difference in version number could mess things up and require recompilation. Has this been improved in 2.6?

    I think that this is the level of compatibility that needs to be achieved before we see more widespread support by the HW manufacturers. It seems like the guys over a freedesktop.org will have their work on a graphical driver loading system in place quite soon, so this part of the deal is essentially solved.

    1. Re:Linux 2.6... by The+One+KEA · · Score: 5, Informative

      Sorry, but it's not gonna happen. Linus has repeatedly stated that he will never modify the internal APIs of the kernel to make the maintainership of binary-only modules easier for hardware manufacturers. While this attitude may seem unfair and self-serving, it makes sense, and is not likely to change.

      Right now 3D graphics drivers for ATi and NVIDIA cards are the only sticking point in hardware support IMO. Just about every other major component has Linux support, if you do careful research before buying.

      --
      SCREW THE ADS! http://adblock.mozdev.org/ Proud user of teh Fox of Fire - Registered Linux User #289618
    2. Re:Linux 2.6... by be-fan · · Score: 4, Interesting

      NVIDIA cards, anyway, have excellent Linux support. Thanks to the fact that the NVIDIA drivers use a portable core anyway, they seem to be having no problem keeping up with the kernel.

      --
      A deep unwavering belief is a sure sign you're missing something...
    3. Re:Linux 2.6... by DAldredge · · Score: 5, Insightful

      You know that is a shock to all those that run high end OpenGL apps on linux, apps like 3D modelers and highend CAD/CAM apps.

      And face it, x86/AMD64 are the main platforms that Linux is used on.

    4. Re:Linux 2.6... by jbr439 · · Score: 5, Interesting

      My understanding is that Solaris/SunOS has a driver API/ABI that allows forward compatability of drivers across OS versions. The advantages of this are quite obvious. I also understand Linus and others are dead set against this sort of thing.

      However, at the risk of sounding incredibly naive, would it be possible to create a Linux module that presents a forward compatible API/ABI that other modules could be coded against? An abstraction layer, if you will. Thus, on upgrading the kernel, the only thing that would require a recompile (and possibly a rework) would be this uber-module. NVidia drivers, etc would be coded against this module's API/ABI and thus they themselves wouldn't require rework/recompilation.

      Now there are probably good reasons why this can't be done, but I thought I'd throw it out here and watch it be shot down.

    5. Re:Linux 2.6... by tunabomber · · Score: 5, Interesting
      Thanks to the fact that the NVIDIA drivers use a portable core anyway, they seem to be having no problem keeping up with the kernel.

      That's interesting. I'm sure I'm not the first person to come up with this idea, but I wonder how easy it would be to create a compatibility layer between the kernel and the modules that accepts a common binary format for the entire life of a kernel release (or maybe all kernel releases?).

      Then you'd only have to port the layer to the newer kernel revision, and all the old binary drivers would work right away.


      If it could be done, it would be a cool hack in league with that module that allows you to run windows drivers (most notably the NTFS driver) in the Linux kernel. IIRC, the performance of this arrangement sucked, but I wouldn't expect it would be as much of a problem with an abstraction layer for Linux binaries since the difference between a Windows DLL and a kernel module is much bigger than the difference between a 2.4.16 kernel module and a 2.4.24 kernel module.

      --

      pi = 3.141592653589793helpimtrappedinauniversefactory71 ...
    6. Re:Linux 2.6... by rsmith-mac · · Score: 3, Insightful

      This may be true, and Nvidia may even have a rather handy work-around for the issue, but things like portable cores are just that: a work-around. As it stands right now, very few companies offically offer much Linux support, and we're not just talking 3D graphics here. NICs, sound cards, SCSI cards, and just about every other piece of hardware out there has large swaths of products that are incompatible with Linux, and binary-driver issues have a lot to do with it.

      Hardware companies love Linux, and they want to support Linux, but they also have limits to how far they're willing to go; many are not willing to sink resources in to creating drivers that either are difficult to install, or involve exposing their valuable IP. If companies could just have a way to write a binary Linux driver that will "just work," and work for most people, just like it does with Windows and OS X, then that provides a big carrot to them to provide the driver and get the sales. The lack of a binary option makes things more costly to them and more difficult for them, and that deminishs the value of a sale.

      Ultimately, the lack of a binary driver interface scares away users and companies alike, and if Linux wants to do better than a niche, and do better than Windows, then it needs to be friendly to everyone, not just the OSS crowd. Some day, Linus is going to have to make a descision between ultimately limiting Linux to the hobbyist, or letting it truely grow to become a popular, de-facto OS; and it's binary drivers that are going to help make the difference.

    7. Re:Linux 2.6... by foonf · · Score: 3, Insightful

      We need companies to write device drivers, since the complexity of something like an nVidia GeForce GPU is simply too much for a small team of people to reverse engineer.

      You have created a false binary opposition here. From reading this one would assume that the only alternatives were a reverse-engineered driver written by hobbyists, or a proprietary binary-only driver from the vendor. They are both bad choices, and the vast majority of kernel drivers are built on neither model. They are written as free software either by the manufacturer, or by outside developers based on specifications provided by the manufacturer. A driver from nvidia is only "necessary" because for 5 years they have refused to release any kind of meaningful specifications to driver developers, and they can't really release the source to their own driver because they don't own most of it.

      This is actually a step backwards from the historic pattern of support for graphics cards under Linux. Since the first accelerated X11 server for S3 chipsets from 1992 or so most manufacturers were willing either to release specifications, or actually commision outside developers to write open-source drivers for their hardware. When almost all major video chipset makers (with the exception of nvidia) supported Precision Insight's work developing the DRI infrastructure, there was actually a short time where a large fraction of common video hardware was completely supported, out of the box, including accelerated 3D, by a typical Linux distribution. This was BETTER than the typical support pattern for Windows; no need to mess around with downloading drivers or loading them off of vendor CDs, if the distribution had a properly configured kernel you just installed it and it worked. Unfortunately most of the cards with working DRI drivers are basically obsolete now, aside from some low-end ATI Radeon models. This is how hardware should work in Linux, and for some things like ethernet cards and SCSI adapters it basically does.

      The problem is that ATI and nvidia do not understand how to properly support free operating systems, and until they do this "problem" is going to persist. Developers are willing to sign NDAs to gain access to these specifications, and if hardware companies would agree to this there would be no need to port their own precious code at all, much less put up with constant whining to open-source it.

      --

      "(Man) tries to live his own life as if he were telling a story. But you have to choose: live or tell." --Sartre
    8. Re:Linux 2.6... by catenos · · Score: 3, Insightful

      if linux want's to go mainstream and come out of the server room linus will have to compromise.

      "If Linux wants" again. Linux doesn't want anything than being useful to those who want to run Linux (see Linus' interviews...). The (grand-)parent poster was right: If you want to run Linux, there is usually no problem to find hardware that is supported without the need for proprietary drivers (the exceptions being GFX cards and hardware niche uses).

      Yes, it's a problem if you want to migrate your existing hardware. But that hardware will stay usable only for so long. After that, if you really do want to run Linux, you know to check the hardware compatibility before you buy the replacement.

      --
      Keep an eye on which arguments are silently dropped in replies. Not always, but often times it's very telling.
  9. Re:Upgrade now? by Anonymous Coward · · Score: 4, Interesting

    The parent is not a troll. I've had a lot of problems with the 2.6 kernel CRASHING upon bootup. Unfortunately, the kernel panic message is too long and not enough of the error message is left on the screen is useful enough to figure out where the problem occurred. The problem usually goes away when I go back through menuconfig and turn off all drivers that I know I won't be using. I'm not sure why 2.6 is much more finnicky about configging it than 2.4.x, was it the low latency modifications? Running the kernel with pre-emptive threads? I don't know. Also, 2.6 SCREWS with the way some drivers behave, namely /dev/psaux (which now, unhelpfully, mixes not only PS/2 mouse events with events from, say, a WACOM tablet) and the USB event subsystem which now ennumerates non-USB devices. Good luck getting XFree86 to access your input devices propertly on 2.6!

  10. This may be impolitic, but... by InterruptDescriptorT · · Score: 5, Insightful

    One of the good things about Microsoft Windows is that is you've written a driver for Windows 98's to the WDM standard, it's still pretty much supported under Windows 2000 and Windows XP. That is to say that there isn't a lot of retrofitting that needs to be done to get a legacy driver working under the latest Microsoft OS.

    Linux, on the other hand, seems to think it's OK to make developers retrofit their code when they don't like the ad hoc design that the OS contributors came up with. This coupled with issues (questions?) of compatibility with things like the GNU C runtime libraries really must make it frustrating to do any serious development on Linux. (Feel free to rebut--it's been a long time since I've been active in Linux development.)

    Still, I think it's a testament to Microsoft that an .EXE can run under Windows 95, 98, 2K and XP and most of the time, it's just going to work. You can't say the same about versions of Linux.

    --
    Karma: Excellent Birds (mostly as a result of listening to Laurie Anderson)
    1. Re:This may be impolitic, but... by Monkelectric · · Score: 4, Informative

      Ummm WTF are you talking about? The Win32s are FILLED with functions that only work on a specific platforms or are buggy on ceartin platforms making them unreliable. Its only plain vanilla applications that work on any platform -- and you'll find alot of code in there that says if(WINDOWS_VERSION == 98) {} elif (WINDOWS_VERSION == 2000) -- thats not really cross platform compatibility.

      --

      Religion is a gateway psychosis. -- Dave Foley

    2. Re:This may be impolitic, but... by The+One+KEA · · Score: 5, Informative

      Sorry, but what you envision is never going to pass. Linus has repeatedly stated that he will not permit the modification of the Linux kernel source in order to cater to the maintainers of binary-only modules. If they refuse to *PL their code, then they must shoulder the burden of maintainership until such time that they do decide to *PL it.

      It would be nice if the code allowed this, but since it doesn't, all we can do is carefully research the support and drivers that do exist and are available for the latest and greatest hardware, before we buy them.

      --
      SCREW THE ADS! http://adblock.mozdev.org/ Proud user of teh Fox of Fire - Registered Linux User #289618
    3. Re:This may be impolitic, but... by scotch · · Score: 5, Interesting
      Still, I think it's a testament to Microsoft that an .EXE can run under Windows 95, 98, 2K and XP and most of the time, it's just going to work.

      If the .exe is statically linked perhaps, otherwise, you're going to have all kinds of library problems when moving the sam app between win 95, win 98, win 2k, and win XP. Keep in mind for earlier OSes in the chain, apps frequently shipped with their own shared libraries causing other apps or even the whole system to break.

      I'm not sure about device drivers for Windows, but I would be suprised if there weren't problems with using win 95/98 device drivers with win XP.

      Not to say that updading linux is painfree, I just think you're overstating the case for microsoft products. C library upgrades aren't a big deal, most distros contain compatibility libraries for older versions. There were some serious issues with libc upgrades, but that was years ago. It's really a non-issue in my development experience. Other libraries cause more headaches than libc.

      Attn Mods: How a post that intends to comment on the strain imposed on developers for linux kernel and libc upgrades and also says this "it's been a long time since I've been active in Linux development" can get modded up to +5 informative is beyond me. Insightful or perhaps inciteful, but not informative.

      --
      XML causes global warming.
    4. Re:This may be impolitic, but... by x_man · · Score: 4, Interesting

      Having done driver development for both Windows and Linux, each OS has their plus's and minus's:

      Windows good:
      With some effort, my USB networking driver is binary compatible with Win98 through WinXP. This is really awesome because I don't have to spend a lot of time re-writing and re-compiling drivers. For the customer, it just works.

      Windows bad:
      Writing drivers for Windows is like working on your car with the hood welded shut with only a 12-inch diameter hole cut into the top. Driver writing is EXTREMELY complex on Windows. MS tries to hide everything from you with convoluted callbacks and opaque data structures. My first USB networking driver took me two months just to get a basic skeleton running. On Linux, the same driver took me two weeks to completely finish and I'd never written a driver for Linux before.

      Linux good:
      Driver writing is soooo much easier and intuitive (at least for the 2.2/2.4 kernels). One .c file pretty much does it all

      Linux bad:
      Having to recompile for every kernel just bites. I understand and agree with Linus's reasoning for encouraging open source driver development. Alas, the company I work for doesn't.

      So overall, I'd say the Linux driver model is superior for developers but ease of use is what drives mass-adoption of a product. I guess it just depends on your target audience. Our Linux user base, while vocal, is insignficant compared to Windows and even Mac so guess which driver I spend most of my time working on?

      X

    5. Re:This may be impolitic, but... by pe1rxq · · Score: 4, Insightful

      And we would have to suffer our mistakes for eternity to come....
      The reason the API changes is because of improvements, not some secret desire to make live hard on other people....

      Jeroen

      --
      Secure messaging: http://quickmsg.vreeken.net/
    6. Re:This may be impolitic, but... by The+Vulture · · Score: 3, Informative

      Yes, Linus is against binary-only modules. He also states that he will not put a mechanism in place to make it easier for programmers of binary-only modules.

      But, the kernel is released under the GPL, he can't stop you from writing an ABI that allows you to do this. So, while he doesn't want do the work for you, he gives you the freedom to do it if you wish. I don't see how he's inconsistent with the principles of free software. He just doesn't want to do it, nor does he have to.

      If jane_hacker can't roll her own kernel, that's not Linus' problem. He gives you the kernel, what you want or are able to do with it is your problem, not his.

      Maybe if you offered Linus (or somebody else with the skills) some money to write code that creates a standard ABI to make binary-only modules work, some work would be done on it.

      As a final note, Linus started the kernel, it's only fair that he should be in control. If you don't like his level of control, then the GPL gives you the freedom to fork off the code and do with it as you will, as long as you release the source to the changes.

      -- Joe

    7. Re:This may be impolitic, but... by finkployd · · Score: 4, Funny

      Hence one of the main reasons Linux will never be more than a hobbyist OS.

      Congratulations on your recovery from what must have been a four or five year coma. Please feel free to check out some tech news sites to see what has been happening in the computer industry these last few years.

      Finkployd

  11. Re:3rd party modules: kernel tainted by glitch! · · Score: 4, Informative

    The "tainted" message just means that the module does not claim to be GPL. As a practical matter, you can just ignore the "tainted" message. If you are concerned about whether modules are GPL or not, then you may find the message useful.

    --
    A dingo ate my sig...
  12. I've always wondered.... by Anonymous Coward · · Score: 4, Interesting

    Would it be possible to have some sort of cross-platform driver language like Java for device divers? That would be really cool because each platform could have its own VM and the same driver would run on Windows, Linux (all kernels), Mac, etc.

    1. Re:I've always wondered.... by roboros · · Score: 5, Informative

      The problem is not the language but the interface to the kernel. The C language, which a lot of drivers are written in, is very portable but you still cannot easily take a driver from Windows XP and port it to Linux, because the driver has to provide and call different functions in Windows vs Linux. What would be required is a standardized API for device drivers but that is (IMHO) not likely to happen soon. There are some however some interesting wrappers for using Windows WLAN drivers under Linux, maybe it would be possible to extend that to other kinds of drivers.

  13. Help! 2.6.2 is huge by Wills · · Score: 4, Interesting
    Wow, this is a tough one. I'd like to port some 2.4.x drivers to 2.6.2 but I have to use a boot floppy for portable devices without a HD or bootROM and the kernel is so HUGE it literally won't fit onto a boot floppy and LILO doesn't seem to work with high-capacity floppies (fdformat /dev/fd0u1760, but LILO fails at the LILO prompt with "40 40 40 ..."):

    ls -l arch/i386/boot/bzImage

    1472687 arch/i386/boot/bzImage

    I've kept my kernel config to the absolute minimum and made everything as modular as possible. On 2.4.24 the bzImage was only 1056223 bytes, now it's jumped by 400kBytes.

    Has anyone any useful tips for cutting the "bloat"?

    1. Re:Help! 2.6.2 is huge by The+One+KEA · · Score: 4, Informative

      Start with the CONFIG_EMBEDDED option - it allows you to excise a significant amnount of stuff from the kernel image that would otherwise remain unused. If you want more savings, there is a tinykernel tree somewhere that has patches which allows you to remove even more stuff. IIRC the kernels built from this tree can comfortably run with as little as 4MB of RAM.

      --
      SCREW THE ADS! http://adblock.mozdev.org/ Proud user of teh Fox of Fire - Registered Linux User #289618
  14. You people are all hypocrites by ZuperDee · · Score: 5, Insightful

    Yeah, call me a troll if you wish, but I really do think it is amazing how so many people here are willing to beg and plead on their knees that the Linux kernel developers freeze the driver API so that closed, proprietary-source hardware companies can write closed-source drivers for their favorite wardware device.

    So then, let's take it a step further: would you people also be willing to put up with a totally closed-source kernel, and a closed-source C compiler, if the hardware manufacturers demanded it? In that case, why not just use Windows?

    Seriously, I fail to understand why you people want to use Linux, only to complain about the lack of hardware support, since the Linux world requires everything to be open source.

    Tell me, would you people also be willing to jump off a bridge to get driver support if the hardware manufacturers demanded it?

    I do believe Linux (or GNU Linux, if you prefer), as a platform (not just the kernel), would not be as open as it is today if the developers didn't insist on such openness. If you people don't care how open things are, then why bother with Linux?

    1. Re:You people are all hypocrites by Anonymous Coward · · Score: 5, Insightful

      Unstable driver API hurts everyone, not only hardware manufacturers, and helps nobody.

      If a HW company considers Linux support, they will have to decide in terms of money earned vs money spent. If supporting Linux means supporting every kernel version out there + distribution-specific patches, their costs will be high. High costs - no Linux driver :):)

      I know they could release it as GPL, but that is _their_ decisions. OSS & Free Software is not about forcing others to open-source their work (even if their decision sucks ;) but to give people a choice. And that is what it all boils down to. If there were a stable API, those _evil_ HW manufacturers could simply release their drivers as binary only and _we'd_ have a choice of tainting our kernel or not. The _good_ ones will work with Linux developers regardless of stable API or no stable API

      Right now both ATI and NVIDIA use ugly hacks to get past the lack of stable API. And we still use binary-only code for the drivers, it is just not in the kernel. I understand that Linus is very .. protective ... of his work, teh kernel, and doesnat much care about the user-space, but to those using ATI or NVIDIA drivers and being happy about it: would you rather compile a generic piece of ugly hacks and add a binary-only driver or simply install a binary driver. The latter is a whole lot easier and the end result is _exactly_ the same in terms of stability, security and freedom.

      I'd also like to mention that the lack of stable driver API also hurts OSS developers and users. Not every patch (read driver) gets accepted into the mainstream kernel from where it goes to distros. And not everyone knows how to patch, compile and install. And you know what - they shouldn't need to, if Linux is a serious desktop player. They _should_ have a _choice_ to do all that if they wanted to...

      Enough of ranting, off to bed :)

    2. Re:You people are all hypocrites by Dwonis · · Score: 4, Insightful
      Unstable driver API hurts everyone, not only hardware manufacturers, and helps nobody.

      It gives an advantage to hardware manufacturers who use open interfaces to the hardware they ship.

  15. Tell me by ZuperDee · · Score: 3, Interesting

    Would you people also be willing to put up with a closed-source Linux kernel, if some CPU manufacturer decided tomorrow that they didn't want to release the specs for their instruction set, and said the only way you could write a kernel would be if you submitted to an NDA? Why is it that things like Wireless Network drivers or video drivers are the ONLY thing subject to this kind of thing?

  16. Re:whats the benefit? by Anonymous Coward · · Score: 4, Funny

    I suspect about 1 in a 1000 people who read /. really understand what the article is talking about

    Who cares, that's the usual percentage of posters, who read the articles at all. Can't answer the rest of your reply - lost interest somewhere in the middle of it. I wanted to give you my 2 cents, but discovered that I'm a bit short on money today, sorry.

  17. Re:Ok expert super genius elite! by Michael+Iatrou · · Score: 3, Informative

    No need to do so, check this out: HowTo Upgrade To The 2.6 Kernel And you are not idiots, you just don't RTFM...

  18. Re:That's one of Linux' main weaknesses by pe1rxq · · Score: 3, Informative

    The only thing that is difficult is that you have to keep up with the development of the kernel itself.
    As for complicated... having had a look at some windows drivers source code and writting my own linux drivers I can say that it is way easier to write a linux driver than a windows driver. (Even if you have to port it to a new major kernel release every few years)

    Jeroen

    --
    Secure messaging: http://quickmsg.vreeken.net/
  19. Re:whats the benefit? by Anonymous Coward · · Score: 5, Funny

    Man, I miss the days when people who were interested in technology read Slashdot....

  20. Sun E3500 by SHEENmaster · · Score: 4, Funny

    It's like an altair, but with 8 independent 64-bit processors, 32M total L2 cache, 4G total ram, and 8 independent fibre-channel hard drives.

    I use a Linux X terminal as a client, but the principal is the same as on an altair.

    /me shudders at the though of coding with dip switches.

    --
    You can't judge a book by the way it wears its hair.
    1. Re:Sun E3500 by Anonymous Coward · · Score: 5, Funny

      dip switches!? LUXURY.

      I had to re-solder every connection, using my tongue as a wet sponge.

  21. Re:Upgrade now? by Kourino · · Score: 4, Informative

    If you're having problems with input devices, search the LKML archives for Vojtech Pavlik's 2.6 input FAQ (he's the maintainer of the kernel's input system). You can find a list of searchable archives at the LKML home/FAQ page.

    Err, I'm feeling generous, here: 2.6 input drivers FAQ ^_^;

    You may be confusing the "USB event subsystem" (of which I'm really not sure you're talking about) with the generic input system.

  22. Easy Migration by Voivod · · Score: 5, Interesting

    I just had to port a kernel module I wrote for my employer a year or so ago. Told my boss it'd probably take a week. Instead it took me 15 minutes. I grabbed a Makefile from an example, compiled, noticed that the return type for interrupt handlers had changed, fixed that, done. Thanks to the kernel developers out there for making it so easy!

  23. LWN also has an excellent series on driver porting by theonlyholle · · Score: 5, Informative

    Linux Weekly News also has a great series on driver porting at http://lwn.net/Articles/driver-porting/. It's in the subscription-free area, so go there and have a look at it.

  24. Re:Why the license macro? by Second_Derivative · · Score: 5, Informative

    Common situation before 2.4:

    1) User loads proprietary module
    2) Kernel goes unstable and crashes like hell
    3) User responsibly decides to post OOPS and bug report to LKML
    4) Kernel devs groan for the 1000th time and explain that they can't test a problem with an opaque driver

    The problem is that a black box piece of code is 'tainting' the kernel. If something goes wrong with that code, you're SOL because you can't look inside the black box. Module licensing forces a closed driver to identify itself as such, and then notes that the kernel is tainted in the OOPS, so if you submit an oops like that then the kernel devs will (quite rightly) say "Don't expect us to fix a problem with a proprietary driver, bug the guy who wrote it".

    It's mostly a bug tracking thing for the kernel developers in other words, it doesn't really change how the kernel behaves or what you are or aren't allowed to do with it.

  25. Re:Why the license macro? by pe1rxq · · Score: 5, Informative

    Some kernel developers (me included) don't like the idea of making functions in the kernel available for use by closed source drivers. This way the module loader prevents certain modules from using certain functions.
    But the most important is bug reports. If you load a non open module your kernel gets 'tainted' and this is reported in oopses. If you then send this oops to one of the kernel maintainers they can just ignore you. Since you have a piece of unknown code in use in your system they can't do anything usefull anyway.

    Jeroen

    --
    Secure messaging: http://quickmsg.vreeken.net/
  26. Re:I don't understand by chgros · · Score: 3, Informative

    Is anyone able to point me to a module that broke between 2.4 and 2.6 that wasn't fixed with a three line patch?
    OpenAFS.
    The reason I'm still using 2.4 :-(

  27. Binary drivers are inevitable by calica · · Score: 4, Interesting

    It is just a matter of how well we support it. Currently, nothing. The result, we end up using windows drivers. Examples are ndis and ntfs.sys. This trend will continue.

    An alternative, come up with a standard API for each device type (video, ethernet, scsi, etc) Then create a wrapper between the internal API and the spec. Internal API changes, port the wrapper. If we can do it with windows drivers we should be able to come up with something more efficient and less hackish.

    Original API aged poorly? Design a new one and implement the wrapper as another driver. Both can coexist.

    I see no reason Linus would have a problem with this from a tech perspective. It's just another driver. GPL drivers could avoid the wrapper and would remain prefered.

    Parallel implementation with a BSD would avoid most of the licensing issues.

  28. Re:whats the benefit? by orthogonal · · Score: 5, Informative
    the article is just a bit too techie for me.. so whats [sic] the catch with this new stuff?
    will it help some more device manufacturers make "drivers" for linux?


    New device driver format. Is it good or is it whack?

    Basically, the article is explaining that by following certain conventions in the driver code, you allow the kernel a standardized way to load and use the driver.

    In other words, if you're going to make third-party Legos, make sure the nubbins on the blocks are the same size and wit the same spacing as the nubbins on Legos, if you want everything to fit together.

    The author of the article then inserts a plug for his company's software:
    If you are not using an integrated development environment such as TimeSys' TimeStorm that is capable of detecting kernel versions and automatically creating Makefiles that "do the right thing" for the 2.6 kernel, you will need to manually create Makefiles for your device drivers that are integrated into the kernel build process.


    He also explains that in cleaning up driver building for 2.6, somebody forgot that not everybody has write access to a copy of the kernel source, which 2.6 driver building -- whoops -- requires. This is simpler to get around, so long as you've got room for your own writable copy of the kernel source. This will prove annoying for people who build drivers by compiling them on certain *cough* Zaurus *cough* embedded devices (rather than cross-compiling) and who use something like cramfs.

    The article then spends a few paragraphs on where the real compatibility problems will be: 2.6 is lot different than 2.4 in a lot of internal processes, so if your driver made assumptions about any of that -- instead of being itself written in a layered way -- you're going to be making a lot of changes.

    (Ideally, you should write the driver so that one layer handles communication with linux, one layer handles communication with hardware, and one layer sits between the other two to "translate" and maintain state; this also makes porting the driver -- whether to 2.6 or another operating system altogether, -- far cheaper and easier. Programmer laziness, management short-sightness, or pre-mature optimization may however have driven you to write a monolithic driver.)

    Will this help more manufacturers make drivers for linux? Not really. If manufacturers cared about making linux drivers, they'd have already done it for 2.4. If they didn't care to do it for 2.4, they won't care to do it for 2.6.

    If you really want more manufacturers to make drivers, you have to do the following: get the phone number for investor relations at the company. Call up and ask them how much market share they've lost by not offering linux drivers, and explain that you're worried about the company's long-term prospects if it continues to ignore this growing market. explain that as a result you're going to be reducing you exposure in the company's stock in favor of their competitors who do offer linux drivers.

    (Since most companies are now run by managers whose compensation is based on short-term stock movement, and not long tern company growth, the companies hare increasingly deaf to the needs of customers, but alert to stock speculators and their stock price. Therefore I now recommend calling Investor Relations rather than Customer Relations if you wish to change a company's policies.)
  29. Re:Why the license macro? by orthogonal · · Score: 5, Insightful

    Some kernel developers (me included) don't like the idea of making functions in the kernel available for use by closed source drivers. This way the module loader prevents certain modules from using certain functions.

    I feel like getting flamed and losing some karma. It's the day after Valentine's anyway, so it's not like I was expecting to be happy anyway.

    Why prevent closed source drivers from using certain kernel functions?

    Sure, I realize it makes a political point to closed source developers: "your code will remain second-class code until you show us the source", but like a SPEWS blacklist, it does that by annoying innocent third parties in the hopes of getting the third parties to join you in your complaints.

    In this case the innocent third parties are the people running linux. So linux users get punished by linux developers for "consorting" with the "enemy's" closed source drivers. Ironically, at the same time, linux is promoted as the OS that allows the user full control over his computer.

    If you really believe in the user's right to run his PC as he wishes, let him decide whether or not to buy closed-source hardware.

    If you don't, then say so: "I'm giving you the benefit of my code, and I'm not charging for it, but it's not really free, as I expect you to adopt my ideology to use it, and to let me dictate to some degree how you use your PC." That's a valid and defensible stance -- but it's a different stance than is usually professed.

    And admit that it's a barrier to wider-spread adoption of linux, and factor it in when asked why more people are not using linux.

  30. Re:Why the license macro? by orthogonal · · Score: 3, Funny

    > Why prevent closed source drivers from using certain kernel functions?

    It prevents the kernel maintainers from wasting their time trying to debug a problem that may be caused by a module for which they have no source and no hope of fixing.


    Next week on Saturday Night Live:

    LINUX USER JIMMY (Played by Horatio Sanz): "I want to use the Yoyodyne USB Blender on my linux box, so I can make margaritas over dial-up SSH!"

    KERNEL DEVELOPER (played by Chris Parnell): "If we let the blender driver call kernel_foobar(), it might work flawlessly."

    LINUX USER JIMMY: "OK great! Linux r0x0r5!"

    KERNEL DEVELOPER (dourly) "But... it some cases, it might fail."

    LINUX USER JIMMY: "But it'll usually work? I can't wait to taste those margaritas!"

    KERNEL DEVELOPER: "No, Jimmy" (shakes head and sighs) "it will never work, because we don't allow the Yoyodyne driver to call kernel_foobar()." (pause) "It might fail, and we can't allow that to happen. (nods authoritatively, looking Jimmy in the eyes) You understand."

    LINUX USER JIMMY: "So I can't make my margaritas if I use linux?"

    KERNEL DEVELOPER: "No, Jimmy, you can't. Because we kernel developers know better."

  31. This is DRM! by QuantumG · · Score: 3, Interesting
    The insmod man page says:

    Some kernel developers require that symbols exported by their code must only be used by modules with a GPL compatible license. These symbols are exported by EXPORT_SYMBOL_GPL instead of the normal EXPORT_SYMBOL. GPL-only symbols exported by the kernel and by other modules are only visible to modules with a GPL-compatible license, these symbols appear in /proc/ksyms with a prefix of 'GPLONLY_'. insmod ignores the GPLONLY_ prefix on symbols while loading a GPL licensed module so the module just refers to the normal symbol name, without the prefix. GPL only symbols are not made available to modules without a GPL compatible license, this includes modules with no license at all.

    Who the hell wrote that? Why was the patch accepted? What part of "I'm in control of my own computer" was too confusing for this guy to understand? Just to make it absolutely perfectly clear, when I say 'insmod foo.o' I expect foo.o to be loaded into the kernel. The only reason why it shouldn't is if there is a dependancy that would make it not work (but I expect to be able to insmod -f throught that). I do not want my kernel checking the license of foo.o and determining whether or not I am allowed to insert the module.

    Even if you make the claim that you have the right to refuse someone who doesn't GPL their module to link to your module, that has absolutely nothing to do with me. It's a matter between you and the guy who isn't GPLing his module. Me, as a user, are free to link any two pieces of software together that I like. You have absolutely no legal claim to stop me. It's my computer. I thought this all was pretty obvious and it was only the stupid corporations that think they can control our lives who write software to stop me doing what I want to do with my computer, now I'm finding linux kernel developers are doing the same.

    If you want to set a "tainted" flag, if you want to show me a warning, that's just fine, go right ahead, but don't ever stop me from doing what I want with my computer. Now I'm going off to hack my kernel to remove this insanity. Who knows, I might post a patch on the kernel mailing list.

    --
    How we know is more important than what we know.
  32. For an up-to-date kernel book... by salimma · · Score: 4, Informative

    you can read Robert M. Love's Linux Kernel Development , authored by the person who brought us kernel pre-emption, and is now working at Ximian/SuSE on kernel-desktop integration. Can you say Utopia ?

    --
    Michel
    Fedora Project Contribut
  33. Let the market handle it... by Kjella · · Score: 4, Interesting

    Let's say, e.g. Munich or IBM or whatnot finds it's time to make a purchase. Requirements: Linux compatible.

    Once you can attribute a significant number of "Lost sales" to "Lack of Linux compatibility", PHBs will demand that it happens. They couldn't care less about the hobbyist, but if large corporations starts running Linux desktops, as is very likely for basic office tasks, they sure as hell care. And so every peripheral used by corporations, which bleed over pretty damn well into consumer peripherals, then consumers starts demanding the same...

    And then the engineers will go "Gah, this binary API is changing *all* the time. Can't we simply release a GPL driver and be done with it?" And then, after a little talk with legal, and probably the PHB again, hopefully it'll happen. Not to mention they can take the GPL code of any similar driver, and copy-paste (with appropriate copyright headers and all, of course) into their own.

    All Linus has to do is to stay strong on this matter - once Linux is past a reasonably critical mass, I suspect it won't really be much of an issue. The strongholds will be where there is no real alternative, mostly GPUs. But it might also be that Linux is hardly used much by heavy gamers - so they don't see much lost sales at all yet.

    I suspect that it will go the other way. Most drivers will become open, and a few will remain closed. Perhaps in the end, if and when Linux is popular enough, they will simply close the kernel to any binary modules, and whichever has the "weaker" OSS drivers would face lost sales. I sure think it's easier to hit companies where it hurts (in their wallet) than getting Linus to change his ideological viewpoint. We're just not there yet.

    Kjella

    --
    Live today, because you never know what tomorrow brings
  34. Will 2.6.x improve life for driver devs? by soldack · · Score: 4, Informative

    I would love see linux really catch up to Windows here. Having worked on Windows and Linux drivers I can honestly say that for me, Windows device driver development is much easier. I am comparing writing Windows 2000/XP device drivers with Linux 2.4.x device drivers. Most that I have worked on are networking, storage, or low level bus drivers.

    The driver APIs in windows appear to be more stable and documented better. The backwords compatiblity that MS allows in their driver model is great. For example, each time a new feature was added, it was always possible to use the old style for a few revisions. For example, when power managment and plug and play were added in Win2k, MS made sure you could still make a driver without the new calls and things would work. Even their wrapper models for networking (NDIS miniport) and storage (SCSI miniport) easily allow backworks compatibility. NDIS is nicely designed with versioning in the structures so that NDIS can know what version of the API the driver supports and handle it correctly.

    The documentation in the DDK help is has improved greatly since the dark NT4 days. MS worked hard to audit the DDK docs and work with the developer community to improve them. These days their isn't much you will find in a header that doesn't have a nice page in the DDK help.

    At each Windows Hardware Engineering Conference and also at the new Driver Developer Conferences they go way out of their way to make life easy for driver developers. On the source front, they provide source for sample drivers of almost every kind...even for some currently shipping internals.

    The debugger is great. From a GUI or command linux, I can reload drivers over my debugger connection (serial or 1394) on a live system. I can connect to my debugger over TCP and remotely debug it. I can do almost everything I can do in a normal application debugger.

    I can get kernel dumps of various types from full memory to 64 kb minidumps. Full memory dumps allow crashes to be totally debugged...much of the guess work is removed when you can see everything that was on the system at the time of death.

    They also have great test tools built in. Between Driver Verifier and the Hardware Compatiblity Tests, a massive number of issues can be caught before the driver even gets to system testing.

    In the linux world, I have to live with weak kernel debuggers and lack of true memory dumps. In real low level driver for a DMA device, in many cases you don't get the nice happy survivable oops...you get the "I need a damn camera and small console font to capture what stack made it out" oops. Every linux 2.4 device driver book should come with a digital camera for debugging! I heard that 2.6 adds some sort of memory dump...a dump to disk would make post-mortems so much easier. Any one know more about this?

    Add to that the constant changes that instantly make documentation outdated and force driver develepers to rewrite with only the new source as their guide. The kernel rev issue is not just a GPL it and recompile...the APIs change and the meanings of status codes change, etc.
    Each kernel revision my company supports requires significant work on our end. Even if it was as simple as a recompile and test, the rate of kernels released makes it difficult for developers and system test groups to keep up. It takes a lot to test high end drivers. Weeks can go into a system test plan for a specific revision of the driver with a specific revision of the kernel only to see a newer kernel suddenly become the "new new" thing.

    On the test tools front, the world is fragmented with some companies having some certification testing but no true driver certification tests. I would love to see a 2.6 storage driver tester and a 2.6 networking driver tester. Is there anything happening on this front?

    --
    -- soldack
    1. Re:Will 2.6.x improve life for driver devs? by soldack · · Score: 3, Informative

      For windows driver development, try http://www.osronline.com/ and click on "The Online DDK". Look under Kernel-Mode Driver Architecture, then under Design Guide, then under Servicing Interrupts. You can also order the DDK from http://www.microsoft.com/whdc/ddk/winddk.mspx . The Windows 2003 appears to be just the cost of shipping.

      There are lots of ways to get info back from an interrupt. The simple "standard" way is for the caller to use an IOCTL interface in the driver and then wait on an event. On the Interrupt, disable the device's interrupts and queue a DPC. In the DPC, drain the device queue, signal the event the user call is waiting on and reactivate interrupts on the device.

      There are other ways but this is the first one that occurs to me. Have fun!

      --
      -- soldack