All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure
@ 2015-07-14 17:35 Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 1/8] package/perf: if slang is enabled, depend on it Romain Naour
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

This patches series introduces a new infrastructure to build Linux tools
available in the kernel tree.

Currently, the only Linux tool packaged in Buildroot is Perf and it
is use the generic package infrastructure.

But before introduce this new infra, merge some patches for Perf.

- Fix Perf optional dependencies.
- Add the Linux tools core infra.
- Add a new Linux tool: cpupower.
- Migrate the perf package to the new Linux tool infra.
- Add the documentation about Linux tool infra and Linux extensions.

Thanks Yann and Arnout for your help and review.

Romain Naour (4):
  linux: add linux-tools infra
  linux-tools: add cpupower
  package/perf: migrate perf to use the new linux-tools infrastructure
  docs/manual: add documentation for linux-ext and linux-tools.

Steven Noonan (4):
  package/perf: if slang is enabled, depend on it
  package/perf: if numactl (libnuma) is enabled, depend on it
  package/perf: if libunwind is enabled, depend on it
  package/perf: use correct definition of ARCH on x86_64

 Config.in.legacy                                   |   7 +
 docs/manual/adding-packages-kernel-module.txt      |   1 +
 .../adding-packages-linux-kernel-spec-infra.txt    | 143 +++++++++++++++++++++
 docs/manual/adding-packages.txt                    |   2 +
 linux/Config.in                                    |   3 +
 package/perf/Config.in => linux/Config.tools.in    |  18 ++-
 linux/linux-tool-cpupower.mk                       |  39 ++++++
 package/perf/perf.mk => linux/linux-tool-perf.mk   |  43 +++++--
 linux/linux.mk                                     |  24 ++++
 package/Config.in                                  |   1 -
 10 files changed, 262 insertions(+), 19 deletions(-)
 create mode 100644 docs/manual/adding-packages-linux-kernel-spec-infra.txt
 rename package/perf/Config.in => linux/Config.tools.in (63%)
 create mode 100644 linux/linux-tool-cpupower.mk
 rename package/perf/perf.mk => linux/linux-tool-perf.mk (65%)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 1/8] package/perf: if slang is enabled, depend on it
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 2/8] package/perf: if numactl (libnuma) " Romain Naour
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

From: Steven Noonan <steven@uplinklabs.net>

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
[Romain:
  - fix coding style]
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
---
V5: new patch
---
 package/perf/perf.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/perf/perf.mk b/package/perf/perf.mk
index 36989fc..dee05c3 100644
--- a/package/perf/perf.mk
+++ b/package/perf/perf.mk
@@ -32,6 +32,10 @@ ifeq ($(BR2_arc),y)
 PERF_MAKE_FLAGS += NO_BACKTRACE=1
 endif
 
+ifeq ($(BR2_PACKAGE_SLANG),y)
+PERF_DEPENDENCIES += slang
+endif
+
 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
 PERF_DEPENDENCIES += elfutils
 else
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 2/8] package/perf: if numactl (libnuma) is enabled, depend on it
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 1/8] package/perf: if slang is enabled, depend on it Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 3/8] package/perf: if libunwind " Romain Naour
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

From: Steven Noonan <steven@uplinklabs.net>

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
[Romain:
  - fix coding style]
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
---
v5: new patch
---
 package/perf/perf.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/perf/perf.mk b/package/perf/perf.mk
index dee05c3..9fdce95 100644
--- a/package/perf/perf.mk
+++ b/package/perf/perf.mk
@@ -36,6 +36,10 @@ ifeq ($(BR2_PACKAGE_SLANG),y)
 PERF_DEPENDENCIES += slang
 endif
 
+ifeq ($(BR2_PACKAGE_NUMACTL),y)
+PERF_DEPENDENCIES += numactl
+endif
+
 ifeq ($(BR2_PACKAGE_ELFUTILS),y)
 PERF_DEPENDENCIES += elfutils
 else
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 3/8] package/perf: if libunwind is enabled, depend on it
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 1/8] package/perf: if slang is enabled, depend on it Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 2/8] package/perf: if numactl (libnuma) " Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 4/8] package/perf: use correct definition of ARCH on x86_64 Romain Naour
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

From: Steven Noonan <steven@uplinklabs.net>

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
[Romain:
  - fix coding style]
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
---
v5: new patch
---
 package/perf/perf.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/perf/perf.mk b/package/perf/perf.mk
index 9fdce95..42fbe24 100644
--- a/package/perf/perf.mk
+++ b/package/perf/perf.mk
@@ -36,6 +36,10 @@ ifeq ($(BR2_PACKAGE_SLANG),y)
 PERF_DEPENDENCIES += slang
 endif
 
+ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
+PERF_DEPENDENCIES += libunwind
+endif
+
 ifeq ($(BR2_PACKAGE_NUMACTL),y)
 PERF_DEPENDENCIES += numactl
 endif
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 4/8] package/perf: use correct definition of ARCH on x86_64
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
                   ` (2 preceding siblings ...)
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 3/8] package/perf: if libunwind " Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 5/8] linux: add linux-tools infra Romain Naour
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

From: Steven Noonan <steven@uplinklabs.net>

LINUX_MAKE_FLAGS defines ARCH=$(KERNEL_ARCH), and KERNEL_ARCH is x86_64 on
a 64-bit x86 kernel build. The perf Makefiles expect that the ARCH will be
"x86" on both 32-bit x86 and 64-bit x86.

I didn't experience issues with the Linux 3.14.x version of perf, but this
issue cropped up once I started building 3.19.x.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
[Romain:
  - fix coding style]
Reviewed-by: Romain Naour <romain.naour@openwide.fr>
---
v5: new patch
---
 package/perf/perf.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/perf/perf.mk b/package/perf/perf.mk
index 42fbe24..2bdd555 100644
--- a/package/perf/perf.mk
+++ b/package/perf/perf.mk
@@ -10,8 +10,15 @@ PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
 
 PERF_DEPENDENCIES = linux host-flex host-bison
 
+ifeq ($(KERNEL_ARCH),x86_64)
+PERF_ARCH=x86
+else
+PERF_ARCH=$(KERNEL_ARCH)
+endif
+
 PERF_MAKE_FLAGS = \
 	$(LINUX_MAKE_FLAGS) \
+	ARCH=$(PERF_ARCH) \
 	NO_LIBAUDIT=1 \
 	NO_NEWT=1 \
 	NO_GTK2=1 \
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 5/8] linux: add linux-tools infra
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
                   ` (3 preceding siblings ...)
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 4/8] package/perf: use correct definition of ARCH on x86_64 Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 6/8] linux-tools: add cpupower Romain Naour
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

This commit add an infrastructure to build linux kernel
tools available in the kernel sources.

Currently, the only linux kernel tool packaged in Buildroot
is perf and it's packaged as a separate generic package.
This is a problem for licence information raised in this
thread [1].

Since these tools require to build a Linux kernel, we can
use some hooks in linux package like we did for linux
extensions [2] and remove the perf package.

[1] http://lists.busybox.net/pipermail/buildroot/2015-May/128783.html
[2] http://lists.busybox.net/pipermail/buildroot/2015-March/121835.html

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v5: no change
v4: no change
v3: unconditionally set LINUX_INSTALL_STAGING to YES
v2: remove LINUX_TOOL prefix
---
 linux/linux.mk | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index 8c535f3..4c4b59a 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -313,6 +313,8 @@ define LINUX_INSTALL_TARGET_CMDS
 	$(LINUX_INSTALL_HOST_TOOLS)
 endef
 
+# Include all our externsions and tools definitions.
+#
 # Note: our package infrastructure uses the full-path of the last-scanned
 # Makefile to determine what package we're currently defining, using the
 # last directory component in the path. As such, including other Makefile,
@@ -322,6 +324,7 @@ endef
 # the current Makefile, we are OK. But this is a hard requirement: files
 # included here *must* be in the same directory!
 include $(sort $(wildcard linux/linux-ext-*.mk))
+include $(sort $(wildcard linux/linux-tool-*.mk))
 
 LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\
 	$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext)))
@@ -330,6 +333,27 @@ LINUX_PRE_PATCH_HOOKS += $(foreach ext,$(LINUX_EXTENSIONS),\
 	$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),\
 		$(call UPPERCASE,$(ext))_PREPARE_KERNEL))
 
+# Install Linux kernel tools in staging directory since some tools
+# may install shared libraries and headers (e.g. cpupower). The
+# kernel image is NOT installed in staging directory.
+LINUX_INSTALL_STAGING = YES
+
+LINUX_DEPENDENCIES += $(foreach tool,$(LINUX_TOOLS),\
+	$(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
+		$($(call UPPERCASE,$(tool))_DEPENDENCIES)))
+
+LINUX_POST_BUILD_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
+	$(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
+		$(call UPPERCASE,$(tool))_BUILD_CMDS))
+
+LINUX_POST_INSTALL_STAGING_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
+	$(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
+		$(call UPPERCASE,$(tool))_INSTALL_STAGING_CMDS))
+
+LINUX_POST_INSTALL_TARGET_HOOKS += $(foreach tool,$(LINUX_TOOLS),\
+	$(if $(BR2_LINUX_KERNEL_TOOL_$(call UPPERCASE,$(tool))),\
+		$(call UPPERCASE,$(tool))_INSTALL_TARGET_CMDS))
+
 # Checks to give errors that the user can understand
 ifeq ($(BR_BUILDING),y)
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 6/8] linux-tools: add cpupower
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
                   ` (4 preceding siblings ...)
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 5/8] linux: add linux-tools infra Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 7/8] package/perf: migrate perf to use the new linux-tools infrastructure Romain Naour
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

This patch is based on the patch send by James Knight:
http://lists.busybox.net/pipermail/buildroot/2015-May/128754.html

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Cc: James Knight <james.knight@rockwellcollins.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v5: no change
v4: no change
v3: Use CPUPOWER_MAKE_OPTS to factorize commun options
v2: remove LINUX_TOOL prefix
    use $(D) instead of $(LINUX_DIR)
    fix title style
---
 linux/Config.in              |  3 +++
 linux/Config.tools.in        | 11 +++++++++++
 linux/linux-tool-cpupower.mk | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+)
 create mode 100644 linux/Config.tools.in
 create mode 100644 linux/linux-tool-cpupower.mk

diff --git a/linux/Config.in b/linux/Config.in
index 8c86a1a..097cde5 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -364,6 +364,9 @@ config BR2_LINUX_KERNEL_INSTALL_TARGET
 # Linux extensions
 source "linux/Config.ext.in"
 
+# Linux tools
+source "linux/Config.tools.in"
+
 endif # BR2_LINUX_KERNEL
 
 endmenu
diff --git a/linux/Config.tools.in b/linux/Config.tools.in
new file mode 100644
index 0000000..008e68c
--- /dev/null
+++ b/linux/Config.tools.in
@@ -0,0 +1,11 @@
+menu "Linux Kernel Tools"
+
+config BR2_LINUX_KERNEL_TOOL_CPUPOWER
+	bool "cpupower"
+	depends on !BR2_bfin # pciutils
+	select BR2_PACKAGE_PCIUTILS
+	help
+	  cpupower is a collection of tools to examine and tune power
+	  saving related features of your processor.
+
+endmenu
diff --git a/linux/linux-tool-cpupower.mk b/linux/linux-tool-cpupower.mk
new file mode 100644
index 0000000..4551cda
--- /dev/null
+++ b/linux/linux-tool-cpupower.mk
@@ -0,0 +1,39 @@
+################################################################################
+#
+# cpupower
+#
+################################################################################
+
+LINUX_TOOLS += cpupower
+
+CPUPOWER_DEPENDENCIES = pciutils
+
+CPUPOWER_MAKE_OPTS = CROSS=$(TARGET_CROSS) \
+	CPUFREQ_BENCH=false \
+	DEBUG=false
+
+define CPUPOWER_BUILD_CMDS
+	$(Q)if test ! -f $(@D)/tools/power/cpupower/Makefile ; then \
+		echo "Your kernel version is too old and does not have the cpupower tool." ; \
+		echo "At least kernel 3.4 must be used." ; \
+		exit 1 ; \
+	fi
+
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+		$(CPUPOWER_MAKE_OPTS) \
+		cpupower
+endef
+
+define CPUPOWER_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+		$(CPUPOWER_MAKE_OPTS) \
+		DESTDIR=$(STAGING_DIR) \
+		cpupower_install
+endef
+
+define CPUPOWER_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+		$(CPUPOWER_MAKE_OPTS) \
+		DESTDIR=$(TARGET_DIR) \
+		cpupower_install
+endef
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 7/8] package/perf: migrate perf to use the new linux-tools infrastructure
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
                   ` (5 preceding siblings ...)
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 6/8] linux-tools: add cpupower Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 8/8] docs/manual: add documentation for linux-ext and linux-tools Romain Naour
  2015-07-14 21:48 ` [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Thomas Petazzoni
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

Remove perf package and add legacy handling.

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v5: build inside tools/perf directory
v4: revert the O=$(@D) removal and add a comment
    why it's needed.
    fix the legacy prompt.
v3: remove last LINUX_TOOL prefix
v2: remove LINUX_TOOL prefix
    use $(D) instead of $(LINUX_DIR)
    fix title style
    remove useless O=$(@D)
---
 Config.in.legacy                                 |  7 +++++++
 linux/Config.tools.in                            | 18 ++++++++++++++++++
 package/perf/perf.mk => linux/linux-tool-perf.mk | 24 +++++++++++-------------
 package/Config.in                                |  1 -
 package/perf/Config.in                           | 21 ---------------------
 5 files changed, 36 insertions(+), 35 deletions(-)
 rename package/perf/perf.mk => linux/linux-tool-perf.mk (76%)
 delete mode 100644 package/perf/Config.in

diff --git a/Config.in.legacy b/Config.in.legacy
index 0a8d0a6..326ba68 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -107,6 +107,13 @@ endif
 ###############################################################################
 comment "Legacy options removed in 2015.08"
 
+config BR2_PACKAGE_PERF
+	bool "perf option has been renamed"
+	select BR2_LEGACY
+	select BR2_LINUX_KERNEL_TOOL_PERF
+	help
+	  Perf package has been moved to linux tools package.
+
 config BR2_BINUTILS_VERSION_2_22
 	bool "binutils 2.22 removed"
 	select BR2_LEGACY
diff --git a/linux/Config.tools.in b/linux/Config.tools.in
index 008e68c..24ef8cd 100644
--- a/linux/Config.tools.in
+++ b/linux/Config.tools.in
@@ -8,4 +8,22 @@ config BR2_LINUX_KERNEL_TOOL_CPUPOWER
 	  cpupower is a collection of tools to examine and tune power
 	  saving related features of your processor.
 
+config BR2_LINUX_KERNEL_TOOL_PERF
+	bool "perf"
+	help
+	  perf (sometimes "Perf Events" or perf tools, originally
+	  "Performance Counters for Linux") - is a performance
+	  analyzing tool in Linux, available from kernel version
+	  2.6.31. User-space controlling utility, called 'perf' has
+	  git-like interface with subcommands. It is capable of
+	  statistical profiling of entire system (both kernel and user
+	  code), single CPU or severals threads.
+
+	  This will build and install the userspace 'perf'
+	  command. It is up to the user to ensure that the kernel
+	  configuration has all the suitable options enabled to allow a
+	  proper operation of 'perf'.
+
+	  https://perf.wiki.kernel.org/
+
 endmenu
diff --git a/package/perf/perf.mk b/linux/linux-tool-perf.mk
similarity index 76%
rename from package/perf/perf.mk
rename to linux/linux-tool-perf.mk
index 2bdd555..07d698e 100644
--- a/package/perf/perf.mk
+++ b/linux/linux-tool-perf.mk
@@ -4,11 +4,9 @@
 #
 ################################################################################
 
-# Source taken from the Linux kernel tree
-PERF_SOURCE =
-PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+LINUX_TOOLS += perf
 
-PERF_DEPENDENCIES = linux host-flex host-bison
+PERF_DEPENDENCIES = host-flex host-bison
 
 ifeq ($(KERNEL_ARCH),x86_64)
 PERF_ARCH=x86
@@ -57,31 +55,31 @@ else
 PERF_MAKE_FLAGS += NO_LIBELF=1 NO_DWARF=1
 endif
 
+# O must be defined here with $(@D) to overwrite the one used by Buildroot
+# for out of tree build.
 define PERF_BUILD_CMDS
-	$(Q)if test ! -f $(LINUX_DIR)/tools/perf/Makefile ; then \
+	$(Q)if test ! -f $(@D)/tools/perf/Makefile ; then \
 		echo "Your kernel version is too old and does not have the perf tool." ; \
 		echo "At least kernel 2.6.31 must be used." ; \
 		exit 1 ; \
 	fi
 	$(Q)if test "$(BR2_PACKAGE_ELFUTILS)" = "" ; then \
-		if ! grep -q NO_LIBELF $(LINUX_DIR)/tools/perf/Makefile* ; then \
-			if ! test -r $(LINUX_DIR)/tools/perf/config/Makefile ; then \
+		if ! grep -q NO_LIBELF $(@D)/tools/perf/Makefile* ; then \
+			if ! test -r $(@D)/tools/perf/config/Makefile ; then \
 				echo "The perf tool in your kernel cannot be built without libelf." ; \
 				echo "Either upgrade your kernel to >= 3.7, or enable the elfutils package." ; \
 				exit 1 ; \
 			fi \
 		fi \
 	fi
-	$(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
-		$(PERF_MAKE_FLAGS) O=$(@D)
+	$(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
+		-C $(@D)/tools/perf O=$(@D)/tools/perf/
 endef
 
 # After installation, we remove the Perl and Python scripts from the
 # target.
 define PERF_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE1) -C $(LINUX_DIR)/tools/perf \
-		$(PERF_MAKE_FLAGS) O=$(@D) install
+	$(TARGET_MAKE_ENV) $(MAKE1) $(PERF_MAKE_FLAGS) \
+		-C $(@D)/tools/perf O=$(@D)/tools/perf/ install
 	$(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
 endef
-
-$(eval $(generic-package))
diff --git a/package/Config.in b/package/Config.in
index 0288cb0..1f9359d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -88,7 +88,6 @@ endif
 	source "package/netperf/Config.in"
 	source "package/oprofile/Config.in"
 	source "package/pax-utils/Config.in"
-	source "package/perf/Config.in"
 	source "package/pv/Config.in"
 	source "package/racehound/Config.in"
 	source "package/ramsmp/Config.in"
diff --git a/package/perf/Config.in b/package/perf/Config.in
deleted file mode 100644
index 05c9870..0000000
--- a/package/perf/Config.in
+++ /dev/null
@@ -1,21 +0,0 @@
-config BR2_PACKAGE_PERF
-	bool "perf"
-	depends on BR2_LINUX_KERNEL
-	help
-	  perf (sometimes "Perf Events" or perf tools, originally
-	  "Performance Counters for Linux") - is a performance
-	  analyzing tool in Linux, available from kernel version
-	  2.6.31. User-space controlling utility, called 'perf' has
-	  git-like interface with subcommands. It is capable of
-	  statistical profiling of entire system (both kernel and user
-	  code), single CPU or severals threads.
-
-	  This package builds and install the userspace 'perf'
-	  command. It is up to the user to ensure that the kernel
-	  configuration has all the suitable options enabled to allow a
-	  proper operation of 'perf'.
-
-	  https://perf.wiki.kernel.org/
-
-comment "perf needs a Linux kernel to be built"
-	depends on !BR2_LINUX_KERNEL
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 8/8] docs/manual: add documentation for linux-ext and linux-tools.
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
                   ` (6 preceding siblings ...)
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 7/8] package/perf: migrate perf to use the new linux-tools infrastructure Romain Naour
@ 2015-07-14 17:35 ` Romain Naour
  2015-07-14 21:48 ` [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Thomas Petazzoni
  8 siblings, 0 replies; 10+ messages in thread
From: Romain Naour @ 2015-07-14 17:35 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v5: manual:
    rename linux specific infra title.
    move the chapiter higher with other infra.
    add a comment about what should be done by the
    Linux extension package.
v4: no change
v3: complete the linux kernel extention manual about the
    moment where are applied the PREPARE_KERNEL.
v2: new patch
---
 docs/manual/adding-packages-kernel-module.txt      |   1 +
 .../adding-packages-linux-kernel-spec-infra.txt    | 143 +++++++++++++++++++++
 docs/manual/adding-packages.txt                    |   2 +
 3 files changed, 146 insertions(+)
 create mode 100644 docs/manual/adding-packages-linux-kernel-spec-infra.txt

diff --git a/docs/manual/adding-packages-kernel-module.txt b/docs/manual/adding-packages-kernel-module.txt
index 0a5ec5b..ffeeef5 100644
--- a/docs/manual/adding-packages-kernel-module.txt
+++ b/docs/manual/adding-packages-kernel-module.txt
@@ -128,6 +128,7 @@ configure the build of the kernel module:
 * +FOO_MODULE_MAKE_OPTS+ may be set to contain extra variable definitions
   to pass to the Linux buildsystem.
 
+[[kernel-variables]]
 You may also reference (but you may *not* set!) those variables:
 
  * +LINUX_DIR+ contains the path to where the Linux kernel has been
diff --git a/docs/manual/adding-packages-linux-kernel-spec-infra.txt b/docs/manual/adding-packages-linux-kernel-spec-infra.txt
new file mode 100644
index 0000000..72eebfa
--- /dev/null
+++ b/docs/manual/adding-packages-linux-kernel-spec-infra.txt
@@ -0,0 +1,143 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+[[linux-kernel-specific-infra]]
+=== Infrastructure specific to the Linux kernel package
+
+The Linux kernel package can use some specific infrastructure based on package
+hooks for building Linux kernel tools or/and adding Linux kernel extensions.
+
+[[linux-kernel-tools]]
+==== linux-kernel-tools
+
+Buildroot offers a helper infrastructure to build some tools available inside
+the Linux kernel sources. Those tools always require a kernel to be built by
+Buildroot, so it's not easy to package them as usual packages. There is a
+simplified packaging based on generic package which builds each of those tools
+right after the kernel.
+
+Let's look at an example of how to add a new Linux tool. For a new Linux tool
+named +foo+, create a new menu entry in the existing +linux/Config.tools.in+.
+This file will contain the option descriptions related to each kernel tool
+that will be used and displayed in the configuration tool. It would basically
+look like:
+
+------------------------------
+01: config BR2_LINUX_KERNEL_TOOL_FOO
+02: 	bool "foo"
+03: 	help
+04: 	  This is a comment that explains what foo kernel tool is.
+05:
+06: 	  http://foosoftware.org/foo/
+------------------------------
+
+The name of the option starts with the prefix +BR2_LINUX_KERNEL_TOOL_+,
+followed by the uppercase name of the tool (like is done for packages).
+
+Then for each linux tool, add a new +.mk+ file named +linux/linux-tool-foo.mk+.
+It would basically look like:
+
+------------------------------
+01: ################################################################################
+02: #
+03: # foo
+04: #
+05: ################################################################################
+06:
+07: LINUX_TOOLS += foo
+08:
+09: FOO_DEPENDENCIES = libbbb
+10:
+11: define FOO_BUILD_CMDS
+12:	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools foo
+13: endef
+14:
+15: define FOO_INSTALL_STAGING_CMDS
+16:	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+17:		DESTDIR=$(STAGING_DIR) \
+18:		foo_install
+19: endef
+20:
+21: define FOO_INSTALL_TARGET_CMDS
+22:	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools \
+23:		DESTDIR=$(@D) \
+24:		foo_install
+25: endef
+--------------------------------
+
+On line 7, we register the Linux tool +foo+ to the list of available
+Linux tools.
+
+On line 9, we specify the list of dependencies this tool relies on. These
+dependencies are added to the Linux package dependencies list only when the
++foo+ tool is selected.
+
+The rest of the Makefile, lines 11-25 defines what should be done at the
+different steps of the Linux tool like for a
+xref:generic-package-tutorial[+generic package+]. They will actually be
+used only when the +foo+ tool is selected. The only supported commands are
++_BUILD_CMDS+, +_INSTALL_STAGING_CMDS+ and +_INSTALL_TARGET_CMDS+.
+
+.Note
+One *must not* call +$(eval $(generic-package))+ or any other
+package infrastructure ! Linux tools are not packages by themselves,
+they are part of the linux package.
+
+[[linux-kernel-ext]]
+==== linux-kernel-extensions
+
+Some packages provide new features that require the Linux kernel tree to
+be modified. This can be in the form of patches to be applied on the
+kernel tree, or in the form of new files to be added to the tree. The
+Buildroot's Linux kernel extensions infrastructure provides a simple
+solution to automatically do this, just after the kernel sources are
+extracted and before the kernel patches are applied.
+
+Let's look at an example on how to add a new Linux extension +foo+.
+
+First, create the package +foo+ that provides the extension: this package
+is a standard package; see the previous chapters on how to create such a
+package. This package is in charge to download the sources archive, check
+the hash, define the licence informations and build user space tools if
+any.
+
+Then create the 'Linux extension' proper: create a new menu entry in the
+existing +linux/Config.ext.in+. This file contains the option descriptions
+related to each kernel extension that will be used and displayed in the
+configuration tool. It would basically look like:
+
+------------------------------
+01: config BR2_LINUX_KERNEL_EXT_FOO
+02: 	bool "foo"
+03: 	help
+04: 	  This is a comment that explains what foo kernel extension is.
+05:
+06: 	  http://foosoftware.org/foo/
+------------------------------
+
+Then for each linux extension, add a new +.mk+ file named
++linux/linux-ext-foo.mk+. It should basically contain:
+
+------------------------------
+01: ################################################################################
+02: #
+03: # foo
+04: #
+05: ################################################################################
+06:
+07: LINUX_EXTENSIONS += foo
+08:
+09: define FOO_PREPARE_KERNEL
+10:		$(FOO_DIR)/prepare-kernel-tree.sh --linux-dir=$(@D)
+11: endef
+--------------------------------
+
+On line 7, we add the Linux extension +foo+ to the list of available
+Linux extensions.
+
+On line 9-11, we define what should be done by the extension to modify
+the Linux kernel tree; this is specific to the linux extension and can
+use the variables defined by the +foo+ package, like: +$(FOO_DIR)+ or
++$(FOO_VERSION)+... as well as all the Linux variables, like:
++$(LINUX_VERSION)+ or +$(LINUX_VERSION_PROBED)+, +$(KERNEL_ARCH)+...
+See the xref:kernel-variables[definition of those kernel variables].
\ No newline at end of file
diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt
index 721fe39..76f90c9 100644
--- a/docs/manual/adding-packages.txt
+++ b/docs/manual/adding-packages.txt
@@ -33,6 +33,8 @@ include::adding-packages-kernel-module.txt[]
 
 include::adding-packages-asciidoc.txt[]
 
+include::adding-packages-linux-kernel-spec-infra.txt[]
+
 include::adding-packages-hooks.txt[]
 
 include::adding-packages-gettext.txt[]
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure
  2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
                   ` (7 preceding siblings ...)
  2015-07-14 17:35 ` [Buildroot] [PATCH v5 8/8] docs/manual: add documentation for linux-ext and linux-tools Romain Naour
@ 2015-07-14 21:48 ` Thomas Petazzoni
  8 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2015-07-14 21:48 UTC (permalink / raw)
  To: buildroot

Dear Romain Naour,

On Tue, 14 Jul 2015 19:35:07 +0200, Romain Naour wrote:

> Romain Naour (4):
>   linux: add linux-tools infra
>   linux-tools: add cpupower
>   package/perf: migrate perf to use the new linux-tools infrastructure
>   docs/manual: add documentation for linux-ext and linux-tools.
> 
> Steven Noonan (4):
>   package/perf: if slang is enabled, depend on it
>   package/perf: if numactl (libnuma) is enabled, depend on it
>   package/perf: if libunwind is enabled, depend on it
>   package/perf: use correct definition of ARCH on x86_64

I've applied all the patches. I've done some minor changes on some
of them, except to the documentation where I did some more substantial
changes. Each commit has some details about the changes I made.

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-07-14 21:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 17:35 [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 1/8] package/perf: if slang is enabled, depend on it Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 2/8] package/perf: if numactl (libnuma) " Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 3/8] package/perf: if libunwind " Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 4/8] package/perf: use correct definition of ARCH on x86_64 Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 5/8] linux: add linux-tools infra Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 6/8] linux-tools: add cpupower Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 7/8] package/perf: migrate perf to use the new linux-tools infrastructure Romain Naour
2015-07-14 17:35 ` [Buildroot] [PATCH v5 8/8] docs/manual: add documentation for linux-ext and linux-tools Romain Naour
2015-07-14 21:48 ` [Buildroot] [PATCH v5 0/8] Linux kernel specific infrastructure Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.