diff mbox series

package/systemtap: new package

Message ID 20200609231257.275131-1-ralphs@netwinder.org
State Changes Requested
Headers show
Series package/systemtap: new package | expand

Commit Message

Ralph Siemsen June 9, 2020, 11:12 p.m. UTC
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

Comments

Thomas Petazzoni Sept. 12, 2020, 12:35 p.m. UTC | #1
Hello Ralph,

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

On Tue,  9 Jun 2020 19:12:57 -0400
Ralph Siemsen <ralphs@netwinder.org> 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.

>  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.

> diff --git a/package/systemtap/Config.in b/package/systemtap/Config.in
> new file mode 100644
> index 0000000000..9194b86caf
> --- /dev/null
> +++ b/package/systemtap/Config.in
> @@ -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)

> diff --git a/package/systemtap/systemtap.mk b/package/systemtap/systemtap.mk
> new file mode 100644
> index 0000000000..d9228f25ca
> --- /dev/null
> +++ b/package/systemtap/systemtap.mk
> @@ -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.

> +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

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).

> +# 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
Ralph Siemsen Sept. 12, 2020, 1:31 p.m. UTC | #2
Hi Thomas,

On Sat, Sep 12, 2020 at 02:35:13PM +0200, Thomas Petazzoni wrote:
>
>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
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index c328d9f153..90b1b1b730 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/systemtap/Config.in b/package/systemtap/Config.in
new file mode 100644
index 0000000000..9194b86caf
--- /dev/null
+++ b/package/systemtap/Config.in
@@ -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/
diff --git a/package/systemtap/systemtap.mk b/package/systemtap/systemtap.mk
new file mode 100644
index 0000000000..d9228f25ca
--- /dev/null
+++ b/package/systemtap/systemtap.mk
@@ -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))