diff mbox

[4/7] package/perf: build outside kernel tree

Message ID 1426714983-24803-4-git-send-email-steven@uplinklabs.net
State Superseded
Headers show

Commit Message

Steven Noonan March 18, 2015, 9:43 p.m. UTC
This is necessary for introducing patches.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
---
 package/perf/perf.mk | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Arnout Vandecappelle March 19, 2015, 11:21 p.m. UTC | #1
On 18/03/15 22:43, Steven Noonan wrote:
> This is necessary for introducing patches.

 Although I think it's really messy to build perf within the the linux source
like we do now, your proposed approach has some showstopper drawbacks.

- It doesn't work for LINUX_OVERRIDE_SRCDIR or BR2_LINUX_KERNEL_CUSTOM_LOCAL.

- Any custom patches to the kernel are not taken into account, and I believe
perf uses the private headers so there's a risk there.

- It requires an expensive second extract of the entire kernel.


 As an alternative, you could copy in just the perf stuff from the linux source
as a POST_EXTRACT_HOOK.

 Or you could apply the patches on the kernel sources instead of on the perf
directory. But that would be a bit more complicated.

 Or you could add a LINUX_POST_PATCH_HOOK to apply the perf patches. I'm not
entirely sure if that would work though.


 Regards,
 Arnout
Steven Noonan March 20, 2015, 3:08 a.m. UTC | #2
On Thu, Mar 19, 2015 at 4:21 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 18/03/15 22:43, Steven Noonan wrote:
>> This is necessary for introducing patches.
>
>  Although I think it's really messy to build perf within the the linux source
> like we do now, your proposed approach has some showstopper drawbacks.
>
> - It doesn't work for LINUX_OVERRIDE_SRCDIR or BR2_LINUX_KERNEL_CUSTOM_LOCAL.

Indeed.

> - Any custom patches to the kernel are not taken into account, and I believe
> perf uses the private headers so there's a risk there.

Quite possibly so.

>
> - It requires an expensive second extract of the entire kernel.

Expensive on what? Isn't everyone using SSDs these days? ;)

>
>  As an alternative, you could copy in just the perf stuff from the linux source
> as a POST_EXTRACT_HOOK.
>
>  Or you could apply the patches on the kernel sources instead of on the perf
> directory. But that would be a bit more complicated.

I think this is probably the path to take, but I'm not entirely a fan of it.

>  Or you could add a LINUX_POST_PATCH_HOOK to apply the perf patches. I'm not
> entirely sure if that would work though.
>
>
>  Regards,
>  Arnout
>
> --
> 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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
diff mbox

Patch

diff --git a/package/perf/perf.mk b/package/perf/perf.mk
index f35abc9..68bb430 100644
--- a/package/perf/perf.mk
+++ b/package/perf/perf.mk
@@ -5,10 +5,10 @@ 
 ################################################################################
 
 # Source taken from the Linux kernel tree
-PERF_SOURCE =
 PERF_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
+PERF_SOURCE = linux-$(PERF_VERSION).tar.xz
 
-PERF_DEPENDENCIES = linux host-flex host-bison
+PERF_DEPENDENCIES = host-flex host-bison
 
 PERF_MAKE_FLAGS = \
 	$(LINUX_MAKE_FLAGS) \
@@ -53,29 +53,29 @@  else
 endif
 
 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) $(MAKE) -C $(LINUX_DIR)/tools/perf \
-		$(PERF_MAKE_FLAGS) O=$(@D)
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools/perf \
+		$(PERF_MAKE_FLAGS)
 endef
 
 # After installation, we remove the Perl and Python scripts from the
 # target.
 define PERF_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(LINUX_DIR)/tools/perf \
-		$(PERF_MAKE_FLAGS) O=$(@D) install
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/tools/perf \
+		$(PERF_MAKE_FLAGS) install
 	$(RM) -rf $(TARGET_DIR)/usr/libexec/perf-core/scripts/
 endef