Add Perf tools support
PATCH 2/3 Add Perf tools support
--- linux/linux.mk | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
linux/linux.mk +17 -0
@@ -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
Signature · 1 line
1.7.10.4
PATCH 2/3 Add Perf tools support
Dear Kaiwan Billimoria,
Quoted 3 lines · Kaiwan Billimoria
+ # 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.
Quoted 1 line
+all:
Arggh, this is *horrible*. Why do you believe you are allowed to overload the "all" target?
Quoted 3 lines
linux/linux.mk +2
-0+ $(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
Review
Quoted 2 lines
(quoted diff) +2
-0+ # 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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 2/3 Add Perf tools support
Dear Thomas Petazzoni,
Excuse my silly stuff & poor knowledge of the 'make'/build system ! :-p Pl see more qs below..
Quoted 5 lines
Quoted 3 lines
+ # 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?
Quoted 4 lines
Quoted 1 line
+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?
Quoted 4 lines
That said, I am not sure we want this thing in
linux/linux.mk. Maybe I'd prefer apackage/perf/perf.mk, which depends onBR2_LINUX_KERNELand 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.
Quoted 9 lines
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com