Contents
Back to "Systemtap on Maemo Home"
Systemtap on Nokia N800/N810 HOWTO
This tutorial is a walkthrough made after efforts to get systemtap running on N800/N810 device. In order to compile systemtap from scratch, you need a scratchbox target with armel/glibc toolchain. You also need to install a quilt tool inside your scratchbox. Follow the steps below in order to download, compile and install systemtap binaries on your device.
Step 1: Download needed files
Systemtap
You can download the latest systemtap snapshot with this link:
[sbox-ARMEL: ~] wget ftp://sourceware.org/pub/systemtap/snapshots/latest.tar.bz2
You also need to get translate.diff patch. why? Create translate.diff file, copy code below and paste to translate.diff:
--- ./translate.cxx +++ ./translate.cxx @@ -1105,12 +1105,7 @@ o->newline() << "if (strcmp (release, " << lex_cast_qstring (session->kernel_release) << ")) {"; - o->newline(1) << "_stp_error (\"module release mismatch (%s vs %s)\", " - << "release, " - << lex_cast_qstring (session->kernel_release) - << ");"; - o->newline() << "rc = -EINVAL;"; - o->newline(-1) << "}"; + o->newline() << "}"; // XXX: perform buildid-based checking if able
ELFutils
Elfutils is a set of application that helps in the compilation of systemtap:
[sbox-ARMEL: ~] wget ftp://sourceware.org/pub/systemtap/elfutils.old/elfutils-0.131.tar.gz
You also need to get a patch that adds portability:
[sbox-ARMEL: ~] wget ftp://sourceware.org/pub/systemtap/elfutils.old/elfutils-portability.patch
In order to solve a compilation error when using gcc 3.4 (contained on the armel/glibc scratchbox toolchain), you need to get elfutils-vector-fix.patch from attachments of this wiki page.
Step 2: Compile systemtap sources
Systemtap
Decompress systemtap:
[sbox-ARMEL: ~] tar xjf latest.tar.bz2
Enter its directory:
[sbox-ARMEL: ~] cd src
Create a directory named patches/ and copy translate.diff into it:
[sbox-ARMEL: ~/src] mkdir patches [sbox-ARMEL: ~/src] cp ../translate.diff patches/ [sbox-ARMEL: ~/src] echo "translate.diff" > patches/series
Now patch systemtap using quilt:
[sbox-ARMEL: ~/src] quilt push [sbox-ARMEL: ~/src] quilt refresh
Decompress elfutils package inside systemtap directory:
[sbox-ARMEL: ~/src] tar xzf ../elfutils-0.131.tar.gz
Enter elfutils directory:
[sbox-ARMEL: ~/src] cd elfutils-0.131
Create a directory named patches/ and copy both elfutils-portability.patch and elfutils-vector-fix.patch into it:
[sbox-ARMEL: ~/src/elfutils-0.131] mkdir patches [sbox-ARMEL: ~/src/elfutils-0.131] cp ../../elfutils-portability.patch patches/ [sbox-ARMEL: ~/src/elfutils-0.131] cp ../../elfutils-vector-fix.patch patches/ [sbox-ARMEL: ~/src/elfutils-0.131] echo "elfutils-portability.patch" >> patches/series [sbox-ARMEL: ~/src/elfutils-0.131] echo "elfutils-vector-fix.patch" >> patches/series
Now patch elfutils using quilt. In order to apply two patches, you should run quilt push and quilt refresh twice (or just run quilt -a push for applying all patches from series):
[sbox-ARMEL: ~/src/elfutils-0.131] quilt push [sbox-ARMEL: ~/src/elfutils-0.131] quilt refresh [sbox-ARMEL: ~/src/elfutils-0.131] quilt push [sbox-ARMEL: ~/src/elfutils-0.131] quilt refresh
Now your system is prepared to configure/make systemtap. First, get to the parent directory:
[sbox-ARMEL: ~/src/elfutils-0.131] cd ..
Use this command to configure systemtap:
[sbox-ARMEL: ~/src] ./configure --with-elfutils=./elfutils-0.131 --prefix=/usr
After this step, you can make/install systemtap:
[sbox-ARMEL: ~/src] make all check && fakeroot make install
Step 3: Create systemtap debian package
To create systemtap debian package, you need dh_make tool. It is available on scratchbox targets with debian devkits installed. First, rename your systemtap source directory:
[sbox-ARMEL: ~/src] cd .. [sbox-ARMEL: ~] mv src/ systemtap-<version> [sbox-ARMEL: ~] cd systemtap-<version>
Where <version> corresponds to the systemtap snapshot version (i.e. 20080202). Now you need to export some environment variables:
[sbox-ARMEL: ~/systemtap-20080202] export DEBFULLNAME="John Doe" [sbox-ARMEL: ~/systemtap-20080202] export DEBEMAIL="john@doe.com"
DEBFULLNAME and DEBEMAIL environment variables represents the maintainer's full name and email, respectively. Run dh_make tool, setting package class to single:
[sbox-ARMEL: ~/systemtap-20080202] dh_make -s
The command above creates the debian/ directory. You need to modify some of these configurations to get your debian package built. In order to do that, you need to get elfutils-debian.patch from attachments of this wiki page.
Patch debian/ directory:
[sbox-ARMEL: ~/systemtap-20080202/debian] patch -p0 < elfutils-debian.patch
Now you are ready to build systemtap debian package. Run the command below:
[sbox-ARMEL: ~/systemtap-20080202] dpkg-buildpackage -rfakeroot -us -uc -b
Debian packages are available at the parent directory:
[sbox-ARMEL: ~/systemtap-20080202] ls -l ../systemtap*.deb ./systemtap_<version>-1_armel.deb
Now you are ready to install systemtap inside your N800/N810 device. For further instructions about kernel configurations (default Maemo kernels doesn't have some additional modules required by systemtap), please see Systemtap Benchmark on Nokia N800/N810.