This page describes how to build and run LTTng(with limited functionality) on Xilnx Zynq Linux.


The LTTng(Linux Trace Toolkit - next generation) project aims at efficient tracing tools for Linux. LTTng consists of kernel tracer and user tracer, and as a part of project, there are multiple viewers to show and analyze traces. LTTng can trace a lot of kernel functions such as memory, scheduling, filesystem, network, and more.


Required modules for LTTng for Xilinx Zynq Linux
  • Xilinx Zynq Linux : Zynq Linux with tracepoints feature(CONFIG_TRACEPOINTS) on
  • LTTng modules : kernel modules for LTTng
  • LTTng tools : userspace daemons and tools
  • userspace rcu : userspace rcu library used by LTTng tools
  • libpopt : used by LTTng tools
  • Following instructions might need some changes depending on Xilinx Linux Kernel versions.
  • Other kernel options(syscall_tracepoint, perf_events, event_tracing, kprobes, kretprobes) may be turned on to utilize more LTTng features
  • LTTng from this page is running on ramdisk, and /tmp directory is used for build prefix and running path.
  • Userspace tracing(UST) is disabled from LTTng tools due to its dependencies to other libraries

Building Process

Build Directory Hierachy

lttng-build-root /
| - linux-xlnx : Xilinx Zynq Linux for LTTng
| - lttng-modules-xlnx : LTTng kernel modules for Xilinx Zynq linux
| - kos : generated LTTng kernel modules
| - popt-1.16-xlnx : libpopt for LLTng tools
| - userspace-rcu-xlnx : userspace rcu library for LLTng tools
| - lttng-tools-xlnx : LTTng tools

/tmp/<YOUR_LTTNG_ROOT> : the build root directory where all created binaries are placed. (YOUR_LTTNG_ROOT=username-lttng-root for this page)

Building Xilinx Zynq Linux for LTTng

The kernel can be downloaded from Xilinx git,
build > git clone git:// linux-xlnx
build > cd linux-xlnx
The following changes have to be applied,
diff --git a/arch/arm/configs/xilinx_zynq_defconfig b/arch/arm/configs/xilinx_zynq_defconfig
index 58c226e..e9c069c 100644
--- a/arch/arm/configs/xilinx_zynq_defconfig
+++ b/arch/arm/configs/xilinx_zynq_defconfig
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 96e1668..7a557c3 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -54,3 +54,10 @@ config XILINX_AXIPCIE
+       bool "Tracepoints for lttng modules"
+       default y
+       help
+         Enable tracepoints for lttng modules
Then, the kernel can be configured properly for LTTng using the command below,
build > make ARCH=arm xilinx_zynq_defconfig
Build the kernel by following command,
build > make ARCH=arm uImage UIMAGE_LOADADDR=0x8000
The generated uImage(in arch/arm/boot/) needs to be downloaded into the target ZC702 hardware to run LTTng.
Return to the build root,
build > cd ..

Building LTTng Kernel Modules
The source code can be downloaded by the following command
build > wget
build > tar -xf lttng-modules-2.1.1.tar.bz2
build > cd lttng-modules-2.1.1
For later Linux kernels(3.9 or later), some headers have been changed, so a following change should be applied.
--- /instrumentation/events/lttng-module/sched.h
<span style="font-family: arial,helvetica,sans-serif; line-height: 1.5;">@@ -5,6 +5,7 @@</span>
 #define _TRACE_SCHED_H
 #include <linux/sched.h>
+#include <linux/sched/rt.h>
 #include <linux/tracepoint.h>
 #ifndef _TRACE_SCHED_DEF_
A following change has to be applied, otherwise a huge system call table is included in lttng_tracer.ko which results in vmalloc allocation failure on runtime.
--- /instrumentation/syscalls/headers/arm-32-syscalls-2.6.38_integers_override.h
@@ -2,7 +2,6 @@
 #define OVERRIDE_TABLE_32_sys_arm_fadvise64_64
 #define OVERRIDE_TABLE_32_sys_sync_file_range2
-#define OVERRIDE_TABLE_32_sys_set_tls
@@ -38,18 +37,6 @@ SC_TRACE_EVENT(sys_sync_file_range2,
-       TP_PROTO(unsigned int tid, unsigned long tls),
-       TP_ARGS(tid, tls),
-       TP_STRUCT__entry(
-               __field(unsigned int, tid)
-               __field_hex(unsigned int, tls)),
-       TP_fast_assign(
-               tp_assign(tid, tid)
-               tp_assign(tls, tls)),
-       TP_printk()
 #define OVVERRIDE_TABLE_32_sys_mmap
@@ -59,9 +46,6 @@ TRACE_SYSCALL_TABLE(sys_mmap, sys_mmap, 90, 6)
 TRACE_SYSCALL_TABLE(sys_arm_fadvise64_64, sys_arm_fadvise64_64, 270, 4)
 #define OVERRIDE_TABLE_32_sys_sync_file_range2
 TRACE_SYSCALL_TABLE(sys_sync_file_range2, sys_sync_file_range2, 341, 4)
-#define OVERRIDE_TABLE_32_sys_set_tls
-TRACE_SYSCALL_TABLE(sys_set_tls, sys_set_tls, 0xf0005, 2)
KERNELDIR should be set to the Linux kernel directory used above, and the LTTng modules can be build as following,
build > make KERNELDIR=lttng-build-root/linux-xlnx ARCH=arm
Since ramdisk doesn't have proper directories for kernel modules, collect all LTTng kernel modules into one directory,
build > mkdir lttng-build-root/kos
build > find . -name "*.ko" -exec cp -i {} lttng-build-root/kos/. \;
Return to the build root,
build > cd ..

Building libpopt for LTTng Tools
libpopt and userspace rcu should be built before building LTTng tools.
libpopt can be downloaded from the following link,
build > wget
build > tar -xf popt-1.16.tar.gz
build > cd popt-1.16
libpopt needs to be configured and installed as following,
build > ./configure --prefix=/tmp/username-lttng-root/ --host=arm-xilinx-linux-gnueabi
build > make install
Return to the build root,
build > cd ..

Building userspace rcu library for LTTng tools
Userspace rcu can be downloaded using the command show below
build > wget
build > tar -xf userspace-rcu-0.7.6.tar.bz2
build > cd userspace-rcu-0.7.6
Userspace rcu needs to be configured in the similar way to libpopt,
build > ./configure --prefix=/tmp/username-lttng-root/ --host=arm-xilinx-linux-gnueabi
Following changes should be applied to config.h to correct the configuration. (this is a workaround)
+++ config.h
@@ -45,7 +45,7 @@
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
-#define HAVE_MALLOC 0
+#define HAVE_MALLOC 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
@@ -136,7 +136,7 @@
/* Define to rpl_malloc if the replacement function should be used. */
-#define malloc rpl_malloc
+/*#define malloc rpl_malloc*/
/* Define to `int' if <sys/types.h> does not define. */
/* #undef pid_t */
Now, userspace rcu can be built and installed simply using following,
build > make install
Return to the build root,
build > cd ..

Building LTTng Tools
Since all dependent libraries are built, LTTng tools can be built upon those. The source tree can be downloaded by the following command,
build > wget
build > tar -xf lttng-tools-2.1.1.tar.bz2
build > cd lttng-tools-2.1.1
LTTng tools should be configured following, and as mentioned earlier, userspace tracing(UST) needs to be disabled due to complex dependencies. -DXILINX_MOD is used for modifications
build > ./configure --prefix=/tmp/username-lttng-root/ --host=arm-xilinx-linux-gnueabi LDFLAGS=-L/tmp/username-lttng-root/lib CPPFLAGS="-I/tmp/username-lttng-root/include -DXILINX_MOD" --disable-lttng-ust
Because this LTTng on Zynq is running on the ramdisk, its running path has to be reconfigured, and that can be done with the following change,
+++ src/common/defaults.h
@@ -32,8 +32,13 @@
 /* Environment variable to set session daemon binary path. */
+#ifdef XILINX_MOD
+/* Default trace output directory name */
+#define DEFAULT_TRACE_DIR_NAME                  "/tmp/lttng-traces"
 /* Default trace output directory name */
 #define DEFAULT_TRACE_DIR_NAME                  "lttng-traces"
 /* Default size of a hash table */
 #define DEFAULT_HT_SIZE                         4
@@ -77,7 +82,11 @@
 /* Default lttng run directory */
+#ifdef XILINX_MOD
+#define DEFAULT_LTTNG_RUNDIR                    "/tmp/lttng"
 #define DEFAULT_LTTNG_RUNDIR                    "/var/run/lttng"
 #define DEFAULT_LTTNG_HOME_RUNDIR               "%s/.lttng"
Build and install LTTng tools using the following command,
build > make install
Return to the build root,
build > cd ..
Now all needed libraries and executable are built and installed in /tmp/<YOUR_LTTNG_ROOT>/. <YOUR_LTTNG_ROOT> directory should be placed in the /tmp/ on the target Zynq Linux.

Running Process

Running LTTng on Xilinx Zynq Linux

Make sure its the kernel built from previous steps by checking if its uname is '3.6.0-linux-xilinx-lttng-dirty',
zynq > uname -r
LTTng kernel modules need to be loaded in order to run LTTng tools. The modprobe directory should be created for not getting modprobe errors as a workaround. The proper directory can be created using the following command,
zynq > mkdir -p /lib/modules/$(uname -r)
Place all LTTng kernel modules in lttng-build/root/kos in the modprobe directory created above. Now LTTng tools can run without problem. More details operations can be found on the offical website(, and the simple operation will be described here as an example.
A LTTng session needs to be created,
zynq > /tmp/username-lttng-root/bin/lttng create <YOUR_SESSION>
Available kernel events can be listed by following,
zynq > /tmp/username-lttng-root/bin/lttng list -k
All kernel events can be enabled using the following command,
zynq > /tmp/username-lttng-root/bin/lttng enable-event -k -a
Tracing is started and stopped by commands shown below,
zynq > /tmp/username-lttng-root/bin/lttng start
zynq > /tmp/username-lttng-root/bin/lttng stop
The current LTTng session can be destroyed by following,
zynq > /tmp/username-lttng-root/bin/lttng destroy

Viewing LTTng Traces

All traces are stored in /tmp/lttng-traces/<YOUR_SESSION_DIR>, and traces can be viewed and analyzed using several viewers. For example, Eclipse with LTTng plugin can be downloaded and used as a LTTng viewer( Detailed instructions for LTTng viewers are available on the official website(

External Link