[OE-core] [RFC PATCH 0/5] systemtap adding sysroot, cross compiling of user land related scripts

Victor Kamensky kamensky at cisco.com
Tue Mar 6 17:50:36 UTC 2018


Hi Guys,

I am a fan of SystemTap and big fan of OE. Systemtap and OE use case I have
on my mind is the following:

1) small embedded target image built, because of resource constraint such
target could not run full blown systemtap on, it would not have resources
to have debug symbols, toolchain, kernel sources, etc installed on target,
memory size available to to SystemTap script build, etc

2) on host target image is build with debug symbols available somewhere
on the host

3) systemtap operates in cross compilation mode, builds targetscript.ko module,
which could be copied to target device

4) on target tiny systemtap runtime, like staprun, stapio, utilities are
present and they are used to activate systemtap targetscript.ko and observe
SystemTap in action.

In fact OE already has scripts/crosstap script that provides similar to above
experience. But the scripts one can have with crosstap can deal only with
kernel code. If one would like to write SystemTap script that involves
user land process probes crosstap script will not work.

In part the problem was that in SystemTap itself --sysroot options was
effectively broken or never worked. So it was not possible to build user-land
related script in cross compiled mode. I worked on SystemTap fixing --sysroot 
option support and I posted these fixes on systemtap mailing list [1].

Now with --sysroot option support fixed in SystemTap it comes to the
question how it could be integrated into OE related engineers work flow. And
here I need team's feedback. These patch series implements proposal for such
improved SystemTap OE integration, but some parts can cause controversy.

Here is patches overview, with indication of my concerns and ask for
feedback:

  Revert "systemtap: Cross compilation fix"

      Remove previous OE specific patch. It superseded by --sysroot support
      patch series


  systemtap: support --sysroot option in variety of situations in cross
    build

      effectively [1] integrated with OE, these patches will be discussed
      with SystemTap guys directly.


  image: add IMAGE_GEN_COMBINED_DEBUGFS build option

      this one may cause some controversy. For SystemTap to build user-land
      related script, it needs target sysroot tree overlayed with debug
      symbols. OE already has IMAGE_GEN_DEBUGFS option implemented but
      it produces split target and debug symbols tarballs that have to be
      recombined. I claim step of recombination is a drug on developer
      work flow. IMAGE_GEN_COMBINED_DEBUGFS is similar to IMAGE_GEN_DEBUGFS,
      but resulting rootfs-dbg would contain both target and symbols, so
      it could be used right away. Also I feel that implementation of
      IMAGE_GEN_COMBINED_DEBUGFS option might not be very elegant, especially
      with prelink related issue that changes target binaries


  systemtap: introduce utils variant of systemtap package build

      systemtap-utils recipe is special systemtap build that would compile
      only utilities and have minimal dependencies possible. I considered to
      split out those utilities on packaging step of systemtap but with
      dependencies description, it got very messy, so I decided to go
      with separate conflicting with systemtap recipe


  crosstap2: wrapper to build systemtap script on host against given
    target

      Wrapper script similar to crosstap that take SystemTap script and
      image name, retrieve rest of required information from bitbake -e
      command and construct stap invocation with all proper arguments
      passed needed for cross compilation. Script is implemented in python
      it has more advanced logic then existing crosstap tool. But one may
      ask why I did not improved existing crosstap script - I felt that
      new requirements is too much to be implemented in shell script and
      in backward compatible mode without breaking historic interface to
      crosstap.


If someone interested in full patch series my OE tree with these fixes
is here [2]. It was tested on variety of qemu related machines. Steps that
shows how whole work flow OE and SystemTap works are here [3]. Examples of
crosstap2 invocations are here [4].

[1] https://sourceware.org/ml/systemtap/2018-q1/msg00069.html

[2] https://github.com/victorkamensky/openembedded-core

[3] https://github.com/victorkamensky/systemtap-oe-sysroot-manifest

[4] https://github.com/victorkamensky/systemtap-oe-sysroot-manifest/blob/master/EXAMPLES

Victor Kamensky (5):
  Revert "systemtap: Cross compilation fix"
  systemtap: support --sysroot option in variety of situations in cross
    build
  image: add IMAGE_GEN_COMBINED_DEBUGFS build option
  systemtap: introduce utils variant of systemtap package build
  crosstap2: wrapper to build systemtap script on host against given
    target

 meta/classes/image-prelink.bbclass                 |  13 +
 meta/classes/image.bbclass                         |  11 +-
 meta/lib/oe/rootfs.py                              |  59 +--
 .../systemtap/systemtap-utils_git.bb               |  31 ++
 ...-short-release-r-option-handling-in-case-.patch |  61 +++
 ...-short-release-r-option-handling-in-case-.patch |  68 ++++
 ...uginfo-lookup-with-sysroot-case-do-not-re.patch |  97 +++++
 ...ay-adding-sysroot-path-to-module-name-in-.patch | 124 ++++++
 ...dle-symbolic-links-with-absolute-name-rel.patch | 159 ++++++++
 ...p_umodule_relocate-needs-receive-target-f.patch |  58 +++
 .../systemtap/systemtap/system_map_location.patch  |  23 --
 meta/recipes-kernel/systemtap/systemtap_git.inc    |   7 +-
 scripts/crosstap2                                  | 422 +++++++++++++++++++++
 13 files changed, 1081 insertions(+), 52 deletions(-)
 create mode 100644 meta/recipes-kernel/systemtap/systemtap-utils_git.bb
 create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling-in-case-.patch
 create mode 100644 meta/recipes-kernel/systemtap/systemtap/0002-sysroot-fix-short-release-r-option-handling-in-case-.patch
 create mode 100644 meta/recipes-kernel/systemtap/systemtap/0003-sysroot-debuginfo-lookup-with-sysroot-case-do-not-re.patch
 create mode 100644 meta/recipes-kernel/systemtap/systemtap/0004-sysroot-delay-adding-sysroot-path-to-module-name-in-.patch
 create mode 100644 meta/recipes-kernel/systemtap/systemtap/0005-sysroot-handle-symbolic-links-with-absolute-name-rel.patch
 create mode 100644 meta/recipes-kernel/systemtap/systemtap/0006-sysroot-_stp_umodule_relocate-needs-receive-target-f.patch
 delete mode 100644 meta/recipes-kernel/systemtap/systemtap/system_map_location.patch
 create mode 100755 scripts/crosstap2

-- 
2.7.4




More information about the Openembedded-core mailing list