This page describes how to build and run LTTng(with limited functionality) on Xilnx Zynq Linux.
Table of Contents
OverviewThe 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.
RequirementsRequired 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
Build Directory Hierachylttng-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 LTTngThe kernel can be downloaded from Xilinx git,The following changes have to be applied,Then, the kernel can be configured properly for LTTng using the command below,Build the kernel by following command,The generated uImage(in arch/arm/boot/) needs to be downloaded into the target ZC702 hardware to run LTTng.Return to the build root,Building LTTng Kernel ModulesThe source code can be downloaded by the following commandFor later Linux kernels(3.9 or later), some headers have been changed, so a following change should be applied.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.KERNELDIR should be set to the Linux kernel directory used above, and the LTTng modules can be build as following,Since ramdisk doesn't have proper directories for kernel modules, collect all LTTng kernel modules into one directory,Return to the build root,Building libpopt for LTTng Toolslibpopt and userspace rcu should be built before building LTTng tools.libpopt can be downloaded from the following link,libpopt needs to be configured and installed as following,Return to the build root,Building userspace rcu library for LTTng toolsUserspace rcu can be downloaded using the command show belowUserspace rcu needs to be configured in the similar way to libpopt,Following changes should be applied to config.h to correct the configuration. (this is a workaround)Now, userspace rcu can be built and installed simply using following,Return to the build root,Building LTTng ToolsSince all dependent libraries are built, LTTng tools can be built upon those. The source tree can be downloaded by the following command,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 modificationsBecause 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,Build and install LTTng tools using the following command,Return to the build root,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 LTTng on Xilinx Zynq LinuxMake sure its the kernel built from previous steps by checking if its uname is '3.6.0-linux-xilinx-lttng-dirty',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,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(https://lttng.org/), and the simple operation will be described here as an example.A LTTng session needs to be created,Available kernel events can be listed by following,All kernel events can be enabled using the following command,Tracing is started and stopped by commands shown below,The current LTTng session can be destroyed by following,
Viewing LTTng TracesAll 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(https://lttng.org/eclipse). Detailed instructions for LTTng viewers are available on the official website(https://lttng.org/viewers)