LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-07-2005, 11:50 PM   #1
Elric of Grans
Member
 
Registered: May 2005
Posts: 46

Rep: Reputation: 15
Trouble Compiling Kernel Module...


G'Day,

I am experiencing a strange problem with recompiling an external kernel module. I last compiled a month ago, and in that time the module source, kernel version and (crosscompiler) toolchain all remain unchanged: all that has changed is that I have upgraded to Ubuntu Breezy (hence all other utilities have been updated). Because all of the aspects which should directly impact this are unchanged, I am at a loss to explain why it no longer works.

My problem is this: when I compile my module, everything starts as normal, and it compiles, like so...

Code:
$ make
make -C /usr/src/linux/ M=/home/matthew/src/c/modules/omap-owire-dev modules
make[1]: Entering directory `/usr/src/arm-linux-2.6.13-rc4'
  CC [M]  /home/matthew/src/c/modules/omap-owire-dev/omap_owire.o
  Building modules, stage 2.
  MODPOST
make[1]: Leaving directory `/usr/src/arm-linux-2.6.13-rc4'
This is where it ends: for some reason it does not perform the linking process, and as such the omap_owire.ko file is never created; omap_owire.o, .omap_owire.o.cmd, and .tmp_versions/omap_owire.mod are all created.

I am able to recompile the kernel itself without any difficulties, as I can with regular applications, so I cannot explain this one. Any suggestions would be most appreciated!
 
Old 11-10-2005, 04:59 PM   #2
Elric of Grans
Member
 
Registered: May 2005
Posts: 46

Original Poster
Rep: Reputation: 15
I still have not been able to get this to work (according the kernel documentation, the Makefile is correct, so I have no idea why it does not), so I have been trying to compile it without the Makefile. This is what I have got so far:
Code:
$ make -C /usr/src/linux M=/home/matthew/src/c/modules/omap-owire-dev modules
omap-owire.o is created, along with .omap_owire.o.cmd and .tmp_versions/omap_owire.mod.
Code:
$ cd /usr/src/linux
$ ./scripts/mod/modpost -i Module.symvers vmlinux /home/matthew/src/c/modules/omap-owire-dev/omap_owire.o
omap_owire.mod.c is now created.
Code:
$ arm-linux-gcc -Wp,-MD,/home/matthew/src/c/modules/omap-owire-dev/omap_owire.mod.d -nostdinc \
-isystem/usr/local/arm/4.0.1/bin/../lib/gcc/arm-linux/4.0.1/include -D__KERNEL__ -Iinclude -DMODULE  -c -o \
/home/matthew/src/c/modules/omap-owire-dev/omap_owire.mod.o /home/matthew/src/c/modules/omap-owire-dev/omap_owire.mod.c
I now also have omap_owire.mod.o and omap_owire.mod.d. From here, it should be simple to finish (or so I thought).
Code:
$ arm-linux-gcc -r -o omap_owire.ko omap_owire.o omap_owire.mod.o
/usr/local/arm/4.0.1/bin/../lib/gcc/arm-linux/4.0.1/../../../../arm-linux/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
If I look in lib/, I can see libgcc_s.so -> libgcc_s.so.1, and if I try to compile anything else and explicitly add -lgcc_s to the arguments, it all works fine. I have tried all sorts of things (eg -Ldirectory), but cannot seem to get rid of this last error. I also cannot explain why I have the original problem, but that is another issue. Any suggestions for either problem would be greatly appreciated!
 
Old 05-31-2006, 12:57 AM   #3
exman
LQ Newbie
 
Registered: May 2006
Location: Germany, BS
Distribution: Debian Kernel 2.6.15, Kubuntu Dapper
Posts: 24

Rep: Reputation: 15
Hi,
i don't know if you are still having this problem but i ran into the same while porting a driver from Kernel 2.4 to 2.6.
You have to add a line like this in the makefile:
Code:
obj-m:=omap_owire.o
This tells the kbuild process compile and link your module.
exman
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Compiling Linux Module damonkohler Linux - Software 9 03-05-2006 01:52 PM
Compiling kernel...whats a module? TheDude05 Linux - Newbie 2 01-18-2005 09:29 PM
Compiling a module/Kernel mismatch fbarre Linux - Newbie 2 09-04-2003 08:26 PM
compiling a kernel module for a different target akaBeaVis Linux - Software 10 06-09-2003 12:47 AM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:12 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
Open Source Consulting | Domain Registration