0

I would like to have all source files in one place, so my goal is building lttng-probe-xxx module outside of lttng-modules directory. I've created simple Makefile but durring compilation and next at when I try to loading modules I got message that "lttng_probe_register" and "lttng_probe_unregister" are undefined (the same durring compilation).

Makefile:

INCLUDES = -I. -I$(LTTNGDIR)/probes -I$(ROOTPWD)/include -I$(KERNELDIR)/include
KBUILD_CFLAGS += -g $(INCLUDES)

all: kernel_modules
obj-m   += lttng-probe-hello.o
PWD     := $(shell pwd)

kernel_modules:
    $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules`

KERNELDIR is exported variable where is src of Linux kernel.

LTTNGDIR is exported variable where is src of lttng-modules.

Is it possible to link these two from lttng-probes.c to my lttng-probe-hello.ko?

EXPORT_SYMBOL_GPL(lttng_probe_register);
EXPORT_SYMBOL_GPL(lttng_probe_unregister);
4

1 回答 1

0

问题是 Makefile 没有从 lttng-modules 中看到 Module.symvers,而只能从 Linux 内核中看到。为了修复它,我使用了 KBUILD_EXTRA_SYMBOLS。

KBUILD_EXTRA_SYMBOLS += "$(LTTNGDIR)/Module.symvers"
于 2015-01-15T14:21:26.973 回答