Skip to main content.

=========================================================================
Using the Linux Trace Tool kit (LTT) on DENX Linux 2.4.x with RTAI 24.1.x
=========================================================================

This README briefly describes how to install and use LTT 0.9.5 on a
PowerPC cross development environment. Traces are taken on the PowerPC
target and visualized on the host.

This installation assumes that you use the Embedded Linux Development 
Kit (ELDK), see http://www.denx.de/re/ELDK.html). Check also the files
../README and README.install.


Installation and Usage:
-----------------------

The following sample installation is for a CPCI405 module (IBM 405GP), 
which requires the kernel source tree "linuxppc_2_4_devel" checked out 
with the revision tag "LABEL_2003_05_04_1125":


1. Checkout the DENX Linux kernel source tree with the specified date. 
   When prompted for a password for anonymous, simply press the Enter 
   key:

   $ cd <path>
   $ LINUX_TREE="linuxppc_2_4_devel"
   $ CVS_TAG="LABEL_2003_05_04_1125"
   $ cvs -d :pserver:anonymous@www.denx.de:/cvsroot login
   $ cvs -z6 -d :pserver:anonymous@www.denx.de:/cvsroot \
     co -P -r $CVS_TAG $LINUX_TREE
   $ export LINUX_ROOT=$PWD/$LINUX_TREE


2. Get and apply the RTAI-LTT kernel patch. You may first want to use 
   the option "--dry-run" to check if it applies flawlessly:
  
   $ KERNEL_PATCH="patch-denx-${LINUX_TREE}-${CVS_TAG}-ltt"
   $ URL="ftp://ftp.denx.de/pub/RTAI/24.1.11"
   $ wget $URL/$KERNEL_PATCH
   $ cd $LINUX_ROOT
   $ patch -b -z.PRE_RTAI_LTT -p1 < ../$KERNEL_PATCH


3. Configure and make the Linux kernel with RTAI and LTT support:

   $ export CROSS_COMPILE=ppc_4xx-
   $ make cpci405_config
   $ make menuconfig
   ... make additional configuration ...
   For tracing RTAI you must select the following options:  
   select "Kernel tracing  --->"
   select "    <M> Kernel events tracing support"
   select "    [*] RTAI event tracing support"
   ...
   $ make dep
   $ make pImage
   $ cp -p arch/ppc/boot/images/pImage /tftpboot


4. Unfold, configure and make RTAI. [Instead of using the Validated 
   Release you could also checkout "rtai4" from the CVS repository.]
   Usually the default configuration is OK. Note: for the IBM 405GP 
   you _must_ disable the floating point support manually.

   $ cd <directory-shared-with-target>
   $ wget $URL/rtai-24.1.11-denx.tar.bz2
   $ bzip2 -dc rtai-24.1.11-denx.tar.bz2 | tar xf -
   $ cd rtai-24.1.11
   $ export CROSS_COMPILE=ppc_4xx-
   $ make
   ...
   Enter location of Linux source tree [...]: <path>/linuxppc_2_4_devel
   ...
   Enable floating point support (CONFIG_RTAI_FPU_SUPPORT) [Y/n/?] n
   ...
   $ make


5. Get and unfold the LTT distribution and define LTT_ROOT:

   $ cd <path>
   $ wget http://www.opersys.com/ftp/pub/LTT/TraceToolkit-0.9.5a.tgz
   $ gzip -dc TraceToolkit-0.9.5a.tgz | tar xf -
   $ export LTT_ROOT=$PWD/TraceToolkit-0.9.5


6. Patch, configure and build LTT:

   First we make and save the "tracedaemon" for the target:

   $ cd $LTT_ROOT
   $ export CROSS_COMPILE=ppc_4xx-
   $ ./configure --prefix=/usr/local
   $ make -C LibUserTrace CC=${CROSS_COMPILE}gcc
   $ make -C Daemon CC=${CROSS_COMPILE}gcc
   $ cp -p LibUserTrace/.libs/libusertrace.so.0 Daemon/.libs/tracedaemon \
   <directory-shared-with-target>

   Then we make the "tracevisualizer" for the host:
   
   $ make -C LibLTT
   $ make -C Visualizer

   You may want to install the Visualizer in /usr/local (as defined 
   above with --prefix). Alternatively you can use the application
   "Visualizer/.libs/tracevisualizer" directly:

   $ su
   Passwort <your-password>
   # make install


7. Boot the target and take a trace with LTT. The demo script 
   "load-ltt" available at $URL takes a trace of the RTAI
   exampe module "sw". Before running it you may need to adjust
   the TARGET_ROOT. There are more instructions inside "load-ltt":

   cpci405 login: root
   Last login: Mon Nov 29 19:00:42 on ttyS0
   bash-2.04# cd <directory-shared-with-host>
   . load-ltt
   Load RTAI modules
   rtai: mount done
   
   ==== RT memory manager v1.3 Loaded. ====   
   
   ***** STARTING THE UP REAL TIME SCHEDULER WITH LINUX *****
   ***** FP SUPPORT AND READY FOR A PERIODIC TIMER *****
   ***<> LINUX TICK AT 100 (HZ) <>***
   ***<> CALIBRATED CPU FREQUENCY 198000000 (HZ) <>***
   ***<> CALIBRATED TIMER-INTERRUPT-TO-SCHEDULER LATENCY 2500 (ns) <>***
   ***<> CALIBRATED ONE SHOT SETUP TIME 500 (ns) <>***
   
   Load RTAI demo 'sw'
   Start tracing
   bash-2.04# TraceDaemon: Output file ready
   TraceDaemon: Trace driver open
   TraceDaemon: Trace buffers are 1000000 bytes
   TraceDaemon: Fetching eip for syscall on depth : 0
   TraceDaemon: Daemon wil run for : (20, 0)
   TraceDaemon: Done mapping /proc
   
   TraceDaemon: End of tracing
  

8. Visualize the trace out.trace, out.proc on the host using
   the GTK graphical user interface. Please consult the LTT 
   help for further information:
   
   $ export PATH=$PATH:$LTT_ROOT/Visualizer/.libs
   $ export LD_LIBRARY_PATH=$LTT_ROOT/LibLTT/.libs
   $ cd <directory-shared-with-target>
   $ tracevisualizer
   ... use the graphical user interface ...


Tips, Tricks and Remarks:
-------------------------

   o You can visualize the trace host with the program
     TraceToolkit-0.9.5/Visualizer/tracevisualizer.
     Please consult the LTT help for further information.

   o Warning: tracing with LTT puts some additional load
     and requires larger stack sizes. Though, if you see
     weired system crashes and hangups try to increase the
     task stack size first. If it does not help you should
     increase the period time.

   o Currently, the timer interrupt (decrementer trap) is 
     handled like a normal interrupt with the number 255.