Linux Kernel: How are loadable modules dependent on Linux kernel source?
-
When we compile an external module we have to specify the path of the built kernel in which we want to insert the module. So what all things exactly does the loadable modules looks for in the built kernel ?
-
Answer:
The LKM is an object file not an executable which means that the functions/symbols are not relocated yet. So, why is this happening? Because we dont have the idea of a shared library in the linux kernel. So if a LKM wants to make use of a function say "X" which is part of the linux kernel, then the symbol needs to be exported using EXPORT_SYMBOL macro which adds the function to the kernel symbol table. The previous step is done in the linux kernel code not in the custom LKM. The module loader fixes the relocation and if it encounters a symbol that is not part of the kernel but part of another known LKM, it loads that LKM first, this is what the modprobe does . Also, if you want to verify what all functions/symbols are exported by the linux kernel from user space, you can view the /proc/kallsyms! To answer your question short, symbols exported by the linux kernel "acts" as shared library for the LKM so that you can reuse the code! These relocations are fixed by the LKM loader which is part of the kernel!
Sebas Sujeen at Quora Visit the source
Related Q & A:
- How to boot linux kernel without bootloader?Best solution by Super User
- How to get the timestamp of linux kernel?Best solution by Stack Overflow
- How to stop broadcast service in Linux?Best solution by Super User
- How to artificially cause a page fault in linux kernel?Best solution by Stack Overflow
- How can I install MSN on Linux?Best solution by addictivetips.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.