2 id: instrumenting-out-of-tree-linux-kernel
5 Instrumenting a custom Linux kernel module for LTTng follows the exact
7 [adding instrumentation to the Linux kernel itself](#doc-instrumenting-linux-kernel-itself),
8 the only difference being that your mainline tracepoint definition
9 header doesn't reside in the mainline source tree, but in your
10 kernel module source tree.
12 The only reference to this mainline header is in the LTTng custom
13 probe's source code (`probes/lttng-probe-hello.c` in our example), for
14 build time verification:
19 /* Build time verification of mismatch between mainline TRACE_EVENT()
20 * arguments and LTTng adaptation layer LTTNG_TRACEPOINT_EVENT() arguments.
22 #include <trace/events/hello.h>
27 The preferred, flexible way to include your module's mainline
28 tracepoint definition header is to put it in a specific directory
29 relative to your module's root, e.g., `tracepoints`, and include it
30 relative to your module's root directory in the LTTng custom probe's
34 #include <tracepoints/hello.h>
37 You may then build LTTng-modules by adding your module's root
38 directory as an include path to the extra C flags:
41 make <strong>ccflags-y=-I/path/to/kernel/module</strong> KERNELDIR=/path/to/custom/linux
44 Using `ccflags-y` allows you to move your kernel module to another
45 directory and rebuild the LTTng-modules project with no change to