Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 12-25-2012, 02:53 AM   #1
LQ Newbie
Registered: Feb 2012
Posts: 3

Rep: Reputation: Disabled
undefined reference to `__this_module

when I add my PCI driver to the kernel.
I build my driver as module it's ok.but when I want to build it into the shows errors as flow:

drivers/built-in.o(.init.text+0x52c4): undefined reference to `__this_module

what should I do to avoid the error!
Old 12-27-2012, 03:06 PM   #2
Senior Member
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 & 7
Posts: 2,925

Rep: Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785
insmod defines that value during loading. If you build it into the kernel it is not defined because you do not have a "struct module" which it points to.
Old 12-28-2012, 11:37 PM   #3
Deep Narayan Dubey
LQ Newbie
Registered: Dec 2010
Location: Allahabad, India
Posts: 11

Rep: Reputation: 8
Did you change makefile to include your new module as build target? If yes, please give the details of Makefile and directory structure for module.
Old 04-02-2014, 02:40 AM   #4
LQ Newbie
Registered: Feb 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
my colleague has defined "#define MODULE" in the header can build into the kernel correctly when I remove this code,
thanks every one here!


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
undefined reference to `__this_module' when trying to link module to kernel Rostfrei Linux - General 1 04-02-2014 02:43 AM
undefined reference to... dimah Programming 3 12-27-2006 09:57 AM
Undefined reference to: ashlesha Programming 5 11-08-2006 01:07 PM
undefined reference? Sharky01252 Programming 3 11-07-2006 11:36 AM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 03:01 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:10 PM.

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