Building an Out-of-Tree Module Against a Built Kernel
You do not have to put your code inside the kernel source tree to build it. You can keep it in its own directory and point the kernel's build system at it, so it compiles against a kernel you already built. That keeps your work separate from the kernel's millions of lines and makes it easy to version on its own. Build against the wrong kernel and the resulting module will refuse to load.
Questions this Concept answers
- Why must an out-of-tree module be built against the same kernel build it will be loaded into?
Building External Modules
Your module does not have to live inside the kernel source tree. This page shows how to keep it in its own directory and point the kernel's build system at it with a single make command, and how to w…