Commit | Line | Data |
---|---|---|
f59ec0be | 1 | #!/bin/bash |
b7cdc182 | 2 | # SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only) |
f59ec0be MJ |
3 | |
4 | set -e | |
5 | ||
6 | usage() { | |
7 | echo "usage: $0 <kernel source tree>" >&2 | |
8 | exit 1 | |
9 | } | |
10 | ||
11 | [ "$#" -eq 1 ] || usage | |
12 | KERNEL_DIR="$(readlink --canonicalize-existing "$1")" | |
13 | ||
14 | # Symlink the lttng-modules directory in the kernel source | |
15 | ln -sf "$(pwd)" "${KERNEL_DIR}/lttng" | |
16 | ||
17 | # Graft ourself to the kernel build system | |
25fd0688 | 18 | echo 'source "lttng/src/Kconfig"' >> "${KERNEL_DIR}/Kconfig" |
78d67057 MJ |
19 | |
20 | # In kernel v6.1, subdirectories were moved to Kbuild | |
21 | if grep -qE '^obj-y[[:space:]]+\+= kernel/' "${KERNEL_DIR}/Kbuild"; then | |
22 | echo 'obj-y += lttng/' >> "${KERNEL_DIR}/Kbuild" | |
23 | else | |
24 | sed -i 's#+= kernel/#+= kernel/ lttng/#' "${KERNEL_DIR}/Makefile" | |
25 | fi | |
f59ec0be MJ |
26 | |
27 | echo >&2 | |
28 | echo " $0: done." >&2 | |
29 | echo " $0: now you can build the kernel with LTTng support." >&2 | |
30 | echo " $0: make sure you enable it (CONFIG_LTTNG) before building." >&2 | |
31 | echo >&2 |