Adding a new module in the Kernel source
Hi everybody,
I want to compile the last stable version of the Linux Kernel (2.6.15.6) but i want to add my own module in the kernel.
Firstly, is it a good idea to do this? Or it's more simple to add this module after the compilation and add it to the modules which are automicaly laoded?
But, if i want to add this module in the kernel source, what do i have to do for this operation?
Thank you.
PS : sorry for my not fluent english.
Quoted 11 lines · beware
Hi everybody,
I want to compile the last stable version of the Linux Kernel (2.6.15.6) but i want to add my own module in the kernel.
Firstly, is it a good idea to do this? Or it's more simple to add this module after the compilation and add it to the modules which are automicaly laoded?
But, if i want to add this module in the kernel source, what do i have to do for this operation?
To include the module in kernel sources is simple. Let's assume it is a char driver and the module is named beware.
1) copy source to drivers/char
cp beware.c $KERNEL_SRC_DIR/drivers/char/
2) Edit makefile to include your module:
Just above the clean-files statement add:
obj-y += beware.o
And you are ready to compile the kernel with your module built-in.
May I also refer you to Linux Device Drivers volume 3 (LDD3) and to Documentation/kbuild/* in the kernel source.
Sam