Compile external module against linux source and use functionality in linux source
Hi I am trying to two things here. 1. Compile my module and export a function. 2. Use this exported function in modified kernel src and compile it. Step 1 goes through fine. The module gets compiled fine. However now when i try to compile the kernel i get linker error of undefined reference to the function exported from the kernel module. I can't find any documentation on this usecase. Thanks Arjun
On Thu, 2014-09-25 at 10:49 +0530, Arjun Pandey wrote:
However now when i try to compile the kernel i get linker error of undefined reference to the function exported from the kernel module.
I'm guessing you're compiling that module as, well, a module (ie, CONFIG_EXAMPLE=m). What happens when you make it built-in (CONFIG_EXAMPLE=y)? Paul Bolle
No i am just compiling the external module and using this functionality in existing linux source code. I am not adding any additional modules within the tree which use this function. In my case i am trying to use the function directly in udp_rcv function of net/ipv4/udp.c Regards Arjun On Thu, Sep 25, 2014 at 12:06 PM, Paul Bolle <pebolle@tiscali.nl> wrote:
On Thu, 2014-09-25 at 10:49 +0530, Arjun Pandey wrote:
However now when i try to compile the kernel i get linker error of undefined reference to the function exported from the kernel module.
I'm guessing you're compiling that module as, well, a module (ie, CONFIG_EXAMPLE=m). What happens when you make it built-in (CONFIG_EXAMPLE=y)?
Paul Bolle
[Manually corrected top-posting.] On Thu, 2014-09-25 at 12:11 +0530, Arjun Pandey wrote:
On Thu, Sep 25, 2014 at 12:06 PM, Paul Bolle <pebolle@tiscali.nl> wrote:
I'm guessing you're compiling that module as, well, a module (ie, CONFIG_EXAMPLE=m). What happens when you make it built-in (CONFIG_EXAMPLE=y)?
No i am just compiling the external module and using this functionality in existing linux source code. I am not adding any additional modules within the tree which use this function.
So, does the linker error disappear when you build your kernel with your new module built-in (ie, the new module is part of the kernel image)?
In my case i am trying to use the function directly in udp_rcv function of net/ipv4/udp.c
Paul Bolle
On Thu, 25 Sep 2014 10:49:33 +0530, Arjun Pandey said:
Step 1 goes through fine. The module gets compiled fine. However now when i try to compile the kernel i get linker error of undefined reference to the function exported from the kernel module.
I can't find any documentation on this usecase.
In general, things that are built-into the kernel with CONFIG_FOO=y are *not* allowed or able to reference symbols that are in a module. This is because a module can potentially not be loaded (consider system boot before you're up far enough to do a modprobe, as an important special case), at which point trying to call the non-existent module gets you an oops or panic. So you can't find any doc on it because it's not supported.
Hi Valdis That makes sense :) Moving the module to the kernel makes it work. Thanks Arjun On Thu, Sep 25, 2014 at 5:57 PM, <Valdis.Kletnieks@vt.edu> wrote:
On Thu, 25 Sep 2014 10:49:33 +0530, Arjun Pandey said:
Step 1 goes through fine. The module gets compiled fine. However now when i try to compile the kernel i get linker error of undefined reference to the function exported from the kernel module.
I can't find any documentation on this usecase.
In general, things that are built-into the kernel with CONFIG_FOO=y are *not* allowed or able to reference symbols that are in a module.
This is because a module can potentially not be loaded (consider system boot before you're up far enough to do a modprobe, as an important special case), at which point trying to call the non-existent module gets you an oops or panic.
So you can't find any doc on it because it's not supported.
participants (3)
-
Arjun Pandey -
Paul Bolle -
Valdis.Kletnieks@vt.edu