1

I was reading Linux Device Driver 3rd edition, in chapter 2 there is one line

"This requirement have been changed from the previous versions of kernel, where current set of header files were sufficient. 2.6 modules are linked against object files found in the kernel source tree; the result is more robust module loader"

If kernel headers are enough to compile the loadable kernel module. Why do we need to build the kernel? Why it actually needs the object files?

What is this robustness ?

Robust module loader or module ?

[Edit] what happened before 2.6?

[Edit] Do we have object files in kernel shipped with distros?

jatinBatra
  • 41
  • 4
  • because compiling and linking are different steps. – stark Feb 02 '22 at 19:18
  • 2
    *"kernel headers are enough to compile the loadable kernel module"* - YES, but by "kernel headers" the author doesn't mean just the `.h` files. Secondly, a lot of `.h` files are generated at compile time when building the kernel... so even if that was the case, you would still need to build the kernel to have those header files. – Marco Bonelli Feb 02 '22 at 19:43
  • 1
    Does this answer your question? [How can I prepare a Linux source tree so an external module can be compiled against it?](https://stackoverflow.com/questions/70707519/how-can-i-prepare-a-linux-source-tree-so-an-external-module-can-be-compiled-agai) – Marco Bonelli Feb 03 '22 at 00:01
  • @MarcoBonelli. Thanks for quick reply. I've compiled several modules with the distribution's own headers. And if I'm not wron that doesn't have any object files. Those modules worked just fine. – jatinBatra Feb 17 '22 at 16:55
  • Also thanks for the link. I'll definitely use that Target next time I have kernel source. But I still don't get why author said that. My question is do we really need it ? And what used to happen before 2.6 ? – jatinBatra Feb 17 '22 at 16:58

0 Answers0