0
votes

I recently created a new header file that I want to include in the Linux kernel. I put the .h file in usr/src/linux/include/linux. I put the .c file in usr/src/linux/lib. I updated the Makefile in the lib directory and recompiled the kernel, without error. However, when I tried to use the functions in the header file, I got an error saying that the functions were not defined. I assumed (wrongly) that the kernel would know which c file the header was for. How do I properly set this up?

1
What's about extern?.. - Ilya Matveychikov
How did you try to use the functions? In a C file that is part of your kernel? - Mircea
Yes. I included the header I added and tried to call the function inside a kernel c file that I added a few weeks back. - Gregory-Turtle

1 Answers

0
votes

Where you try to use the functions?

If tried your function within the kernel (external module). You need to add EXPORT_SYMBOL(); to the module where your function is defined.

Otherwise (from user-space) it is a different (and more complicated).