LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices



Reply
 
Search this Thread
Old 05-08-2009, 12:12 PM   #1
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Rep: Reputation: 23
how to identify "Unknown Symbol"


I'm totally new to kernel programming, and I'm trying to write a driver for an unsupported usb webcam.

I understand that this error:
insmod: error inserting './usbgetinfo.ko': -1 Unknown symbol in module

Indicates an attempt to access a variable or function not exported by the kernel. Is there a way to figure out which variable or function that is?
 
Old 05-08-2009, 01:32 PM   #2
mesiol
Member
 
Registered: Nov 2008
Location: Lower Saxony, Germany
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731

Rep: Reputation: 137Reputation: 137
Hye

do an
Code:
strace insmod usbgetinfo
, this will trace you what's going on while loading the driver.
 
Old 05-08-2009, 01:55 PM   #3
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Original Poster
Rep: Reputation: 23
So the offending function was actually posted by dmesg, as I eventually realized after I put the module into /lib/modules to use modprobe.

Problem is, it's two functions (usb_register and usb_deregister) which are extern'd in KERNELSRC/include/linux/usb/usb.h, but actually defined in KERNELSRC/drivers/usb/core/driver.c. Which for some reason is not included by usb.h, and can't be included by me.

Other in tree drivers seem to get away with just normative includes, but who knows what rules apply to them...
 
Old 05-08-2009, 03:37 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mk27 View Post
Other in tree drivers seem to get away with just normative includes, but who knows what rules apply to them...
You might have to add
Code:
MODULE_LICENSE("GPL");
to your driver. They kernel devs implemented a DRM scheme whereby certain symbols are only available if you advertise a GPL license in your driver.
 
Old 05-08-2009, 04:03 PM   #5
mk27
Member
 
Registered: Sep 2008
Distribution: fedora, gentoo, ubuntu
Posts: 148

Original Poster
Rep: Reputation: 23
Quote:
Originally Posted by David1357 View Post
You might have to add
Code:
MODULE_LICENSE("GPL");
to your driver. They kernel devs implemented a DRM scheme whereby certain symbols are only available if you advertise a GPL license in your driver.
Hey wow, you actually got it. What clued me in was noticing that dmesg had explained the error ;( And stupid me for not paying attention...BUT (paltry defense) only the first time I tried to load it did I get "module license 'unspecified' taints kernel" in dmesg, and of course I didn't read dmesg! (like I said, real new to this kernel stuff) -- which is to say, I tried a few times before finally checking, chopping sections (it's only 65 lines)out and looking at objdump thinking that would help, so by the time I gathered the brains to examine /var/log/messages I didn't notice the taint warning 30 lines up.

Fortunately this is not quite the first module I've written and I eventually looked up, so that rang bells. But I'm becoming increasing afraid of this task I'm fainting already...

Thanks for your astuteness. Great sig! Can I steal it?

Last edited by mk27; 05-08-2009 at 04:08 PM.
 
Old 05-11-2009, 11:29 AM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by mk27 View Post
But I'm becoming increasing afraid of this task I'm fainting already...
Don't faint now! Writing kernel drivers is a lot easier than it used to be!

Quote:
Originally Posted by mk27 View Post
Thanks for your astuteness. Great sig! Can I steal it?
My "astuteness" comes from occasionally reading the LKML. There were some interesting posts a couple of years ago related the the problem you had. And of course, they don't make it easy for you by printing anything useful from "insmod". Like you said, you have to dig through "dmesg" and "/var/log/messages" and figure out what it means to have your kernel tainted.

As far as the sig goes, steal away. The more people who wake up and realize that you can't draw meaningful conclusions from a single story, the better off our society will be.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read "identify" button press event, or state of "identify" blue led with IPMI? iav Linux - Server 0 01-27-2009 02:13 PM
ipv6 errors - "Unknown symbol?" slackhack Debian 2 02-01-2008 03:42 PM
Loading modules in Gentoo results in "Unknown symbol module_refcount" Spooled Linux - General 4 05-22-2006 06:48 AM
fedora fglrx-"Unknown symbol capable" arrruken Linux - Hardware 1 03-31-2004 01:17 AM
Sound in kernel 2.6: Lots of "Unknown Symbol" errors jemenake Linux - General 0 10-22-2003 10:09 PM


All times are GMT -5. The time now is 07:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration