[lttng-dev] LTTNG on Android ICS

Pierre-Luc St-Charles pierre-luc.st-charles at polymtl.ca
Fri May 17 09:47:48 EDT 2013


Alright, small update for all following a quick (non-mailing-list) exchange:

We did successfully complete a kernel-tracing port of LTTng for Android
(somewhat old news), but we are still working on bringing our patches back
up to date with the current version of the different projects (soon-ish
still applies here, we're talking days). So far, we dwelled a little bit in
LTTng-UST, but haven't done much changes, so userspace tracing is still not
functional. Device that ran kernel traces successfully so far were the
Nexus S and the Nexus 7 (example Nexus S trace available
here<https://drive.google.com/folderview?id=0B55Ba7lWTLh4U0hGeTQ4bmRYRjQ&usp=sharing>;
still not perfect).

Basically, we cross-compiled everything via the Android NDK (no Android
makefiles involved here), and pushed all required bins to a device without
having to flash it (unless the default kernel config didn't allow tracing
-- then we'd have to flash). This approach is not compatible with the
official Android build system (meaning we wouldn't be able to add it to
Android like this), but we might eventually get working on the damned
Android makefiles (they're extremely painful to write, especially since
LTTng uses Autotools).

The librairies required by LTTng that are not already included in a regular
Android build (uuid/popt) can actually be found/compiled from the official
repo, in its 'external' directory (see oprofile and e2fsprog -- from
memory). That might not be the easiest way to get them (full repo download
is BIG), but compatibility is assured, and you can skip a full build by
simply making those two individually for your device (if that's all you
need).

You'll also need your device to be rooted to use LTTng at all; then, most
initializations are done via scripts (we'll also provide those with our
patches). We still had some trouble automating everything via daemons, so
we always ran the sessiond locally (with success).

Major problems we encountered so far were missing posix functions, and sysv
shared memory. Basically, Android relies on Bionic for its system calls and
other low-level functions, and since Bionic is pretty 'lightweight', they
trimmed most of the fat out for performance. We had to make some
more-or-less sketchy replacements here and there, but everything seems to
be working decently now.

So, simple 'how do I put LTTng on Android' workflow would be this:

  - Compile modules (using NDK) against device's kernel, making sure its
config is appropriate, ship them over via ADB

  - Compile required external libraries (using repo build system) for the
device, ship them over via ADB

  - Patch up LTTng-* (soon-ish! I could send you the outdated patches right
now if you're interested though, they might be a month behind or so on the
current trunks)

  - Cross-compile LTTng-* for the device (using NDK), ship binaries over
via ADB

Then, on the device, start up the sessiond manually & start tracing.


I think I went over everything, but if there's a part that's still cloudy,
don't hesitate.


-PL


On May 17, 2013 1:32 AM, "Ionut D." <ionut5001 at gmail.com> wrote:

> Hello all,
>
> Recently I started to integrate LTTNG in Android ICS by compiling each
> package, each dependency, by using the Android build system. It is a lot of
> work because I met different problems and to be sincere, I do not know if
> at the end will work and I do not know how much I will need to modify the
> sources in order to work.
>
> My questions are about this integration. I mention that I read a lot of
> discussions about this on Internet, on this mailing list, but the things
> are still not very clear for me.
>
> It is ok? what I am trying to do ? to integrate and build by using the
> Android build system.
> Could you give me some guidelines, indications about how I should proceed,
> maybe a tutorial or maybe some android make files/patches that would help
> me to see how the job must be done and if I am doing it right ?
>
> Until now I managed to build lttng-modules, liburcu, libuuid from
> util-linux and configure lttng-ust by using the android toolchain for arm.
> I got a lot of errors but until now I managed to configure/make these
> packages.
>
> I mention that I am trying to build lttng 2.x on ICS 4.0.3.
>
> Would be great if you will give me a tutorial about how to do it.
>
> Ionut
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20130517/86e27017/attachment.html>


More information about the lttng-dev mailing list