Skip to contentSkip to conversation

package/systemtap: new package

PATCH New Ralph Siemsen 2 participants 3 messages Jun 9, 2020 – Sep 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/systemtap: new package

SystemTap provides a simple command line interface and scripting language for writing instrumentation for a live running kernel plus user-space applications.

This is a minimal implementation; not all supported features of systemtap are enabled.
---
Note that I am not a systemtap expert, in fact, I only got involved helping someone else get this to build under buildroot. Hence YMMV. Yann requested that I post this patch to the list, so here we are.

 package/Config.in              |  1 +
 package/systemtap/Config.in    | 10 ++++++++++
 package/systemtap/systemtap.mk | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)
 create mode 100644 package/systemtap/Config.in
 create mode 100644 package/systemtap/systemtap.mk
package/Config.in +1 -0
index c328d9f153..90b1b1b730 100644
@@ -135,6 +135,7 @@ menu "Debugging, profiling and benchmark"
 	source "package/stress-ng/Config.in"
 	source "package/sysdig/Config.in"
 	source "package/sysprof/Config.in"
+	source "package/systemtap/Config.in"
 	source "package/tcf-agent/Config.in"
 	source "package/tinymembench/Config.in"
 	source "package/trace-cmd/Config.in"
package/systemtap/Config.in new file +10 -0
new file mode 100644
index 0000000000..9194b86caf
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_SYSTEMTAP
+	bool "systemtap"
+	select BR2_PACKAGE_ELFUTILS # -ldw
+	select BR2_PACKAGE_PYTHON3
+	help
+	  SystemTap provides a simple command line interface and scripting
+	  language for writing instrumentation for a live running kernel
+	  plus user-space applications.
+
+	  https://sourceware.org/systemtap/
package/systemtap/systemtap.mk new file +32 -0
new file mode 100644
index 0000000000..d9228f25ca
@@ -0,0 +1,32 @@
+################################################################################
+#
+# systemtap
+#
+################################################################################
+
+SYSTEMTAP_VERSION= release-4.2
+SYSTEMTAP_SITE = https://sourceware.org/git/systemtap.git
+SYSTEMTAP_SITE_METHOD = git
+SYSTEMTAP_DEPENDENCIES = elfutils python3
+
+# Systemtap includes cpython support. To cross-compile this
+# seems to require setting _PYTHON_SYSCONFIGDATA_NAME. The
+# following was adapted from package/pkg-python.mk
+
+SYSTEMTAP_MAKE_ENV = \
+        PATH=$(BR_PATH) \
+        $(TARGET_CONFIGURE_OPTS) \
+        LDSHARED="$(TARGET_CROSS)gcc -shared" \
+        PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+        PYTHONNOUSERSITE=1 \
+	_PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
+        _python_sysroot=$(STAGING_DIR) \
+        _python_prefix=/usr \
+        _python_exec_prefix=/usr
+
+# Note that systemtap has additional optional dependencies,
+# such as libvirt and xml for vir support, java support, and
+# avahi and nss for compile server support. These are not
+# currently handled by this build script.
+
+$(eval $(autotools-package))
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 package/systemtap: new package

Hello Ralph,

Thanks a lot for posting this! I think it would be useful to have systemtap support in Buildroot.

Quoted 6 lines · On Tue, 9 Jun 2020 19:12:57 -0400 Ralph Siemsen <[email protected]> wrote:

SystemTap provides a simple command line interface and scripting language for writing instrumentation for a live running kernel plus user-space applications.

This is a minimal implementation; not all supported features of systemtap are enabled.

We need your Signed-off-by line on the patch, otherwise we can't apply it.

Quoted 4 lines
 package/Config.in              |  1 +
 package/systemtap/Config.in    | 10 ++++++++++
 package/systemtap/systemtap.mk | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)

We will need an entry in the DEVELOPERS file for this new package.

package/systemtap/Config.in line 4

Quoted 10 lines
package/systemtap/Config.in new file +4 -0
new file mode 100644
index 0000000000..9194b86caf
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_SYSTEMTAP
+	bool "systemtap"
+	select BR2_PACKAGE_ELFUTILS # -ldw
+	select BR2_PACKAGE_PYTHON3

When you "select" options, you need to replicate the "depends on" of the options you're selecting. So in this case, you would need:

depends on !BR2_PACKAGE_PYTHON # python3
depends on BR2_USE_WCHAR # elfutils, python3
depends on BR2_USE_MMU # python3
depends on !BR2_STATIC_LIBS # elfutils, python3
depends on BR2_TOOLCHAIN_HAS_THREADS # python3
depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils

and then a Config.in comment:

comment "systemtap needs a glibc or uclibc toolchain w/ wchar, dynamic library, threads"

	depends on !BR2_PACKAGE_PYTHON
	depends on BR2_USE_MMU
	depends on BR2_STATIC_LIBS || !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
		!(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC)
Quoted 6 lines
package/systemtap/systemtap.mk new file +0 -0
new file mode 100644
index 0000000000..d9228f25ca

package/systemtap/systemtap.mk line 9

Quoted 9 lines
package/systemtap/systemtap.mk new file +9 -0
@@ -0,0 +1,32 @@
+################################################################################
+#
+# systemtap
+#
+################################################################################
+
+SYSTEMTAP_VERSION= release-4.2
+SYSTEMTAP_SITE = https://sourceware.org/git/systemtap.git
+SYSTEMTAP_SITE_METHOD = git

They have tarballs at https://sourceware.org/systemtap/ftp/releases/,
it probably makes sense to use them.

Quoted 6 lines
package/systemtap/systemtap.mk new file +6 -0
+SYSTEMTAP_DEPENDENCIES = elfutils python3
+
+# Systemtap includes cpython support. To cross-compile this
+# seems to require setting _PYTHON_SYSCONFIGDATA_NAME. The
+# following was adapted from package/pkg-python.mk
+

package/systemtap/systemtap.mk line 25

Quoted 10 lines
package/systemtap/systemtap.mk new file +10 -0
+SYSTEMTAP_MAKE_ENV = \
+        PATH=$(BR_PATH) \
+        $(TARGET_CONFIGURE_OPTS) \
+        LDSHARED="$(TARGET_CROSS)gcc -shared" \
+        PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+        PYTHONNOUSERSITE=1 \
+	_PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
+        _python_sysroot=$(STAGING_DIR) \
+        _python_prefix=/usr \
+        _python_exec_prefix=/usr

I think you could directly re-use PKG_PYTHON_DISTUTILS_ENV:

SYSTEMTAP_MAKE_ENV = $(PKG_PYTHON_DISTUTILS_ENV)

We're already using PKG_PYTHON_DISTUTILS_ENV in a number of packages (i2c-tools, libselinux, libpwquality, opencv3).

package/systemtap/systemtap.mk line 30

Quoted 4 lines
package/systemtap/systemtap.mk new file +4 -0
+# Note that systemtap has additional optional dependencies,
+# such as libvirt and xml for vir support, java support, and
+# avahi and nss for compile server support. These are not
+# currently handled by this build script.

Do these optional dependencies have ./configure options? If so, they should be explicitly disabled:

SYSTEMTAP_CONF_OPTS = \
	--disable-foo \
	--disable-bar

Do you think you could rework the patch to address the above issues, and send an updated version ?

Thanks a lot,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/systemtap: new package

Hi Thomas,

Quoted 3 lines · Thomas Petazzoni

Thanks a lot for posting this! I think it would be useful to have systemtap support in Buildroot.

Thanks for reviewing. I had pretty much forgotten all about this, it was done several months ago.

I'll try making the suggested changes, and send an updated patch. This make take a few weeks as I'm rather busy with other stuff currently.

As far as adding myself to MAINTAINERS, for systemtap I am not really comfortable with that -- I don't actually use this package, I just helped out someone else (on IRC) that was having trouble getting it to build. If I started getting bugs/questions about systemtap from other users, I doubt I would be able to help, beyond what google says...

Regards,
Ralph