Unknown symbol usb_register_driver

Jeff Haran jharan at bytemobile.com
Mon Aug 29 16:56:20 EDT 2011


> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-
> bounces at kernelnewbies.org] On Behalf Of Greg KH
> Sent: Monday, August 29, 2011 12:33 PM
> To: Prajosh Premdas
> Cc: kernelnewbies at kernelnewbies.org
> Subject: Re: Unknown symbol usb_register_driver
> 
> On Tue, Aug 30, 2011 at 12:45:11AM +0530, Prajosh Premdas wrote:
> > Hi
> >
> > I am using Linux-2.6.31-14 based on Ubuntu karmic. I am developing
> > a proprietary usb driver and was doing my study .
> 
> The Linux USB subsystem does not allow non-GPL kernel drivers, sorry.
> 
> greg k-h

Prajosh,

In other words, your efforts to write a non-GPL USB module are stymied by the following in the kernel sources:

EXPORT_SYMBOL_GPL(usb_register_driver);
EXPORT_SYMBOL_GPL(usb_deregister);

So you go through the same rigmarole that everybody else does when they run into this and can't talk their management into GPL'ing the actual source for the module you are writing.

You write a little stub module that is GPL that contains two functions that take the same parameters as usb_register_driver() and usb_deregister(). These functions do nothing but call usb_register_driver() and usb_deregister() and return what they return, but you export them with EXPORT_SYMBOL() instead of EXPORT_SYMBOL_GPL(). Your company releases the little stub module under GPL and your private code calls the new functions it exports.

You should try to talk your management into GPL'ing the real code and paying you for the time it's going to take you to try to get it accepted into the kernel sources. You can try to argue the benefits to your company of doing so and there are many. It gets reviewed by people who might understand the rest of the system better than you do. If kernel interfaces that your module depends upon change in the future, your module gets updated by the people making the changes; no surprises when you update kernel versions to find the kern_foo() function you've been calling disappears. If a kernel containing your module BUG()s or panic()s, you can submit stack traces without the dreaded "tainted" in them that will cause all of the kernel maintainers to ignore you.

But in the world of IP (that's Intellectual Property not Internet Protocol), doing things like "giving code away" is often frowned upon by management particularly when it hides the interface to some ASIC or other piece of hardware that your company wants to keep a secret, so you will very likely not be successful in convincing them to GPL the actual sources and this stupid little hack will allow you to work around this.

Jeff Haran






More information about the Kernelnewbies mailing list