To build the LTTng modules as builtins in a kernel image, simply run
the "built-in.sh" script with the path to you kernel source directory
as an argument. Then configure your kernel build and add the "CONFIG_LTTNG"
option. Build as usual and voila!
This is an early implementation with a single configuration option that
enables or disables everything, We could add fine grained config options
for each modules or group of modules.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
--- /dev/null
+config LTTNG
+ tristate "LTTng support"
+ depends on TRACEPOINTS
+ help
+ LTTng is an open source tracing framework for Linux.
+
+ See https://lttng.org/
+
+ To compile as a module, choose M here.
+
+ If unsure, say N.
sudo depmod -a kernel_version
+### Kernel built-in support
+
+It is also possible to build these modules as part of a kernel image. Simply
+run the [`built-in.sh`](built-in.sh) script with the path to your kernel
+source directory as an argument. It will symlink the lttng-modules directory
+in the kernel sources and add an include in the kernel Makefile.
+
+Then configure your kernel as usual and enable the `CONFIG_LTTNG` option.
+
+
### Required kernel config options
Make sure your target kernel has the following config options enabled:
number and name
-Using
+Usage
-----
Use [LTTng-tools](https://lttng.org/download) to control the tracer.
--- /dev/null
+#!/bin/bash
+
+set -e
+
+usage() {
+ echo "usage: $0 <kernel source tree>" >&2
+ exit 1
+}
+
+[ "$#" -eq 1 ] || usage
+KERNEL_DIR="$(readlink --canonicalize-existing "$1")"
+
+# Symlink the lttng-modules directory in the kernel source
+ln -sf "$(pwd)" "${KERNEL_DIR}/lttng"
+
+# Graft ourself to the kernel build system
+echo 'source "lttng/Kconfig"' >> "${KERNEL_DIR}/Kconfig"
+sed -i 's#+= kernel/#+= kernel/ lttng/#' "${KERNEL_DIR}/Makefile"
+
+echo >&2
+echo " $0: done." >&2
+echo " $0: now you can build the kernel with LTTng support." >&2
+echo " $0: make sure you enable it (CONFIG_LTTNG) before building." >&2
+echo >&2