LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   linking .o files built in user space against kernel module using kbuild (http://www.linuxquestions.org/questions/linux-newbie-8/linking-o-files-built-in-user-space-against-kernel-module-using-kbuild-694396/)

santigopal_mondal 01-02-2009 03:10 AM

linking .o files built in user space against kernel module using kbuild
 
Hi All,

I have a relocatable obj file built in user space which does not depennd on any kernel symbols.

I want to build a kernel module which needs to call the APIs defined in the .o file(user-space). I am able to link it with warning ".filename.o.cmd" missing.

Now when I want to insmod the .ko file, it gives the following message.
overflow in relocattion type 10 val ffffffff8835fc10
"module" likely not compiled with -mcmodel=kernel



Waiting for your replies.Thanks a lot.

paulsm4 01-03-2009 03:42 PM

Hi -

1. It doesn't, of course, matter where you build your module.

2. It matters very much, however, that a kernel module be specially built *as* a kernel module. Here is a link on compiling kernel modules:
http://www.faqs.org/docs/kernel/x204.html

3. It's also essential that you *not* call user-space runtime library functions (like "printf()") from a kernel module.


All times are GMT -5. The time now is 09:31 PM.