Reputation: 91
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 :
Upvotes: 4
Views: 8790
Reputation: 3267
No to both questions. You're talking about out-of-tree (or "external") modules.
Here is a tutorial of Building External Modules.
And here is a simple sample of a Makefile.
obj-m += your-module.o
KDIR=/lib/modules/`uname -r`/build
default:
$(MAKE) -C $(KDIR) M=$(PWD) modules
Upvotes: -1
Reputation: 4189
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.
Absolutely not. You can build a single module without building whole kernel regardless of it's out-of-tree or in-tree module.
Upvotes: 3