Re: Adding a new module in the Kernel source

From: Sam Ravnborg
Date: Thu Mar 16 2006 - 10:32:46 EST


On Thu, Mar 16, 2006 at 12:29:19PM +0100, beware wrote:
> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/