Remove latin abbreviations
[lttng-docs.git] / contents / using-lttng / instrumenting / instrumenting-linux-kernel / instrumenting-out-of-tree-linux-kernel.md
CommitLineData
5e0cbfb0
PP
1---
2id: instrumenting-out-of-tree-linux-kernel
3---
4
5Instrumenting a custom Linux kernel module for LTTng follows the exact
6same steps as
7[adding instrumentation to the Linux kernel itself](#doc-instrumenting-linux-kernel-itself),
8the only difference being that your mainline tracepoint definition
9header doesn't reside in the mainline source tree, but in your
10kernel module source tree.
11
12The only reference to this mainline header is in the LTTng custom
13probe's source code (`probes/lttng-probe-hello.c` in our example), for
14build time verification:
15
16~~~ c
17/* ... */
18
19/* Build time verification of mismatch between mainline TRACE_EVENT()
20 * arguments and LTTng adaptation layer LTTNG_TRACEPOINT_EVENT() arguments.
21 */
22#include <trace/events/hello.h>
23
24/* ... */
25~~~
26
27The preferred, flexible way to include your module's mainline
28tracepoint definition header is to put it in a specific directory
4d46e8c0 29relative to your module's root (`tracepoints`, for example) and include it
5e0cbfb0
PP
30relative to your module's root directory in the LTTng custom probe's
31source:
32
33~~~ c
34#include <tracepoints/hello.h>
35~~~
36
37You may then build LTTng-modules by adding your module's root
38directory as an include path to the extra C flags:
39
40<pre class="term">
41make <strong>ccflags-y=-I/path/to/kernel/module</strong> KERNELDIR=/path/to/custom/linux
42</pre>
43
44Using `ccflags-y` allows you to move your kernel module to another
45directory and rebuild the LTTng-modules project with no change to
46source files.
This page took 0.023515 seconds and 4 git commands to generate.