ifneq ($(KERNELRELEASE),)
ifneq ($(CONFIG_TRACEPOINTS),)
+KERNELDIR=${LTTNG_KERNELDIR}
+
lttng_check_linux_version = $(shell pwd)/include/linux/version.h
lttng_check_generated_linux_version = $(shell pwd)/include/generated/uapi/linux/version.h
endif
endif
+include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds
+
obj-m += lttng-ring-buffer-client-discard.o
obj-m += lttng-ring-buffer-client-overwrite.o
obj-m += lttng-ring-buffer-metadata-client.o
CFLAGS = $(EXTCFLAGS)
default:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+ LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
+ LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
clean:
- $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
+ LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
%.i: %.c
- $(MAKE) -C $(KERNELDIR) M=$(PWD) $@
+ LTTNG_KERNELDIR=$(KERNELDIR) $(MAKE) -C $(KERNELDIR) M=$(PWD) $@
endif # KERNELRELEASE
--- /dev/null
+# 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 $(KBUILD_EXTMOD)/abi-debian-version.sh $(KERNELDIR))
+
+ifneq ($(DEB_API_VERSION), 0)
+ccflags-y += -DDEBIAN_API_VERSION=$(DEB_API_VERSION)
+endif
--- /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).*//')
+# 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]+)$/\1/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}
)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2) \
- || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0))
+ || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0) \
+ || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0))
LTTNG_TRACEPOINT_EVENT_MAP(mm_page_alloc_extfrag,
+KERNELDIR=${LTTNG_KERNELDIR}
+
+include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds
+
obj-m += lttng-lib-ring-buffer.o
lttng-lib-ring-buffer-objs := \
LTTNG_UBUNTU_VERSION_CODE < \
LTTNG_UBUNTU_KERNEL_VERSION(a_high, b_high, c_high, d_high))
+#define LTTNG_DEBIAN_KERNEL_VERSION(a, b, c, d, e, f) \
+ (((((a) << 16) + ((b) << 8) + (c)) * 1000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
+
+#define LTTNG_DEBIAN_VERSION_CODE \
+ ((LINUX_VERSION_CODE * 1000000ULL) + DEBIAN_API_VERSION)
+
+#define LTTNG_DEBIAN_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
+ a_high, b_high, c_high, d_high, e_high, f_high) \
+ (defined(DEBIAN_API_VERSION) && \
+ LTTNG_DEBIAN_VERSION_CODE >= \
+ LTTNG_DEBIAN_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
+ LTTNG_DEBIAN_VERSION_CODE < \
+ LTTNG_DEBIAN_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
+
#endif /* _LTTNG_KERNEL_VERSION_H */
ifneq ($(KERNELRELEASE),)
ifneq ($(CONFIG_TRACEPOINTS),)
+KERNELDIR=${LTTNG_KERNELDIR}
+
+include $(KBUILD_EXTMOD)/Makefile.ABI.workarounds
+
ccflags-y += -I$(PWD)/probes
obj-m += lttng-types.o