Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build kernel module without full kernel source tree?

I would like to build a kernel module without the kernel source tree. For that, I specified the kernel header directory only.

This reference link tell me it should be workable :
build kernel module w/o source tree

But some other reference links tell me I should build my kernel module with full kernel source tree!

My questions are :

  1. Shall I build kernel module link with full kernel source tree ?
  2. Is it necessary to do a full build under kernel source tree before build my single module ?
like image 352
summerdog Avatar asked Sep 17 '25 05:09

summerdog


1 Answers

  1. Not it's not necessary. You need a header files that contains function and types declarations. You also kernel tree with Makefiles and Kconfig but without sources. This kernel tree is needed by kbuild - kernel building system.

  2. Absolutely not. You can build a single module without building whole kernel regardless of it's out-of-tree or in-tree module.

like image 78
Alexander Dzyoba Avatar answered Sep 19 '25 02:09

Alexander Dzyoba