| 1 | #!/bin/bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | usage() { |
| 6 | echo "usage: $0 <kernel source tree>" >&2 |
| 7 | exit 1 |
| 8 | } |
| 9 | |
| 10 | [ "$#" -eq 1 ] || usage |
| 11 | KERNEL_DIR="$(readlink --canonicalize-existing "$1")" |
| 12 | |
| 13 | # Symlink the lttng-modules directory in the kernel source |
| 14 | ln -sf "$(pwd)" "${KERNEL_DIR}/lttng" |
| 15 | |
| 16 | # Graft ourself to the kernel build system |
| 17 | echo 'source "lttng/Kconfig"' >> "${KERNEL_DIR}/Kconfig" |
| 18 | sed -i 's#+= kernel/#+= kernel/ lttng/#' "${KERNEL_DIR}/Makefile" |
| 19 | |
| 20 | echo >&2 |
| 21 | echo " $0: done." >&2 |
| 22 | echo " $0: now you can build the kernel with LTTng support." >&2 |
| 23 | echo " $0: make sure you enable it (CONFIG_LTTNG) before building." >&2 |
| 24 | echo >&2 |