Skip to contentSkip to conversation

perf: fix build with kernel older than 4.8

PATCH In review Martin Jansa 1 participant 2 messages May 24, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf: fix build with kernel older than 4.8

* perf is failing to build for me since this oe-core commit:
commit 9b38c824961fc9dce51bda95c25dac91a69fc64f
Author: Hongxu Jia <[email protected]>
Date: Tue Apr 24 11:33:47 2018 +0800

perf: make a copy of kernel source to perf workdir

the problem is that perf sources in kernel older than 4.8 (in my case 4.4) are depending on the "global" include headers outside tools directory, e.g. swab.h in:
kernel-source/tools$ git grep swab.h perf/MANIFEST:include/linux/swab.h perf/MANIFEST:include/uapi/linux/swab.h perf/util/include/asm/byteorder.h:#include "../../../../include/uapi/linux/swab.h"

this was resolved in 4.8 with:
commit 7e3f36411342a54f1981fa97b43550b8406a3d69
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Mon Jul 18 17:42:16 2016 -0300

perf tools: Remove tools/perf/util/include/asm/byteorder.h

Not used anymore. This also stops include linux/swab.h directly from the kernel sources, remove that reference from the MANIFEST.

and few more changes to make tools/include more complete and standalone:
tools/include in 4.15:
asm asm-generic linux tools trace uapi

tools/include in 4.4:
asm asm-generic linux tools

but copying the include header even for kernels which don't really need it doesn't add big overhead, so just copy include to perf sources for all kernels.

---
 meta/recipes-kernel/perf/perf.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-kernel/perf/perf.bb +1 -0
index fb4e3ac668..51f5597eb9 100644
@@ -98,6 +98,7 @@ EXTRA_OEMAKE += "\
 "
 
 PERF_SRC ?= "Makefile \
+             include \
              tools/arch \
              tools/build \
              tools/include \
Signature · 1 line
2.17.0
#1 lore raw

Even older kernels than 4.4 might need even more files to be copied first, with 3.16 kernel I'm seeing:

FLAGS: * new build flags or prefix
Makefile:358: scripts/Kbuild.include: No such file or directory Makefile:614: arch/arm/Makefile: No such file or directory /bin/bash: ./scripts/gcc-goto.sh: No such file or directory Makefile:755: scripts/Makefile.kasan: No such file or directory Makefile:756: scripts/Makefile.extrawarn: No such file or directory make[2]: *** No rule to make target `scripts/Makefile.extrawarn'. Stop.
PERF_VERSION =

Adding scripts, arch, lib to PERF_SRC fixes the build with 3.16, but not sure if you want to support such old kernel in oe-core.

Adding PERF_SRC_append = "scripts arch lib" in perf.bbappend works as well.

Quoted 59 lines · Martin Jansa

* perf is failing to build for me since this oe-core commit:
commit 9b38c824961fc9dce51bda95c25dac91a69fc64f
Author: Hongxu Jia <[email protected]>
Date: Tue Apr 24 11:33:47 2018 +0800

perf: make a copy of kernel source to perf workdir

the problem is that perf sources in kernel older than 4.8 (in my case 4.4) are depending on the "global" include headers outside tools directory, e.g. swab.h in:
kernel-source/tools$ git grep swab.h perf/MANIFEST:include/linux/swab.h perf/MANIFEST:include/uapi/linux/swab.h perf/util/include/asm/byteorder.h:#include
"../../../../include/uapi/linux/swab.h"

this was resolved in 4.8 with:
commit 7e3f36411342a54f1981fa97b43550b8406a3d69
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Mon Jul 18 17:42:16 2016 -0300

perf tools: Remove tools/perf/util/include/asm/byteorder.h

Not used anymore. This also stops include linux/swab.h directly from the kernel sources, remove that reference from the MANIFEST.

and few more changes to make tools/include more complete and standalone:
tools/include in 4.15:
asm asm-generic linux tools trace uapi

tools/include in 4.4:
asm asm-generic linux tools

but copying the include header even for kernels which don't really need it doesn't add big overhead, so just copy include to perf sources for all kernels.

---
 meta/recipes-kernel/perf/perf.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-kernel/perf/ renamed from meta/recipes-kernel/perf/perf.bb +0 -0

perf.bb
index fb4e3ac668..51f5597eb9 100644

meta/recipes-kernel/perf/perf.bb +1 -1
@@ -98,6 +98,7 @@ EXTRA_OEMAKE += "\
 "
 
 PERF_SRC ?= "Makefile \
+             include \
              tools/arch \
              tools/build \
              tools/include \
--

2.17.0