Skip to contentSkip to conversation

package/linux-tools: add tmon

PATCH New Markus Mayer 3 participants 6 messages Jul 18, 2017 – Jul 19, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/linux-tools: add tmon

Add the tmon package to linux-tools.

---

This patch assumes that
http://lists.busybox.net/pipermail/buildroot/2017-July/198216.html has already been applied with the tweak mentioned in
http://lists.busybox.net/pipermail/buildroot/2017-July/198218.html

 package/linux-tools/Config.in             |  7 +++++++
 package/linux-tools/linux-tool-tmon.mk.in | 30 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-tmon.mk.in
package/linux-tools/Config.in +7 -0
index 9d5bf7a..a7f8056 100644
@@ -77,4 +77,11 @@ comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS"
 	depends on BR2_USE_MMU
 	depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 
+config BR2_PACKAGE_LINUX_TOOLS_TMON
+	bool "tmon"
+	select BR2_PACKAGE_LINUX_TOOLS
+	help
+	  tmon is a terminal-based tool (using curses) that allows access
+	  thermal information about the system.
+
 endmenu
package/linux-tools/linux-tool-tmon.mk.in new file +30 -0
new file mode 100644
index 0000000..1330ea6
@@ -0,0 +1,30 @@
+################################################################################
+#
+# tmon
+#
+################################################################################
+
+LINUX_TOOLS += tmon
+
+TMON_DEPENDENCIES = ncurses
+TMON_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+	CC=$(TARGET_CC) \
+	PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+
+define TMON_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/thermal/tmon/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have the tmon tool." ; \
+		echo "At least kernel 3.13 must be used." ; \
+		exit 1 ; \
+	fi
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		$(TMON_MAKE_OPTS) \
+		tmon
+endef
+
+define TMON_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		$(TMON_MAKE_OPTS) \
+		INSTALL_ROOT=$(TARGET_DIR) \
+		tmon_install
+endef
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/linux-tools: add tmon

Sorry, I made some tweaks after sending this out. I won't re-send now and will wait for additional comments before sending the updated revision. For now, I'll just mention what I changed.

Quoted 1 line · Markus Mayer

Add the tmon package to linux-tools.

Changed to

Add the tmon kernel tool to linux-tools.

Since "tmon" isn't a package. linux-tools is the package.

Quoted 18 lines

---

This patch assumes that
http://lists.busybox.net/pipermail/buildroot/2017-July/198216.html has already been applied with the tweak mentioned in
http://lists.busybox.net/pipermail/buildroot/2017-July/198218.html

 package/linux-tools/Config.in             |  7 +++++++
 package/linux-tools/linux-tool-tmon.mk.in | 30 ++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 package/linux-tools/linux-tool-tmon.mk.in
package/linux-tools/Config.in +0 -0
index 9d5bf7a..a7f8056 100644

package/linux-tools/Config.in comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" · line 85

Quoted 9 lines
package/linux-tools/Config.in +6 -0
@@ -77,4 +77,11 @@ comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS"
        depends on BR2_USE_MMU
        depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 
+config BR2_PACKAGE_LINUX_TOOLS_TMON
+       bool "tmon"
+       select BR2_PACKAGE_LINUX_TOOLS
+       help
+         tmon is a terminal-based tool (using curses) that allows access
+         thermal information about the system.

Changed to:

tmon is a terminal-based tool (using curses) that allows the user to access thermal information about the system.

Quoted 40 lines
package/linux-tools/Config.in +0 -0
 endmenu
package/linux-tools/linux-tool-tmon.mk.in new file +30 -1
new file mode 100644
index 0000000..1330ea6
@@ -0,0 +1,30 @@
+################################################################################
+#
+# tmon
+#
+################################################################################
+
+LINUX_TOOLS += tmon
+
+TMON_DEPENDENCIES = ncurses
+TMON_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+       CC=$(TARGET_CC) \
+       PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+
+define TMON_BUILD_CMDS
+       $(Q)if ! grep install $(LINUX_DIR)/tools/thermal/tmon/Makefile >/dev/null 2>&1 ; then \
+               echo "Your kernel version is too old and does not have the tmon tool." ; \
+               echo "At least kernel 3.13 must be used." ; \
+               exit 1 ; \
+       fi
+       $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+               $(TMON_MAKE_OPTS) \
+               tmon
+endef
+
+define TMON_INSTALL_TARGET_CMDS
+       $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+               $(TMON_MAKE_OPTS) \
+               INSTALL_ROOT=$(TARGET_DIR) \
+               tmon_install
+endef
--

2.7.4

#2 lore raw

PATCH 1/1 package/linux-tools: add tmon

In reply to Markus Mayer

Hello,

Quoted 3 lines · Markus Mayer

Add the tmon package to linux-tools.

I've applied, but after doing a number of fixes. See below.

package/linux-tools/Config.in comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" · line 82

Quoted 11 lines
package/linux-tools/Config.in +3 -0
index 9d5bf7a..a7f8056 100644
@@ -77,4 +77,11 @@ comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS"
 	depends on BR2_USE_MMU
 	depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 
+config BR2_PACKAGE_LINUX_TOOLS_TMON
+	bool "tmon"
+	select BR2_PACKAGE_LINUX_TOOLS

select BR2_PACKAGE_NCURSES

was missing here. Without this, Buildroot does not even start the build because ncurses is in the dependencies of this package, but is not selected by anything in Buildroot.

package/linux-tools/Config.in comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" · line 85

Quoted 3 lines
package/linux-tools/Config.in +3 -0
+LINUX_TOOLS += tmon
+
+TMON_DEPENDENCIES = ncurses

I've added host-pkgconf in the dependencies, because pkg-config is used to find ncurses. Without this, it uses the host pkg-config, which returns results valid for host ncurses, but not for the target ncurses.

package/linux-tools/Config.in comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS"

Quoted 13 lines
package/linux-tools/Config.in +13 -0
+TMON_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+	CC=$(TARGET_CC) \
+	PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+
+define TMON_BUILD_CMDS
+	$(Q)if ! grep install $(LINUX_DIR)/tools/thermal/tmon/Makefile >/dev/null 2>&1 ; then \
+		echo "Your kernel version is too old and does not have the tmon tool." ; \
+		echo "At least kernel 3.13 must be used." ; \
+		exit 1 ; \
+	fi
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+		$(TMON_MAKE_OPTS) \
+		tmon

It failed to build for me, because the tmon Makefile forces -fstack-protector, which doesn't work with toolchains that lack SSP support. So I've added a small tweak that removes -fstack-protector from tmon's Makefile if the toolchain doesn't have SSP support.

What would be nice is to have a test case in our support/testing/ infrastructure to build all those Linux tools. Would you be willing to work on something like this ? :-)

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 package/linux-tools: add tmon

Quoted 8 lines · Thomas Petazzoni

Hello,

Quoted 3 lines · Markus Mayer

Add the tmon package to linux-tools.

I've applied, but after doing a number of fixes. See below.

Thanks for fixing everything up.

Quoted 14 lines

package/linux-tools/Config.in comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" · line 82

Quoted 11 lines
package/linux-tools/Config.in +3 -0
index 9d5bf7a..a7f8056 100644
@@ -77,4 +77,11 @@ comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS"
      depends on BR2_USE_MMU
      depends on !BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 
+config BR2_PACKAGE_LINUX_TOOLS_TMON
+     bool "tmon"
+     select BR2_PACKAGE_LINUX_TOOLS

select BR2_PACKAGE_NCURSES

Quoted 3 lines

was missing here. Without this, Buildroot does not even start the build because ncurses is in the dependencies of this package, but is not selected by anything in Buildroot.

Hm. Interesting. I never hit this problem. It probably means I had some other package turned on that depends on ncurses, so it was always turned on for me.

Quoted 7 lines

package/linux-tools/Config.in comment "selftests needs BR2_PACKAGE_BUSYBOX_SHOW_OTHERS" · line 85

Quoted 3 lines
package/linux-tools/Config.in +3 -0
+LINUX_TOOLS += tmon
+
+TMON_DEPENDENCIES = ncurses

I've added host-pkgconf in the dependencies, because pkg-config is used to find ncurses. Without this, it uses the host pkg-config, which returns results valid for host ncurses, but not for the target ncurses.

This makes sense.

A side note, it *was* actually working for me with the host's pkg-config due to the makefile passing in PKG_CONFIG_PATH. This makes the host's pkg-config look at the target's config database, therefore making it return the right thing (until the day it doesn't). I was never fond of this solution (it's a pretty ugly hack), but I didn't know there was a better way.

The new approach seems much more sane.

Quoted 10 lines
Quoted 10 lines
package/linux-tools/Config.in +10 -0
+TMON_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
+     CC=$(TARGET_CC) \
+     PKG_CONFIG_PATH=$(STAGING_DIR)/usr/lib/pkgconfig
+
+define TMON_BUILD_CMDS
+     $(Q)if ! grep install $(LINUX_DIR)/tools/thermal/tmon/Makefile >/dev/null 2>&1 ; then \
+             echo "Your kernel version is too old and does not have the tmon tool." ; \
+             echo "At least kernel 3.13 must be used." ; \
+             exit 1 ; \
+     fi
Quoted 8 lines

package/linux-tools/Config.in

Quoted 3 lines
package/linux-tools/Config.in +3 -0
+     $(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools \
+             $(TMON_MAKE_OPTS) \
+             tmon

It failed to build for me, because the tmon Makefile forces -fstack-protector, which doesn't work with toolchains that lack SSP support. So I've added a small tweak that removes -fstack-protector from tmon's Makefile if the toolchain doesn't have SSP support.

Yikes! Having to support multiple different toolchains can lead to some good fun. Yeah, I kind of took the easy route of just trying a single one. Sorry.

Quoted 3 lines

What would be nice is to have a test case in our support/testing/ infrastructure to build all those Linux tools. Would you be willing to work on something like this ? :-)

That does sound like a good thing to have. I'll take a look.

Regards,
-Markus

#4 lore raw

PATCH 1/1 package/linux-tools: add tmon

Quoted 7 lines · Markus Mayer
Quoted 4 lines

It failed to build for me, because the tmon Makefile forces -fstack-protector, which doesn't work with toolchains that lack SSP support. So I've added a small tweak that removes -fstack-protector from tmon's Makefile if the toolchain doesn't have SSP support.

Yikes! Having to support multiple different toolchains can lead to some good fun. Yeah, I kind of took the easy route of just trying a single one. Sorry.

That's why we have utils/test-pkg. For things with a kernel dependency it's a
bit more complicated to set up (you need a different kernel config for different toolchains, and BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG is not available for all arches and takes a loooooong time for x86_64). But with e.g. just one for ARM you already get pretty far.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/1 package/linux-tools: add tmon

Hello,

Quoted 5 lines · Arnout Vandecappelle

That's why we have utils/test-pkg. For things with a kernel dependency it's a
bit more complicated to set up (you need a different kernel config for different toolchains, and BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG is not available for all arches and takes a loooooong time for x86_64). But with e.g. just one for ARM you already get pretty far.

Yeah, I really wouldn't put the blame on a contributor for not having used test-pkg on a package like linux-tools that is really not simple to test with test-pkg.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com