Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 2/3] Add Perf tools support
@ 2013-01-03  7:50 Kaiwan Billimoria
  2013-01-03 10:23 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Kaiwan Billimoria @ 2013-01-03  7:50 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Kaiwan Billimoria <kaiwan.billimoria@gmail.com>
---
 linux/linux.mk |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index e852f62..056a745 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -31,6 +31,27 @@ LINUX_SITE := $(LINUX_SITE)testing/
 endif # -rc
 endif

+#--- Perf: validate: perf minimally requires kernel ver >= 2.6.31
+ifeq ($(BR2_LINUX_KERNEL_USERMODE_TOOLS_PERF), y)
+ ifeq ($(findstring x2.6.,x$(LINUX_VERSION)),x2.6.)
+  LINUXVER_SPCS = $(subst ., ,$(LINUX_VERSION))
+  REL = $(word 3, $(LINUXVER_SPCS))
+  res = $(shell [ ${REL} -lt 31 ] && echo n || echo y )
+  ifeq ($(res), n)
+   $(error Perf minimally requires a kernel ver >= 2.6.31 ! Aborting...)
+  endif
+ endif
+ # FIXME: Where should we place the perf kernel patch? Online?
+ # Temporarily, at least, it's under linux/
+ BR2_LINUX_KERNEL_PATCH += "$(HOST_DIR)/../../linux/perf.patch"
+
+all:
+	$(info Building Perf...)
+	$(TARGET_MAKE_ENV) $(MAKE) ARCH=$(ARCH)
CROSS_COMPILE=$(TARGET_CROSS) NO_LIBELF=1 -C $(LINUX_DIR)/tools/perf
+	# Perf: Copy the perf binary executable to the target rootfs
+	cp -f $(LINUX_DIR)/tools/perf/perf $(TARGET_DIR)/usr/sbin
+endif
+
 LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH))

 LINUX_INSTALL_IMAGES = YES
-- 
1.7.10.4

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

* [Buildroot] [PATCH 2/3] Add Perf tools support
  2013-01-03  7:50 [Buildroot] [PATCH 2/3] Add Perf tools support Kaiwan Billimoria
@ 2013-01-03 10:23 ` Thomas Petazzoni
  2013-01-03 12:54   ` Kaiwan Billimoria
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2013-01-03 10:23 UTC (permalink / raw)
  To: buildroot

Dear Kaiwan Billimoria,

On Thu, 3 Jan 2013 13:20:39 +0530, Kaiwan Billimoria wrote:

> + # FIXME: Where should we place the perf kernel patch? Online?
> + # Temporarily, at least, it's under linux/
> + BR2_LINUX_KERNEL_PATCH += "$(HOST_DIR)/../../linux/perf.patch"

No, we don't modify BR2 variables.

> +all:

Arggh, this is *horrible*. Why do you believe you are allowed to
overload the "all" target?

> +	$(info Building Perf...)
> +	$(TARGET_MAKE_ENV) $(MAKE) ARCH=$(ARCH)
> CROSS_COMPILE=$(TARGET_CROSS) NO_LIBELF=1 -C $(LINUX_DIR)/tools/perf

This should be part of LINUX_BUILD_CMDS

> +	# Perf: Copy the perf binary executable to the target rootfs
> +	cp -f $(LINUX_DIR)/tools/perf/perf $(TARGET_DIR)/usr/sbin

This should be part of LINUX_INSTALL_TARGET_CMDS

And doing that will help you solve the problem you mentioned in your
cover letter ("the 'perf' binary executable is being built after the
root filesystem is tar-red").

That said, I am not sure we want this thing in linux/linux.mk. Maybe
I'd prefer a package/perf/perf.mk, which depends on BR2_LINUX_KERNEL
and re-uses the source code extracted in $(LINUX_DIR).

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] [PATCH 2/3] Add Perf tools support
  2013-01-03 10:23 ` Thomas Petazzoni
@ 2013-01-03 12:54   ` Kaiwan Billimoria
  0 siblings, 0 replies; 3+ messages in thread
From: Kaiwan Billimoria @ 2013-01-03 12:54 UTC (permalink / raw)
  To: buildroot

Dear Thomas Petazzoni,

Excuse my silly stuff & poor knowledge of the 'make'/build system !  :-p
Pl see more qs below..

>> + # FIXME: Where should we place the perf kernel patch? Online?
>> + # Temporarily, at least, it's under linux/
>> + BR2_LINUX_KERNEL_PATCH += "$(HOST_DIR)/../../linux/perf.patch"
>
> No, we don't modify BR2 variables.

So, how exactly do we do this then?

>> +all:
>
> Arggh, this is *horrible*. Why do you believe you are allowed to
> overload the "all" target?

Right. Forgive my basic qs, but what's the right approach?

>
> That said, I am not sure we want this thing in linux/linux.mk. Maybe
> I'd prefer a package/perf/perf.mk, which depends on BR2_LINUX_KERNEL
> and re-uses the source code extracted in $(LINUX_DIR).

Ok, will try working on this approach as well.
Not free now for a bit, will come back to this soon & keep you posted..

Thanks again for all valuable inputs..
Best,
Kaiwan.

>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com

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

end of thread, other threads:[~2013-01-03 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03  7:50 [Buildroot] [PATCH 2/3] Add Perf tools support Kaiwan Billimoria
2013-01-03 10:23 ` Thomas Petazzoni
2013-01-03 12:54   ` Kaiwan Billimoria

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox