Add linux-tool-tmon
cover Add linux-tool-tmon
From: Markus Mayer <[email protected]>
Linux includes a tool for thermal monitoring (linux/tools/thermal/tmon). This series enables building this tool alongside other userspace tools bundled with the Linux kernel (known in buildroot as linux-tools).
In order to add linux-tool-tmon, we need to first stop relying on alphabetical sorting of the linux-tool*.mk files.
Currently, the build system relies on linux-tool-*.mk files (i.e. the sub-makefiles) to be sorted alphabetically such that linux-tools.mk (the main makefile for linux-tools) will come last, therefore ensuring that the sub-makefiles are included before the main makefile. So far, this assumption has held true. Unfortunately, linux-tool-tmon.mk breaks it. Sorted in the C locale, linux-tool-tmon.mk comes after linux-tools.mk.
To ensure that the inclusion order remains correct, the logic to include the linux-tool*mk has been modified.
Markus Mayer (2):
Makefile: don't rely on linux-tools being sorted alphabetically package/linux-tools: add tmon
Makefile | 6 +++++- package/linux-tools/Config.in | 7 +++++++ package/linux-tools/linux-tool-tmon.mk | 30 ++++++++++++++++++++++++++++++ package/linux-tools/linux-tools.mk | 8 +++----- 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 package/linux-tools/linux-tool-tmon.mk
Signature · 1 line
2.13.0
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
From: Markus Mayer <[email protected]>
The Linux tools master makefile (linux-tools.mk) must be included after all Linux tools sub-makefiles (linux-tool-*.mk). This is currently ensured by sorting all package makefiles alphabetically.
In preparation for adding linux-tool-tmon, we cannot keep relying on this mechanism. In the C locale, linux-tool-tmon.mk will be sorted behind linux-tools.mk, which would break the build.
Therefore, we ensure that linux-tools.mk always comes after linux-tool-*.mk by explicitly including it after the other package makefiles.
--- Makefile | 6 +++++- package/linux-tools/linux-tools.mk | 8 +++----- 2 files changed, 8 insertions(+), 6 deletions(-)
Makefile +5 -1
@@ -495,7 +495,11 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) -include $(PACKAGE_OVERRIDE_FILE) endif -include $(sort $(wildcard package/*/*.mk)) +# We need to insure that linux-tools.mk is included after all linux-tool-*.mk +# makefiles, and we can't rely on alphabetical sort order for this. +LINUX_TOOLS_MK = package/linux-tools/linux-tools.mk +include $(sort $(filter-out $(LINUX_TOOLS_MK),$(wildcard package/*/*.mk))) +include $(LINUX_TOOLS_MK) include boot/common.mk include linux/linux.mk
package/linux-tools/linux-tools.mk +3 -5
@@ -14,11 +14,9 @@ # to guarantee that each tool has a chance to register itself before we build # the list of build and install hooks, below. # -# This is currently guaranteed by the naming of each file: -# - they get included by the top-level Makefile, with $(sort $(wildcard ...)) -# - make's $(sort) function will aways sort in the C locale -# - the files names correctly sort out in the C locale so that each tool's -# .mk file is included before this one. +# This is ensured by the main buildroot makefile, which explicitly includes +# linux-tools.mk after all linux-tool*.mk makefiles. Look for LINUX_TOOLS_MK +# in the top-level makefile to see where this is happening. # We only need the kernel to be extracted, not actually built LINUX_TOOLS_PATCH_DEPENDENCIES = linux
Signature · 1 line
2.13.0
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Markus, all,
On 2017-07-04 16:54 -0700, Markus Mayer spake thusly:
Quoted 9 lines
From: Markus Mayer <[email protected]>
The Linux tools master makefile (linux-tools.mk) must be included after all Linux tools sub-makefiles (linux-tool-*.mk). This is currently ensured by sorting all package makefiles alphabetically.
In preparation for adding linux-tool-tmon, we cannot keep relying on this mechanism. In the C locale, linux-tool-tmon.mk will be sorted behind linux-tools.mk, which would break the build.
That is not the case for me:
$ touch package/linux-tools/linux-tool-tmon.mk
$ LC_ALL=C ls -lh package/linux-tools/
total 28K
-rw-r--r-- 1 ymorin ymorin 2.8K Jul 3 23:55 Config.in
-rw-r--r-- 1 ymorin ymorin 1.1K Jul 3 23:55 linux-tool-cpupower.mk
-rw-r--r-- 1 ymorin ymorin 721 Jul 3 23:55 linux-tool-gpio.mk
-rw-r--r-- 1 ymorin ymorin 730 Jul 3 23:55 linux-tool-iio.mk
-rw-r--r-- 1 ymorin ymorin 4.0K Jul 3 23:55 linux-tool-perf.mk
-rw-r--r-- 1 ymorin ymorin 1.5K Jul 3 23:55 linux-tool-selftests.mk
-rw-r--r-- 1 ymorin ymorin 0 Jul 5 09:17 linux-tool-tmon.mk
-rw-r--r-- 1 ymorin ymorin 2.0K Jul 3 23:55 linux-tools.mkHowever, I am totally in favour of fixing it once and for all.
But rather than do a hack in the main Makefile as you suggest, I would just ensure the ordering of the files.
I think we should just rneame the individual tool files to remove the .mk extension, and then exp[licitly source them from package/linux-tools/linux-tools.mk
include $(wildcard package/linux-tools/linux-tool-*)
and be done with that once and for all.
Regards,
Yann E. MORIN.
Quoted 53 lines
Therefore, we ensure that linux-tools.mk always comes after linux-tool-*.mk by explicitly including it after the other package makefiles.
Signed-off-by Markus Mayer <[email protected]>--- Makefile | 6 +++++- package/linux-tools/linux-tools.mk | 8 +++----- 2 files changed, 8 insertions(+), 6 deletions(-)Makefile +5
-1@@ -495,7 +495,11 @@ ifneq ($(PACKAGE_OVERRIDE_FILE),) -include $(PACKAGE_OVERRIDE_FILE) endif -include $(sort $(wildcard package/*/*.mk)) +# We need to insure that linux-tools.mk is included after all linux-tool-*.mk +# makefiles, and we can't rely on alphabetical sort order for this. +LINUX_TOOLS_MK = package/linux-tools/linux-tools.mk +include $(sort $(filter-out $(LINUX_TOOLS_MK),$(wildcard package/*/*.mk))) +include $(LINUX_TOOLS_MK) include boot/common.mk include linux/linux.mkpackage/linux-tools/linux-tools.mk +3
-5@@ -14,11 +14,9 @@ # to guarantee that each tool has a chance to register itself before we build # the list of build and install hooks, below. # -# This is currently guaranteed by the naming of each file: -# - they get included by the top-level Makefile, with $(sort $(wildcard ...)) -# - make's $(sort) function will aways sort in the C locale -# - the files names correctly sort out in the C locale so that each tool's -# .mk file is included before this one. +# This is ensured by the main buildroot makefile, which explicitly includes +# linux-tools.mk after all linux-tool*.mk makefiles. Look for LINUX_TOOLS_MK +# in the top-level makefile to see where this is happening. # We only need the kernel to be extracted, not actually built LINUX_TOOLS_PATCH_DEPENDENCIES = linuxSignature · 6 lines
2.13.0 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Markus, All,
On 2017-07-05 09:25 +0200, Yann E. MORIN spake thusly:
Quoted 10 lines
On 2017-07-04 16:54 -0700, Markus Mayer spake thusly:
Quoted 9 lines
From: Markus Mayer <[email protected]>
The Linux tools master makefile (linux-tools.mk) must be included after all Linux tools sub-makefiles (linux-tool-*.mk). This is currently ensured by sorting all package makefiles alphabetically.
In preparation for adding linux-tool-tmon, we cannot keep relying on this mechanism. In the C locale, linux-tool-tmon.mk will be sorted behind linux-tools.mk, which would break the build.
[--SNIP--]
Quoted 5 lines
However, I am totally in favour of fixing it once and for all.
But rather than do a hack in the main
Makefileas you suggest, I would just ensure the ordering of the files.
Quoted 7 lines
I think we should just rneame the individual tool files to remove the .mk extension, and then exp[licitly source them from
package/linux-tools/linux-tools.mkinclude $(wildcard package/linux-tools/linux-tool-*)and be done with that once and for all.
But don't hurry in doing so, we've been discussing this IRL with Thomas, and he is not happy with that proposal (but he agrees that touching the main Makefile is not acceptable).
We're looking to find an alternative solution...
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 25 lines · Yann E. MORIN
Markus, All,
On 2017-07-05 09:25 +0200, Yann E. MORIN spake thusly:
Quoted 10 lines
On 2017-07-04 16:54 -0700, Markus Mayer spake thusly:
Quoted 9 lines
From: Markus Mayer <[email protected]>
The Linux tools master makefile (linux-tools.mk) must be included after all Linux tools sub-makefiles (linux-tool-*.mk). This is currently ensured by sorting all package makefiles alphabetically.
In preparation for adding linux-tool-tmon, we cannot keep relying on this mechanism. In the C locale, linux-tool-tmon.mk will be sorted behind linux-tools.mk, which would break the build.
[--SNIP--]
Quoted 11 lines
However, I am totally in favour of fixing it once and for all.
But rather than do a hack in the main
Makefileas you suggest, I would just ensure the ordering of the files.I think we should just rneame the individual tool files to remove the .mk extension, and then exp[licitly source them from
package/linux-tools/linux-tools.mkinclude $(wildcard package/linux-tools/linux-tool-*)
Quoted 7 lines
Quoted 1 line
and be done with that once and for all.
But don't hurry in doing so, we've been discussing this IRL with Thomas, and he is not happy with that proposal (but he agrees that touching the main
Makefileis not acceptable).We're looking to find an alternative solution...
The proposal is to move all the linux-tool-*.mk files to subdirectories of
package/linux-tools, and include them from the linux-tool.mk file at the appropriate place. This is more in-line with how we do it for other packages, e.g. qt5 or barebox. Ideally, the Config.in would also be split up into the individual subpackages.
Could you prepare a patch for that?
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
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
In reply to Yann E. MORINQuoted 5 lines · Yann E. MORIN
Markus, all,
On 2017-07-04 16:54 -0700, Markus Mayer spake thusly:
Quoted 2 lines
From: Markus Mayer <[email protected]>
Quoted 8 lines
Quoted 7 lines
The Linux tools master makefile (linux-tools.mk) must be included after all Linux tools sub-makefiles (linux-tool-*.mk). This is currently ensured by sorting all package makefiles alphabetically.
In preparation for adding linux-tool-tmon, we cannot keep relying on this mechanism. In the C locale, linux-tool-tmon.mk will be sorted behind linux-tools.mk, which would break the build.
That is not the case for me:
Indeed, but it's just the commit message that is wrong. The sort is not done by
the sort program, but by make, and make doesn't get the LC_ALL=C passed to it. So we indeed need to find a robust solution.
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
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 12 lines · Arnout Vandecappelle
Quoted 9 lines · Yann E. MORIN
Markus, all,
On 2017-07-04 16:54 -0700, Markus Mayer spake thusly:
Quoted 6 lines
From: Markus Mayer <[email protected]>
The Linux tools master makefile (linux-tools.mk) must be included after all Linux tools sub-makefiles (linux-tool-*.mk). This is currently ensured by sorting all package makefiles alphabetically.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
In preparation for adding linux-tool-tmon, we cannot keep relying on this mechanism. In the C locale, linux-tool-tmon.mk will be sorted behind linux-tools.mk, which would break the build.
That is not the case for me:
Indeed, but it's just the commit message that is wrong. The sort is not done by
the sort program, but by make, and make doesn't get the LC_ALL=C passed to it. So we indeed need to find a robust solution.
Hm, Yann tells me that make always uses the C locale for sorting. So why does
it fail for you? The C locale for sure sorts correctly.
Also, the only thing that is sensitive to the order in this case isLINUX_TOOLS_DEPENDENCIES. So you would miss the dependency on ncurses if it is in the wrong order. Is that what happens for you? Could you tell us what error you get?
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
A message that is not in the archive (sent off-list or not yet received): CAGt4E5ueb6x_S4ff=dAeK-x9JnO1SmhnUGz+Q3XKUtj6s24L_Q@mail.gmail.com
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 36 lines · Markus Mayer
I got the error, "Your kernel version is too old and does not have the tmon tool.", because it tried building linux-tool-tmon before extracting the kernel. Running make a second time succeed, because it extracted the kernel right away. This was an Ubuntu box running 16.04.
I will try again to see if I can still reproduce it.
Also, I did figure out why it is sorted differently by "ls". The locale is set to en_CA.UTF-8. I thought I had reset the locale. Apparently not.
$ echo $LANG en_CA.UTF-8$ ls -l total 32(quoted diff) +0
-8-rw-rw-r-- 1 mmayer mmayer 2965 Jul 4 11:13 Config.in -rw-rw-r-- 1 mmayer mmayer 1084 May 9 10:46 linux-tool-cpupower.mk -rw-rw-r-- 1 mmayer mmayer 721 May 9 10:46 linux-tool-gpio.mk -rw-rw-r-- 1 mmayer mmayer 730 May 9 10:46 linux-tool-iio.mk -rw-rw-r-- 1 mmayer mmayer 4015 May 9 10:46 linux-tool-perf.mk -rw-rw-r-- 1 mmayer mmayer 1469 May 9 10:46 linux-tool-selftests.mk -rw-rw-r-- 1 mmayer mmayer 1861 Jul 4 11:13 linux-tools.mk -rw-rw-r-- 1 mmayer mmayer 832 Jul 4 11:13 linux-tool-tmon.mk$ LANG=C ls -l total 32(quoted diff) +0
-8-rw-rw-r-- 1 mmayer mmayer 2965 Jul 4 11:13 Config.in -rw-rw-r-- 1 mmayer mmayer 1084 May 9 10:46 linux-tool-cpupower.mk -rw-rw-r-- 1 mmayer mmayer 721 May 9 10:46 linux-tool-gpio.mk -rw-rw-r-- 1 mmayer mmayer 730 May 9 10:46 linux-tool-iio.mk -rw-rw-r-- 1 mmayer mmayer 4015 May 9 10:46 linux-tool-perf.mk -rw-rw-r-- 1 mmayer mmayer 1469 May 9 10:46 linux-tool-selftests.mk -rw-rw-r-- 1 mmayer mmayer 832 Jul 4 11:13 linux-tool-tmon.mk -rw-rw-r-- 1 mmayer mmayer 1861 Jul 4 11:13 linux-tools.mk
Quoted 1 line
I'll experiment more with this and see what I can find out.
Looks like the build is actually succeeding for me now. Not sure what happened originally when it bailed the way it did. My build must have been in a weird state. My apologies for the false alarm. I successfully built arm and arm64.
This means, we don't need patch 1/2 after all.
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
Regards,
-Markus
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 4 lines · Markus Mayer
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
If you're willing to upgrade from newbie to contributor, feel free to send a
patch that does exactly this!
When you do, don't forget to updatedocs/manual/adding-packages-linux-kernel-spec-infra.txt as well.
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
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 8 lines · Arnout Vandecappelle
Quoted 4 lines · Markus Mayer
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
Quoted 6 lines
If you're willing to upgrade from newbie to contributor, feel free to send a
patch that does exactly this!When you do, don't forget to update
docs/manual/adding-packages-linux-kernel-spec-infra.txtas well.
Sounds good. Will do. :-)
-Markus
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
In reply to Markus MayerMarkus, All,
On 2017-07-05 10:19 -0700, Markus Mayer spake thusly:
[--SNIP--]
Quoted 4 lines
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
To be sure we're on the same line: one single sub-directory with all tools in there, not one sub-dir per tool.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 11 lines · Yann E. MORIN
Markus, All,
On 2017-07-05 10:19 -0700, Markus Mayer spake thusly:
[--SNIP--]Quoted 4 lines
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
To be sure we're on the same line: one single sub-directory with all tools in there, not one sub-dir per tool.
Really? One sub-dir per tool would be more in-line with how we handle normal
packages.
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
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Arnout, All,
On 2017-07-09 13:10 +0200, Arnout Vandecappelle spake thusly:
Quoted 10 lines · Yann E. MORIN
Quoted 9 lines
Markus, All,
On 2017-07-05 10:19 -0700, Markus Mayer spake thusly:
[--SNIP--]Quoted 4 lines
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
Quoted 5 lines
Quoted 2 lines
To be sure we're on the same line: one single sub-directory with all tools in there, not one sub-dir per tool.
Really? One sub-dir per tool would be more in-line with how we handle normal
packages.
Well, I would find it a bit over-blown to have many sub-dirs with a single file (the .mk) in each.
Unless you also expected that the big Config.in file be split too?
I would argue against, because its fate is already a bit special: it is not sourced from package/Config.in but from linux/Config.in. and I would prefer we avoid a bit more complexity...
Regards,
Yann E. MORIN.
Quoted 10 lines
Regards,
ArnoutSignature · 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
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 19 lines · Yann E. MORIN
Arnout, All,
On 2017-07-09 13:10 +0200, Arnout Vandecappelle spake thusly:
Quoted 10 lines · Yann E. MORIN
Quoted 9 lines
Markus, All,
On 2017-07-05 10:19 -0700, Markus Mayer spake thusly:
[--SNIP--]Quoted 4 lines
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
Quoted 5 lines
Quoted 2 lines
To be sure we're on the same line: one single sub-directory with all tools in there, not one sub-dir per tool.
Really? One sub-dir per tool would be more in-line with how we handle normal
packages.
Quoted 8 lines
Well, I would find it a bit over-blown to have many sub-dirs with a single file (the .mk) in each.
Unless you also expected that the big Config.in file be split too?
I would argue against, because its fate is already a bit special: it is not sourced from package/Config.in but from linux/Config.in. and I would prefer we avoid a bit more complexity...
Yeah, I was wondering about that myself, actually. I do agree that several directories containing only one file each don't seem all that desirable. I'll see if I can get everything to work with just a single sub-directory.
Regards,
-Markus
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 25 lines · Markus Mayer
Quoted 24 lines · Yann E. MORIN
Arnout, All,
On 2017-07-09 13:10 +0200, Arnout Vandecappelle spake thusly:
Quoted 10 lines · Yann E. MORIN
Quoted 9 lines
Markus, All,
On 2017-07-05 10:19 -0700, Markus Mayer spake thusly:
[--SNIP--]Quoted 4 lines
That said, and while I am a complete buildroot newbie, I do like the suggestion of creating sub-directories for the tools and including the makefiles from linux-tools.mk rather than relying on alphabetical sorting.
Quoted 5 lines
Quoted 2 lines
To be sure we're on the same line: one single sub-directory with all tools in there, not one sub-dir per tool.
Really? One sub-dir per tool would be more in-line with how we handle normal
packages.Well, I would find it a bit over-blown to have many sub-dirs with a single file (the .mk) in each.
Unless you also expected that the big Config.in file be split too?
Quoted 8 lines
Quoted 3 lines
I would argue against, because its fate is already a bit special: it is not sourced from package/Config.in but from linux/Config.in. and I would prefer we avoid a bit more complexity...
Yeah, I was wondering about that myself, actually. I do agree that several directories containing only one file each don't seem all that desirable. I'll see if I can get everything to work with just a single sub-directory.
I think I may need some help. I started implementing the suggested solution, but I have run into some unexpected problems.
Specifically, if I move the linux-tool-*.mk files into their own sub-directory, all linux-tools related targets disappear. It won't build any linux-tools during a regular run of 'make' and it will actually say "No rule..." when explicitly asked to build linux-tools:
$ make linux-tools umask 0022 && make -C /home/mmayer/Development/buildroot O=/home/mmayer/Development/output/arm64/. linux-tools make[1]: *** No rule to make target 'linux-tools'. Stop. Makefile:16: recipe for target '_all' failed make: *** [_all] Error 2
Here's what I have done:
(mmayer at lbrmn-mmayer) ~/Development/buildroot$ l package/linux-tools/ total 84
drwxrwxr-x 3 mmayer mmayer 4096 Jul 13 11:38 .
drwxrwxr-x 1843 mmayer mmayer 65536 Jul 10 12:28 ..
-rw-rw-r-- 1 mmayer mmayer 2577 Jul 10 11:02 Config.in -rw-rw-r-- 1 mmayer mmayer 2049 Jul 13 11:20 linux-tools.mk drwxrwxr-x 2 mmayer mmayer 4096 Jul 13 11:20 tools
(mmayer at lbrmn-mmayer) ~/Development/buildroot$ l package/linux-tools/tools/ total 28
drwxrwxr-x 2 mmayer mmayer 4096 Jul 13 11:20 .
drwxrwxr-x 3 mmayer mmayer 4096 Jul 13 11:38 ..
-rw-rw-r-- 1 mmayer mmayer 1061 Jul 10 13:04 linux-tool-cpupower.mk -rw-rw-r-- 1 mmayer mmayer 753 Jul 10 15:27 linux-tool-gpio.mk -rw-rw-r-- 1 mmayer mmayer 730 Jul 10 13:04 linux-tool-iio.mk -rw-rw-r-- 1 mmayer mmayer 4015 Jul 10 13:04 linux-tool-perf.mk -rw-rw-r-- 1 mmayer mmayer 1469 Jul 10 13:04 linux-tool-selftests.mk
linux-tools.mk gains this new line at the very beginning:
include $(sort $(wildcard package/linux-tools/tools/*.mk))
This results in the aforementioned non-build of linux-tools. Though when I look at all the variables, they are set properly. LINUX_TOOLS, LINUX_TOOLS_DEPENDENCIES, etc. all have the proper values. Everything *looks* like it should work, but somehow the linux-tools targets do not exist, so it doesn't actually work.
I tried something else for test-purposes. If I don't put the linux-tool-*.mk into their separate sub-directory and, instead, simply change their extension (so they don't match the *.mk pattern in the main Makefile), it all starts to work perfectly.
$ l package/linux-tools/ total 104 drwxrwxr-x 3 mmayer mmayer 4096 Jul 13 11:46 . drwxrwxr-x 1843 mmayer mmayer 65536 Jul 10 12:28 .. -rw-rw-r-- 1 mmayer mmayer 2577 Jul 10 11:02 Config.in -rw-rw-r-- 1 mmayer mmayer 1061 Jul 10 13:04 linux-tool-cpupower.xmk -rw-rw-r-- 1 mmayer mmayer 753 Jul 10 15:27 linux-tool-gpio.xmk -rw-rw-r-- 1 mmayer mmayer 730 Jul 10 13:04 linux-tool-iio.xmk -rw-rw-r-- 1 mmayer mmayer 4015 Jul 10 13:04 linux-tool-perf.xmk -rw-rw-r-- 1 mmayer mmayer 1469 Jul 10 13:04 linux-tool-selftests.xmk -rw-rw-r-- 1 mmayer mmayer 2043 Jul 13 11:46 linux-tools.mk
$ grep ^include package/linux-tools/linux-tools.mk include $(sort $(wildcard package/linux-tools/*.xmk))
So, now, everything is at the package/linux-tools level again. The sub makefiles simply have the extension .xmk. This also ensures they don't get picked up by the main Makefile, but by linux-tools.mk. This setup works flawlessly.
As far as I can tell, it should make no difference if the sub-makefiles are being included from package/linux-tools or package/linux-tools/tools. All the make variables are being set to the same values in both cases. Somehow, however, it doesn't generate the proper target list in the sub-directory case, but does the right thing if it's all in the same directory.
Does anybody have any pointers as to why this might be and what to do about it?
Thanks,
-Markus
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Markus, All,
On 2017-07-13 13:16 -0700, Markus Mayer spake thusly:
[--SNIP--]
Quoted 23 lines
I think I may need some help. I started implementing the suggested solution, but I have run into some unexpected problems.
Specifically, if I move the linux-tool-*.mk files into their own sub-directory, all linux-tools related targets disappear. It won't build any linux-tools during a regular run of 'make' and it will actually say "No rule..." when explicitly asked to build linux-tools:
$ make linux-tools umask 0022 && make -C /home/mmayer/Development/buildroot O=/home/mmayer/Development/output/arm64/. linux-tools make[1]: *** No rule to make target 'linux-tools'. Stop. Makefile:16: recipe for target '_all' failed make: *** [_all] Error 2Here's what I have done:
(mmayer at lbrmn-mmayer) ~/Development/buildroot$ l package/linux-tools/ total 84
drwxrwxr-x 3 mmayer mmayer 4096 Jul 13 11:38 .
drwxrwxr-x 1843 mmayer mmayer 65536 Jul 10 12:28 ..(quoted diff) +0
-2-rw-rw-r-- 1 mmayer mmayer 2577 Jul 10 11:02 Config.in -rw-rw-r-- 1 mmayer mmayer 2049 Jul 13 11:20 linux-tools.mk
Quoted 1 line
drwxrwxr-x 2 mmayer mmayer 4096 Jul 13 11:20 tools
OK, I will attempt a wild gues here... Rename the 'tools' directory to 'linux-tools' and try again.
[--SNIP--]
Quoted 1 line
Does anybody have any pointers as to why this might be and what to do about it?
Yes, this is becasue the last line in package/linux-tools/linux-tools.mk is calling to the generic-package infrastructure.
In turn, that line will at some place evaluate the $(pkgname) macro. pkgname is defined as thus:
pkgname = $(lastword $(subst /, ,$(pkgdir)))
And in turn, pkgdir is defined as:
pkgdir = $(dir $(lastword $(MAKEFILE_LIST)))
So, what this does is get the filename of the last included makefile, keep the directopry part of it, and then extract the last component of that, to get the package name.
By moving the tools to a sub-directory named 'tools' make that the last makefile parsed is in that sub-directory by the time pkgname is called, and it then gets 'tools' instead of 'linux-tools'.
We have a similar situation in linux/linux.mk, see line 425 where we have an explanation about this:
423 # Include all our extensions.
424 #
425 # Note: our package infrastructure uses the full-path of the last-scanned 426 # Makefile to determine what package we're currently defining, using the 427 # last directory component in the path. As such, including other Makefile, 428 # like below, before we call one of the *-package macro is usally not 429 # working.
430 # However, since the files we include here are in the same directory as 431 # the current Makefile, we are OK. But this is a hard requirement: files 432 # included here *must* be in the same directory!
433 include $(sort $(wildcard linux/linux-ext-*.mk))
So I would argue against the sub-directory, but in favour of renaming the files.
Except that is not necessary, is it? IIRC, you confirmed that this was in fact not a problem, right?
So, rather than try to fix a problem that does not exist, using fragile heuristics, I would recommend we keep the status-quo.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 21 lines · Yann E. MORIN
Markus, All,
On 2017-07-13 13:16 -0700, Markus Mayer spake thusly:
[--SNIP--]Quoted 17 lines
I think I may need some help. I started implementing the suggested solution, but I have run into some unexpected problems.
Specifically, if I move the linux-tool-*.mk files into their own sub-directory, all linux-tools related targets disappear. It won't build any linux-tools during a regular run of 'make' and it will actually say "No rule..." when explicitly asked to build linux-tools:
$ make linux-tools umask 0022 && make -C /home/mmayer/Development/buildroot O=/home/mmayer/Development/output/arm64/. linux-tools make[1]: *** No rule to make target 'linux-tools'. Stop. Makefile:16: recipe for target '_all' failed make: *** [_all] Error 2Here's what I have done:
Quoted 10 lines
Quoted 7 lines
(mmayer at lbrmn-mmayer) ~/Development/buildroot$ l package/linux-tools/ total 84
drwxrwxr-x 3 mmayer mmayer 4096 Jul 13 11:38 .
drwxrwxr-x 1843 mmayer mmayer 65536 Jul 10 12:28 ..(quoted diff) +0
-2-rw-rw-r-- 1 mmayer mmayer 2577 Jul 10 11:02 Config.in -rw-rw-r-- 1 mmayer mmayer 2049 Jul 13 11:20 linux-tools.mkdrwxrwxr-x 2 mmayer mmayer 4096 Jul 13 11:20 tools
OK, I will attempt a wild gues here... Rename the 'tools' directory to 'linux-tools' and try again.
Your guess was spot-on. That was exactly it.
[...]
Quoted 15 lines
We have a similar situation in
linux/linux.mk, see line 425 where we have an explanation about this:423 # Include all our extensions.
424 #
425 # Note: our package infrastructure uses the full-path of the last-scanned 426 #Makefileto determine what package we're currently defining, using the 427 # last directory component in the path. As such, including otherMakefile, 428 # like below, before we call one of the *-package macro is usally not 429 # working.
430 # However, since the files we include here are in the same directory as 431 # the currentMakefile, we are OK. But this is a hard requirement: files 432 # included here *must* be in the same directory!
433 include $(sort $(wildcardlinux/linux-ext-*.mk))
Quoted 5 lines
So I would argue against the sub-directory, but in favour of renaming the files.
Except that is not necessary, is it? IIRC, you confirmed that this was in fact not a problem, right?
Yes, it is not a problem for linux-tool-tmon.mk. I originally thought it was.
Quoted 2 lines
So, rather than try to fix a problem that does not exist, using fragile heuristics, I would recommend we keep the status-quo.
It was my understanding that the alphabetical sorting of linux-tools has been considered to be not really all that desirable and that a "once and for all" solution that does away with this requirement would be welcomed. That's why I looked into these changes.
I'll leave the decision to the maintainers as to whether this should be changed (either using a sub-directory or an file extension other than .mk) or if it is preferable to keep the alphabetical sorting. My personal take is that relying on alphabetical sorting is more fragile than the alternate solution, but it is up to you guys.
Thanks,
-Markus
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Peter, Thomas, Arnout, All,
Your position on Markus' (non-)issue?
Do we keep the code as-is, or do we "fix" it so that it is not ambiguous?
I've checked, and make uses strcmp(3) internally, and strcmp() does not use locales at all; it just compares chars.
Regards,
Yann E. MORIN.
On 2017-07-13 16:59 -0700, Markus Mayer spake thusly:
Quoted 76 lines · Yann E. MORIN
Quoted 21 lines
Markus, All,
On 2017-07-13 13:16 -0700, Markus Mayer spake thusly:
[--SNIP--]Quoted 17 lines
I think I may need some help. I started implementing the suggested solution, but I have run into some unexpected problems.
Specifically, if I move the linux-tool-*.mk files into their own sub-directory, all linux-tools related targets disappear. It won't build any linux-tools during a regular run of 'make' and it will actually say "No rule..." when explicitly asked to build linux-tools:
$ make linux-tools umask 0022 && make -C /home/mmayer/Development/buildroot O=/home/mmayer/Development/output/arm64/. linux-tools make[1]: *** No rule to make target 'linux-tools'. Stop. Makefile:16: recipe for target '_all' failed make: *** [_all] Error 2Here's what I have done:
Quoted 10 lines
Quoted 7 lines
(mmayer at lbrmn-mmayer) ~/Development/buildroot$ l package/linux-tools/ total 84
drwxrwxr-x 3 mmayer mmayer 4096 Jul 13 11:38 .
drwxrwxr-x 1843 mmayer mmayer 65536 Jul 10 12:28 ..(quoted diff) +0
-2-rw-rw-r-- 1 mmayer mmayer 2577 Jul 10 11:02 Config.in -rw-rw-r-- 1 mmayer mmayer 2049 Jul 13 11:20 linux-tools.mkdrwxrwxr-x 2 mmayer mmayer 4096 Jul 13 11:20 tools
OK, I will attempt a wild gues here... Rename the 'tools' directory to 'linux-tools' and try again.
Your guess was spot-on. That was exactly it.
[...]
Quoted 15 lines
We have a similar situation in
linux/linux.mk, see line 425 where we have an explanation about this:423 # Include all our extensions.
424 #
425 # Note: our package infrastructure uses the full-path of the last-scanned 426 #Makefileto determine what package we're currently defining, using the 427 # last directory component in the path. As such, including otherMakefile, 428 # like below, before we call one of the *-package macro is usally not 429 # working.
430 # However, since the files we include here are in the same directory as 431 # the currentMakefile, we are OK. But this is a hard requirement: files 432 # included here *must* be in the same directory!
433 include $(sort $(wildcardlinux/linux-ext-*.mk))Quoted 5 lines
So I would argue against the sub-directory, but in favour of renaming the files.
Except that is not necessary, is it? IIRC, you confirmed that this was in fact not a problem, right?
Yes, it is not a problem for linux-tool-tmon.mk. I originally thought it was.
Quoted 2 lines
So, rather than try to fix a problem that does not exist, using fragile heuristics, I would recommend we keep the status-quo.
It was my understanding that the alphabetical sorting of linux-tools has been considered to be not really all that desirable and that a "once and for all" solution that does away with this requirement would be welcomed. That's why I looked into these changes.
I'll leave the decision to the maintainers as to whether this should be changed (either using a sub-directory or an file extension other than .mk) or if it is preferable to keep the alphabetical sorting. My personal take is that relying on alphabetical sorting is more fragile than the alternate solution, but it is up to you guys.
Thanks,
-Markus
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Hello,
Quoted 7 lines · Yann E. MORIN
Your position on Markus' (non-)issue?
Do we keep the code as-is, or do we "fix" it so that it is not ambiguous?
I've checked, and make uses strcmp(3) internally, and
strcmp()does not use locales at all; it just compares chars.
I don't have a very strong opinion on this. To me, it would be fine to have linux-tools.mk and then the per-tool files called linux-tool-<foo>.mk.in or something like that.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Thomas, Markus, All,
On 2017-07-17 09:37 +0200, Thomas Petazzoni spake thusly:
Quoted 7 lines · Yann E. MORIN
Quoted 6 lines
Your position on Markus' (non-)issue?
Do we keep the code as-is, or do we "fix" it so that it is not ambiguous?
Quoted 6 lines
Quoted 2 lines
I've checked, and make uses strcmp(3) internally, and
strcmp()does not use locales at all; it just compares chars.I don't have a very strong opinion on this. To me, it would be fine to have linux-tools.mk and then the per-tool files called linux-tool-<foo>.mk.in or something like that.
Markus, would you want to rework your patch accordingly? Thanks! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 Makefile: don't rely on linux-tools being sorted alphabetically
Quoted 10 lines · Yann E. MORIN
Thomas, Markus, All,
On 2017-07-17 09:37 +0200, Thomas Petazzoni spake thusly:
Quoted 7 lines · Yann E. MORIN
Quoted 6 lines
Your position on Markus' (non-)issue?
Do we keep the code as-is, or do we "fix" it so that it is not ambiguous?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I've checked, and make uses strcmp(3) internally, and
strcmp()does not use locales at all; it just compares chars.I don't have a very strong opinion on this. To me, it would be fine to have linux-tools.mk and then the per-tool files called linux-tool-<foo>.mk.in or something like that.
Markus, would you want to rework your patch accordingly? Thanks! :-)
Sure. Will do.
-Markus
PATCH 2/2 package/linux-tools: add tmon
In reply to Markus MayerFrom: Markus Mayer <[email protected]>
Add the tmon package to linux-tools.
--- package/linux-tools/Config.in | 7 +++++++ package/linux-tools/linux-tool-tmon.mk | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 package/linux-tools/linux-tool-tmon.mk
package/linux-tools/Config.in +7 -0
@@ -83,4 +83,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 new file +30 -0
@@ -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.13.0