Results 1 to 2 of 2
Hi,
I'm trying to compile 2 external kernel-modules and want to use, in my second module, some symbols exported by the first module. Unfortunately, it doesn't work, but I can't ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-28-2009 #1Just Joined!
- Join Date
- Sep 2009
- Posts
- 2
Pb when compiling an external module that uses symbols from another module
Hi,
I'm trying to compile 2 external kernel-modules and want to use, in my second module, some symbols exported by the first module. Unfortunately, it doesn't work, but I can't figure out why ?
Here is what I'm doing in details and the error (a little bit long but simple
):
For module mod1.ko, , composed by one c-file mod1.c, I use such Makefile:
This module exports two symbols:Code:ifdef KERNELRELEASE EXTRA_CFLAGS += -Wall -Werror -I$(PWD)/../common obj-m := mod1.o else all: $(MAKE) ARCH=arm CROSS_COMPILE=arm-linux- -C $(KERNEL_BUILD_DIR) M=$(PWD) V=1 modules endif
=> this module compiles and works fine.Code:EXPORT_SYMBOL(foo); EXPORT_SYMBOL(bar);
Now I want to build my second module in another directory, which use foo() and bar().
I'm using a Makefile, similar to the previous one, except that it is composed by several c-file Thus, I use:All files compile fine, but modpost claims that:Code:obj-m := mod2.o mod2-objs := file1.c file.c ...
And of course, when I 'insmod mod2.ko', it does work and claim that:...
scripts/mod/modpost -m -i /my_kernel_dir/Module.symvers -I /my_module_dir/src/driver/Module.symvers -o /my_module_dir/src/driver/Module.symvers -S -w -c -s
WARNING: "foo" [/my_module_dir/src/driver/mod2.ko] undefined!
WARNING: "bar" [/my_module_dir/src/driver/mod2.ko] undefined!
...
even if mod1 is inserted.$ insmod mod2.ko
mod2: no symbol version for foo
mod2: Unknown symbol foo
mod2: no symbol version for bar
mod2: Unknown symbol bar
But if I 'grep foo /proc/kallsyms', I see my symbol:
What am I missing ? How do I tell my driver, that these symbols have to be searched in module mod1 ?$ grep foo /proc/kallsyms
bf0007e9 r __kstrtab_foo [mod1]
bf00087c r __ksymtab_foo [mod1]
bf0008e4 r __kcrctab_foo [mod1]
bf00014c T foo [mod1]
1e4dbb64 a __crc_foo [mod1]
(Note: I'm using kernel 2.6.27)
P.
- 09-28-2009 #2Just Joined!
- Join Date
- Sep 2009
- Posts
- 2
And the answer is in the Documention directory of the kernel source tree (I missed this one), in file .../Documentation/kbuild/modules.txt , section 7.2-7.3.
P.


Reply With Quote
