Re: [kbuild-devel] kbuild support to build one module with multiple separate components?

From: sam
Date: Mon Jul 19 2004 - 10:29:53 EST

On Wed, Jul 14, 2004 at 02:40:44PM -0700, Song Wang wrote:
> Hi, Sam
> Thanks for the reply.
> However, in the way you indicate, the
> mainmodule and each submodule will be built
> as separate kernel modules. You will get
> mainmodule.ko, a_sub_module.ko, b_sub_module.ko etc.
> This is not what I tried to get. I tried to
> build a single kernel module, which means that
> mainmodule.o, a_sub_module.o, b_sub_module.o
> should be linked together to produce the single
> module.


This is even simpler:


EXTRA_CFLAGS := -I $(obj)/include

module-y := file.o dir/file.o
obj-m := module.o

And then code your C files as usual.
Assumig you have a directory named include.
Include header files like this:
#include "header.h"

So you end up having:


And you use:
make -C kernelsrcdir M=$PWD
to compile your module.

If this does not solve your issue please say so.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at