views:

71

answers:

1

How can I compile multiple files (files calling functions in other files) in kernel module?

+1  A: 

I'm interpreting your question to mean, you want to link multiple compilation units together into one module?

There's plenty of examples of this in the kernel source code itself; the general gist of it is to write Makefile like

obj-$(CONFIG_FOO) += foo.o
foo-objs: bar.o

This will link foo.o and bar.o together for foo.ko if CONFIG_FOO=m. See The Linux Kernel Module Programming Guide # Modules Spanning Multiple Files for a more detailed explanation.

ephemient