7

I have a exported functions foo() and foo1() from a.ko (a kernel module), foo1() takes input parameter, a function pointer. I invoke foo1() from b.ko, and pass foo() as the input parameter.

I see a insmod failure for b.ko (unknown symbol foo ), even though a.ko has been insmoded before b.ko.

Any explanations/solutions ?

Thanks, Lucky

2

1 Answer 1

6

There are two ways to solve this, 1) Compile both the kernel modules in the same Makefile i.e. objs-m := a.o b.o. 2) Include **KBUILD_EXTRA_SYMBOLS=<"absolute path to the Module.symvers of the kernel module which is exporting function or variable"> in the Makefile of the kernel module which will use exported function or variable.

Sign up to request clarification or add additional context in comments.

2 Comments

What is the format for the KBUILD_EXTRA_SYMBOLS line? Make is telling me "mixed implicit and normal rules: deprecated syntax"
@jeremiah, KBUILD_EXTRA_SYMBOLS is a make variable and I guess there is no format as such. GNU make throwing "mixed implicit and normal rules: deprecated syntax" is because of the usage of newer GNU make version (4.0). Try using GNU make version (3.8.1) to compile the module. Go through the link blog.melski.net/2015/01/12/whats-new-in-gnu-make-4-1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.