SystemTap on Fedora ARM

The ARM processor is an extremely popular processor with a variety of Linux distributions available, including Fedora ( The ARM is a secondary architecture for Fedora and currently has a Fedora 13 release candidate available rather the Fedora 15 that is available for x86 processors.

It is possible to build the current SystemTap from the git repository for Fedora 13 on arm. It is also possible to build the SystemTap binary rpms if one turns off the with_crash flag in the systemtap.spec files.

One aspect that the ARM processors differ greatly from x86 processors is ARM has been mostly used as an embedded processors. For these applications developer usually configure the ARM kernels features during compile. Thus, rather than having a generic kernel that runs on AMD, Intel, and VIA X86 processors and dynamically determines which features the processor support each ARM platform needs a custom configured kernel. The result of this is that there are not usually kernel RPMs for ARM platforms. ARM Fedora developers are starting to address this (, but the kernel-debuginfo and kernel-devel rpm packages are not usually available. The systemtap rpm needs those packages around to be able to build the instrumentation module.

Need to build a kernel to make a kernel build tree that can be used by systemtap. This could be cross compiled or natively built. This document will limit itself to the cross compiled kernel where the kernel is built on a x86_64 host machine machine for an ARM target.

The cross compiler mentioned in the following Fedora URL is relatively old and does not understand the "-mcpu=cortex-a8" option needed to build kernels for some of the newer ARM processors:

Ended up install the boostrap arm fedora 15 bootstrap tools and building the compiler in there. Information on the tool at:

The git clone of this will create a bootstrap directory. This tools needs srpms. Downloaded the dvd iso of the srpms, loop mount the dvd iso, and link to the SRPMs to the dvd iso mount point. Also made a SRPMlocal directory. Then in bootstrap directory:

./stage1 kernel-headers
./stage1 binutils
./stage1 gcc-host
./stage1 glibc-headers
./stage1 gcc-libgcc
./stage1 glibc

At this point have cross compile tools in bootstrap/install/bin. Alternative you might also be able to use cross compiler RPMs mentioned in:

For uImage will also need the uboot-tools so as root:

yum install uboot-tools

Grab the kernel for my Efika MX smartbook platform at:

Then adding environment variable for the cross compile (adjust as needed):

export PATH=/home/wcohen/stuff/efikamx/bootstrap/install/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=armv7hl-redhat-linux-gnueabi-

Setup configuration for the efika mx with:

make mx51_efikamx_defconfig

Make sure the following config entries in the .config are active (=y or =m):

Check to see whether there are any additional CONFIG_* that need to be set:

make oldconfig

Then start building with (other platforms may use zImage instead of uImage):

make vmlinux uImage modules

Now time to install the code on an SDcard. The card already has an bootable fedora install as in /boot and /root partitions. As root:

export PATH=/home/wcohen/stuff/efikamx/bootstrap/install/bin:$PATH
export ARCH=arm
export CROSS_COMPILE=armv7hl-redhat-linux-gnueabi-
export VERSION=
make modules_install INSTALL_MOD_PATH=/media/root
cp arch/arm/boot/uImage /media/boot/uImage-$VERSION

Unmount all the SDcard partions on host. Move SDcard to target machine. Boot it up with the old kernel.

Time Update to new kernel. Make sure that uboot-tools rpm are installed on target. As root on ARM target machine:

cd /boot
export VERSION=
dracut -f uInitrd-$VERSION.img $VERSION
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs \
-d /boot/uInitrd-$VERSION.img /boot/uInitrd-$VERSION
cp uImage-$VERSION  uImage
cp uInitrd-$VERSION uInitrd
mkimage -A arm -O linux -a 0 -e 0 -T script -C none \
-n "EfikaMX Boot Script" -d /boot/ /boot/boot.scr

Reboot the machine to start the new kernel.

Test out systemtap ability to generate scripts on host for a different target architecture based on the information in:

Build the systemtap instrumentation module with the following command run as a normal user:

export KERNEL_SRC=/home/wcohen/stuff/efikamx/kernel/linux-kernel
stap -a arm -B CROSS_COMPILE=armv7hl-redhat-linux-gnueabi- \
-m vfs_read -e 'probe {printf("read performed\n"); exit()}'

Copy the vfs_read.ko file to the target machine. Install the systemtap-runtime rpm from:

Then on ARM target machine run as root the following:

staprun vfs_read.ko

Will get some thing like the following output on the ARM target system

read performed

As work progresses on Fedora ARM steps such as cross compiling the kernel and building the systemtap module on a separate machine will be eliminated.

None: SystemtapOnFedoraArm (last edited 2011-07-15 21:01:02 by WilliamCohen)