+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
# Work-around for distro-specific public modules ABI breakages.
# Some distributions break the public module instrumentation ABI
# compared to upstream stable kernels without providing other mean than
# the kernel EXTRAVERSION to figure it out. Translate this information
# into a define visible from the C preprocessor.
-DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-debian-version.sh $(CURDIR))
+DEB_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-debian-version.sh $(CURDIR))
ifneq ($(DEB_API_VERSION), 0)
ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
endif
-RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-rhel-version.sh $(CURDIR))
+RHEL_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-rhel-version.sh $(CURDIR))
ifneq ($(RHEL_API_VERSION), 0)
ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
endif
-SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-sle-version.sh $(CURDIR))
+SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-sle-version.sh $(CURDIR))
ifneq ($(SLE_API_VERSION), 0)
ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
endif
-FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-fedora-version.sh $(CURDIR))
+FEDORA_REVISION_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/abi-fedora-version.sh $(CURDIR))
ifneq ($(FEDORA_REVISION_VERSION), 0)
ccflags-y += -DFEDORA_REVISION_VERSION=$(FEDORA_REVISION_VERSION)
endif
-RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR))
+RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/rt-patch-version.sh $(CURDIR))
ifneq ($(RT_PATCH_VERSION), 0)
ccflags-y += -DRT_PATCH_VERSION=$(RT_PATCH_VERSION)
endif
-EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
+EXTRA_VERSION_NAME:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-name.sh $(TOP_LTTNG_MODULES_DIR))
ifneq ($(EXTRA_VERSION_NAME), 0)
ccflags-y += -DLTTNG_EXTRA_VERSION_NAME='"$(EXTRA_VERSION_NAME)"'
endif
-EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
+EXTRA_VERSION_GIT:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-git.sh $(TOP_LTTNG_MODULES_DIR))
ifneq ($(EXTRA_VERSION_GIT), 0)
ccflags-y += -DLTTNG_EXTRA_VERSION_GIT='"$(EXTRA_VERSION_GIT)"'
endif
-EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
+EXTRA_VERSION_PATCHES:=$(shell $(TOP_LTTNG_MODULES_DIR)/scripts/extra-version-patches.sh $(TOP_LTTNG_MODULES_DIR))
# Starting with kernel 4.12, the ftrace header was moved to private headers
# and as such is not available when building against distro headers instead
### 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.
+run the [`scripts/built-in.sh`](scripts/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.
+++ /dev/null
-#!/bin/sh
-
-# First argument is the path to the kernel headers.
-KPATH="$1"
-
-if [ ! -f "${KPATH}/include/generated/package.h" ]; then
- echo 0
- exit 0
-fi
-
-# Debian snippet courtesy of Ben Hutchings
-
-# Assuming KPATH is the target kernel headers directory
-DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian (.*)"/\1/p' "${KPATH}/include/generated/package.h")
-
-# Ignore backports part
-DEB_PACKAGE_VERSION=$(echo "${DEB_PACKAGE_VERSION}" | sed -r 's/~(bpo|deb).*//')
-
-# ckt (Canonical Kernel Team) kernels were used for a while during the jessie
-# cycle, their versionning is a bit different. They track the upstream vanilla
-# stable updates but they don't update the minor version number and instead add
-# an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
-# switched back to upstream style at 3.16.36.
-
-# Get -ckt update number, if present
-KERNEL_CKT_UPDATE=$(echo "${DEB_PACKAGE_VERSION}" | sed -rn 's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')
-test -n "${KERNEL_CKT_UPDATE}" || KERNEL_CKT_UPDATE=0
-
-# Get package revision
-DEB_PACKAGE_REVISION=$(echo "${DEB_PACKAGE_VERSION}" | sed -r 's/.*-([^-]+)$/\1/')
-# Get non-sec update number
-DEB_PACKAGE_REVISION_BASE=$(echo "${DEB_PACKAGE_REVISION}" | sed -r 's/^([0-9]+).*/\1/')
-# Get security update number, if present
-DEB_PACKAGE_REVISION_SECURITY=$(echo "${DEB_PACKAGE_REVISION}" | sed -rn 's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
-test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
-# Combine all update numbers into one
-DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 10000 + DEB_PACKAGE_REVISION_BASE * 100 + DEB_PACKAGE_REVISION_SECURITY))
-
-echo ${DEB_API_VERSION}
+++ /dev/null
-#!/bin/sh
-
-# First argument is the path to the kernel headers.
-KPATH="$1"
-
-if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
- echo 0
- exit 0
-fi
-
-# Assuming KPATH is the target kernel headers directory
-UTS_RELEASE=$(sed -rn 's/^#define UTS_RELEASE "(.*)"/\1/p' "${KPATH}/include/generated/utsrelease.h")
-FEDORA_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/.*\.fc\([0-9]*\)\..*/\1/p')
-
-if [ "x${FEDORA_VERSION}" = "x" ]; then
- echo 0
- exit 0
-fi
-
-FEDORA_REVISION_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\-\([0-9]*\).*/\4/p')
-echo "${FEDORA_REVISION_VERSION}"
+++ /dev/null
-#!/bin/sh
-
-# First argument is the path to the kernel headers.
-KPATH="$1"
-
-if [ ! -f "${KPATH}/include/generated/uapi/linux/version.h" ]; then
- echo 0
- exit 0
-fi
-
-# Assuming KPATH is the target kernel headers directory
-RHEL_RELEASE=$(sed -rn 's/^#define RHEL_RELEASE "(.*)"/\1/p' "${KPATH}/include/generated/uapi/linux/version.h")
-
-RHEL_RELEASE_MAJOR=$(echo "${RHEL_RELEASE}" | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\1/')
-RHEL_RELEASE_MINOR=$(echo "${RHEL_RELEASE}" | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\2/')
-RHEL_RELEASE_PATCH=$(echo "${RHEL_RELEASE}" | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\3/')
-
-# Combine all update numbers into one
-RHEL_API_VERSION=$((RHEL_RELEASE_MAJOR * 10000 + RHEL_RELEASE_MINOR * 100 + RHEL_RELEASE_PATCH))
-
-echo ${RHEL_API_VERSION}
+++ /dev/null
-#!/bin/sh
-
-# First argument is the path to the kernel headers.
-KPATH=$1
-
-if [ ! -f "${KPATH}/include/generated/autoconf.h" ]; then
- echo 0
- exit 0
-fi
-
-# Check if we are building against a Suse kernel
-SUSE_KERNEL="$(sed -rn 's/^#define CONFIG_SUSE_KERNEL (.*)/\1/p' "${KPATH}/include/generated/autoconf.h")"
-
-if [ "$SUSE_KERNEL" != "1" ]; then
- echo 0
- exit 0
-fi
-
-
-if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
- echo 0
- exit 0
-fi
-
-SLE_RELEASE="$(sed -rn 's/^#define UTS_RELEASE "(.*)-([0-9\.]+)-(.*)"/\2/p' "${KPATH}/include/generated/utsrelease.h")"
-
-SLE_RELEASE_MAJOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)(.*)$/\1/p')"
-SLE_RELEASE_MINOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)(.*)$/\2/p')"
-SLE_RELEASE_PATCH="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$/\3/p')"
-
-# Minor and patch versions can be omitted
-if [ "x$SLE_RELEASE_MINOR" = "x" ]; then
- SLE_RELEASE_MINOR=0
-fi
-if [ "x$SLE_RELEASE_PATCH" = "x" ]; then
- SLE_RELEASE_PATCH=0
-fi
-
-# Combine all update numbers into one
-SLE_API_VERSION="$((SLE_RELEASE_MAJOR * 10000 + SLE_RELEASE_MINOR * 100 + SLE_RELEASE_PATCH))"
-
-echo ${SLE_API_VERSION}
+++ /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
+++ /dev/null
-#!/bin/sh
-# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
-
-# First argument is the path to the lttng modules sources.
-TOP_LTTNG_MODULES_DIR="$1"
-
-GIT_VERSION="0"
-
-if test -x "$(which git 2>&1;true)" && test -r "${TOP_LTTNG_MODULES_DIR}/.git"; then
- GIT_VERSION_STR="$(cd "${TOP_LTTNG_MODULES_DIR}" && git describe --tags --dirty)"
- GIT_CURRENT_TAG="$(cd "${TOP_LTTNG_MODULES_DIR}" && git describe --tags --exact-match --match="v[0-9]*" HEAD 2> /dev/null)"
-
- GIT_VERSION="${GIT_VERSION_STR}"
-
- if ! echo "${GIT_VERSION_STR}" | grep -- "-dirty" >/dev/null && test "x$GIT_CURRENT_TAG" != "x"; then
- GIT_VERSION="0"
- fi
-fi
-
-echo "${GIT_VERSION}"
+++ /dev/null
-#!/bin/sh
-# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
-
-# First argument is the path to the lttng modules sources.
-TOP_LTTNG_MODULES_DIR="$1"
-
-EXTRA_VERSION_NAME="$(sed -n '1p' "${TOP_LTTNG_MODULES_DIR}/extra_version/name" 2> /dev/null)"
-
-if [ "x${EXTRA_VERSION_NAME}" != "x" ]; then
- echo "${EXTRA_VERSION_NAME}"
-else
- echo "0"
-fi
+++ /dev/null
-#!/bin/sh
-# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
-
-# First argument is the path to the lttng modules sources.
-TOP_LTTNG_MODULES_DIR="$1"
-
-if ! test -d "${TOP_LTTNG_MODULES_DIR}"; then
- exit 1
-fi
-
-TMPFILE="$(mktemp)"
-
-find "${TOP_LTTNG_MODULES_DIR}/extra_version/patches/" -maxdepth 1 ! -name 'README' -type f -printf '%f\n' | sort -r \
- | sed -E 's/[^a-zA-Z0-9 \.]/-/g ; s/(.*)/MODULE_INFO(extra_version_patch, "\1");/g' >"${TMPFILE}" 2>/dev/null
-
-if test ! -f "${TOP_LTTNG_MODULES_DIR}/extra_version/patches.i" || \
- test x"$(cat "${TMPFILE}")" != x"$(cat "${TOP_LTTNG_MODULES_DIR}/extra_version/patches.i")"; then
- mv "${TMPFILE}" "${TOP_LTTNG_MODULES_DIR}/extra_version/patches.i"
-fi
-
-rm -f "${TMPFILE}"
+++ /dev/null
-#!/bin/sh
-
-# First argument is the path to the kernel headers.
-KPATH="$1"
-
-VERSIONFILE=""
-
-if [ -f "${KPATH}/localversion-rt" ]; then
- VERSIONFILE="${KPATH}/localversion-rt"
-
-elif [ -f "${KPATH}/source/localversion-rt" ]; then
- VERSIONFILE="${KPATH}/source/localversion-rt"
-else
- echo 0
- exit 0
-fi
-
-RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")
-
-if [ "x${RT_PATCH_VERSION}" = "x" ]; then
- echo 0
- exit 0
-fi
-
-echo "${RT_PATCH_VERSION}"
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the kernel headers.
+KPATH="$1"
+
+if [ ! -f "${KPATH}/include/generated/package.h" ]; then
+ echo 0
+ exit 0
+fi
+
+# Debian snippet courtesy of Ben Hutchings
+
+# Assuming KPATH is the target kernel headers directory
+DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian (.*)"/\1/p' "${KPATH}/include/generated/package.h")
+
+# Ignore backports part
+DEB_PACKAGE_VERSION=$(echo "${DEB_PACKAGE_VERSION}" | sed -r 's/~(bpo|deb).*//')
+
+# ckt (Canonical Kernel Team) kernels were used for a while during the jessie
+# cycle, their versionning is a bit different. They track the upstream vanilla
+# stable updates but they don't update the minor version number and instead add
+# an additionnal -cktX. They were all 3.16.7-cktX and after a while the version
+# switched back to upstream style at 3.16.36.
+
+# Get -ckt update number, if present
+KERNEL_CKT_UPDATE=$(echo "${DEB_PACKAGE_VERSION}" | sed -rn 's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')
+test -n "${KERNEL_CKT_UPDATE}" || KERNEL_CKT_UPDATE=0
+
+# Get package revision
+DEB_PACKAGE_REVISION=$(echo "${DEB_PACKAGE_VERSION}" | sed -r 's/.*-([^-]+)$/\1/')
+# Get non-sec update number
+DEB_PACKAGE_REVISION_BASE=$(echo "${DEB_PACKAGE_REVISION}" | sed -r 's/^([0-9]+).*/\1/')
+# Get security update number, if present
+DEB_PACKAGE_REVISION_SECURITY=$(echo "${DEB_PACKAGE_REVISION}" | sed -rn 's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
+test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
+# Combine all update numbers into one
+DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 10000 + DEB_PACKAGE_REVISION_BASE * 100 + DEB_PACKAGE_REVISION_SECURITY))
+
+echo ${DEB_API_VERSION}
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the kernel headers.
+KPATH="$1"
+
+if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
+ echo 0
+ exit 0
+fi
+
+# Assuming KPATH is the target kernel headers directory
+UTS_RELEASE=$(sed -rn 's/^#define UTS_RELEASE "(.*)"/\1/p' "${KPATH}/include/generated/utsrelease.h")
+FEDORA_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/.*\.fc\([0-9]*\)\..*/\1/p')
+
+if [ "x${FEDORA_VERSION}" = "x" ]; then
+ echo 0
+ exit 0
+fi
+
+FEDORA_REVISION_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\-\([0-9]*\).*/\4/p')
+echo "${FEDORA_REVISION_VERSION}"
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the kernel headers.
+KPATH="$1"
+
+if [ ! -f "${KPATH}/include/generated/uapi/linux/version.h" ]; then
+ echo 0
+ exit 0
+fi
+
+# Assuming KPATH is the target kernel headers directory
+RHEL_RELEASE=$(sed -rn 's/^#define RHEL_RELEASE "(.*)"/\1/p' "${KPATH}/include/generated/uapi/linux/version.h")
+
+RHEL_RELEASE_MAJOR=$(echo "${RHEL_RELEASE}" | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\1/')
+RHEL_RELEASE_MINOR=$(echo "${RHEL_RELEASE}" | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\2/')
+RHEL_RELEASE_PATCH=$(echo "${RHEL_RELEASE}" | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\3/')
+
+# Combine all update numbers into one
+RHEL_API_VERSION=$((RHEL_RELEASE_MAJOR * 10000 + RHEL_RELEASE_MINOR * 100 + RHEL_RELEASE_PATCH))
+
+echo ${RHEL_API_VERSION}
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the kernel headers.
+KPATH=$1
+
+if [ ! -f "${KPATH}/include/generated/autoconf.h" ]; then
+ echo 0
+ exit 0
+fi
+
+# Check if we are building against a Suse kernel
+SUSE_KERNEL="$(sed -rn 's/^#define CONFIG_SUSE_KERNEL (.*)/\1/p' "${KPATH}/include/generated/autoconf.h")"
+
+if [ "$SUSE_KERNEL" != "1" ]; then
+ echo 0
+ exit 0
+fi
+
+
+if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
+ echo 0
+ exit 0
+fi
+
+SLE_RELEASE="$(sed -rn 's/^#define UTS_RELEASE "(.*)-([0-9\.]+)-(.*)"/\2/p' "${KPATH}/include/generated/utsrelease.h")"
+
+SLE_RELEASE_MAJOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)(.*)$/\1/p')"
+SLE_RELEASE_MINOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)(.*)$/\2/p')"
+SLE_RELEASE_PATCH="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$/\3/p')"
+
+# Minor and patch versions can be omitted
+if [ "x$SLE_RELEASE_MINOR" = "x" ]; then
+ SLE_RELEASE_MINOR=0
+fi
+if [ "x$SLE_RELEASE_PATCH" = "x" ]; then
+ SLE_RELEASE_PATCH=0
+fi
+
+# Combine all update numbers into one
+SLE_API_VERSION="$((SLE_RELEASE_MAJOR * 10000 + SLE_RELEASE_MINOR * 100 + SLE_RELEASE_PATCH))"
+
+echo ${SLE_API_VERSION}
--- /dev/null
+#!/bin/bash
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+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
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the lttng modules sources.
+TOP_LTTNG_MODULES_DIR="$1"
+
+GIT_VERSION="0"
+
+if test -x "$(which git 2>&1;true)" && test -r "${TOP_LTTNG_MODULES_DIR}/.git"; then
+ GIT_VERSION_STR="$(cd "${TOP_LTTNG_MODULES_DIR}" && git describe --tags --dirty)"
+ GIT_CURRENT_TAG="$(cd "${TOP_LTTNG_MODULES_DIR}" && git describe --tags --exact-match --match="v[0-9]*" HEAD 2> /dev/null)"
+
+ GIT_VERSION="${GIT_VERSION_STR}"
+
+ if ! echo "${GIT_VERSION_STR}" | grep -- "-dirty" >/dev/null && test "x$GIT_CURRENT_TAG" != "x"; then
+ GIT_VERSION="0"
+ fi
+fi
+
+echo "${GIT_VERSION}"
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the lttng modules sources.
+TOP_LTTNG_MODULES_DIR="$1"
+
+EXTRA_VERSION_NAME="$(sed -n '1p' "${TOP_LTTNG_MODULES_DIR}/extra_version/name" 2> /dev/null)"
+
+if [ "x${EXTRA_VERSION_NAME}" != "x" ]; then
+ echo "${EXTRA_VERSION_NAME}"
+else
+ echo "0"
+fi
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the lttng modules sources.
+TOP_LTTNG_MODULES_DIR="$1"
+
+if ! test -d "${TOP_LTTNG_MODULES_DIR}"; then
+ exit 1
+fi
+
+TMPFILE="$(mktemp)"
+
+find "${TOP_LTTNG_MODULES_DIR}/extra_version/patches/" -maxdepth 1 ! -name 'README' -type f -printf '%f\n' | sort -r \
+ | sed -E 's/[^a-zA-Z0-9 \.]/-/g ; s/(.*)/MODULE_INFO(extra_version_patch, "\1");/g' >"${TMPFILE}" 2>/dev/null
+
+if test ! -f "${TOP_LTTNG_MODULES_DIR}/extra_version/patches.i" || \
+ test x"$(cat "${TMPFILE}")" != x"$(cat "${TOP_LTTNG_MODULES_DIR}/extra_version/patches.i")"; then
+ mv "${TMPFILE}" "${TOP_LTTNG_MODULES_DIR}/extra_version/patches.i"
+fi
+
+rm -f "${TMPFILE}"
--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: (GPL-2.0 OR LGPL-2.1)
+
+# First argument is the path to the kernel headers.
+KPATH="$1"
+
+VERSIONFILE=""
+
+if [ -f "${KPATH}/localversion-rt" ]; then
+ VERSIONFILE="${KPATH}/localversion-rt"
+
+elif [ -f "${KPATH}/source/localversion-rt" ]; then
+ VERSIONFILE="${KPATH}/source/localversion-rt"
+else
+ echo 0
+ exit 0
+fi
+
+RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")
+
+if [ "x${RT_PATCH_VERSION}" = "x" ]; then
+ echo 0
+ exit 0
+fi
+
+echo "${RT_PATCH_VERSION}"