This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

a little help beginning (kernel module)


Hi.

I have never really programmed in C or using makefiles before.

Maybe I should say Makefiles ;-).

It seems to me most Linux projects I have ever seen place object files in the same directories as source files. To me that is rather ugly.

Also I am trying to compile a simple kernel module and unless I am specifying explicitly this line form the tutorial:

make -C /lib/modules/$(shell uname -r)/build  M=$(PWD) modules

Then it is impossible to compile anything because you run into a million (header file inclusion) errors that seem completely unsolvable.

Apparently that build directory contains all the information (I thought it would be an output directory).

But now just one input file:

module.c

Produces in the same output directory 6 other files:

module.ko
module.mod.c
module.mod.o
module.o
modules.order
Module.symvers

That would be okay if it was a dedicated output directory.

So how can I put my source files in ./src, my output in ./build, and so on?

Make
src/module.c
dest/module.ko
dest/module.mod.c
dest/module.mod.o
dest/module.o
dest/modules.order
dest/Module.symvers

Or something of the kind?

Any tutorials that might be helpful?

The makefile references the source via "obj-m += module.o"

Sure I would love specifying output files like that, but I don't know how to say where they have to go or where the source files are.

Regards.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]