perf: Fix BUILD_BPF_SKEL PACKAGECONFIG to not define variable when disabled
PATCH 1/1 perf: Fix BUILD_BPF_SKEL PACKAGECONFIG to not define variable when disabled
The kernel's Makefile.config has two BUILD_BPF_SKEL checks:
- Line 219: ifeq ($(BUILD_BPF_SKEL),1) - value check (works with =0)
- Line 668: ifdef BUILD_BPF_SKEL - defined check (triggers for ANY value)
The previous fix (f48f6fb91c) passed BUILD_BPF_SKEL=0 which correctly skips the first check but still triggers the second 'ifdef' check, causing a build failure when clang is not available or too old.
Change from:
PACKAGECONFIG[bpf-skel] = ",BUILD_BPF_SKEL=0"
To:
PACKAGECONFIG[bpf-skel] = "BUILD_BPF_SKEL=1,"
When bpf-skel is not in PACKAGECONFIG (the default), nothing is passed to make and BUILD_BPF_SKEL remains undefined, which correctly skips both checks. When enabled, BUILD_BPF_SKEL=1 is passed.
Also move the PACKAGECONFIG entry to be grouped with the other PACKAGECONFIG options for consistency.
--- meta/recipes-kernel/perf/perf.bb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
meta/recipes-kernel/perf/perf.bb +6 -5
@@ -40,6 +40,12 @@ PACKAGECONFIG[pfm4] = ",NO_LIBPFM4=1,libpfm4" PACKAGECONFIG[babeltrace] = ",NO_LIBBABELTRACE=1,babeltrace" PACKAGECONFIG[zstd] = ",NO_LIBZSTD=1,zstd" PACKAGECONFIG[llvm] = ",NO_LIBLLVM=1,llvm" +# Disable BUILD_BPF_SKEL by default. Use "BUILD_BPF_SKEL=1," format +# instead of ",BUILD_BPF_SKEL=0" because Make's ifdef triggers on any +# defined value including 0. Note: Rust-in-kernel support pulls in +# clang-native, satisfying the dependency checks and causing perf to +# attempt building bpftool, which fails without an adequate clang. +PACKAGECONFIG[bpf-skel] = "BUILD_BPF_SKEL=1," # libunwind is not yet ported for some architectures PACKAGECONFIG:remove:arc = "libunwind"
@@ -439,8 +445,3 @@ perf_fix_sources () { done } -# Disable BUILD_BPF_SKEL by default. -# Rust in kernel support pulls in clang-native, which satisfies the -# BUILD_BPF_SKEL dependency checks and causes perf to attempt -# building bpftool, resulting in a build failure. -PACKAGECONFIG[bpf-skel] = ",BUILD_BPF_SKEL=0"
Signature · 1 line
2.34.1
Quoted 13 lines · Jaipaul Cheernam
The kernel's Makefile.config has two
BUILD_BPF_SKELchecks:
- Line 219: ifeq ($(BUILD_BPF_SKEL),1) - value check (works with =0)
- Line 668: ifdefBUILD_BPF_SKEL- defined check (triggers for ANY value)The previous fix (
f48f6fb91c) passed BUILD_BPF_SKEL=0 which correctly skips the first check but still triggers the second 'ifdef' check, causing a build failure when clang is not available or too old.Change from:
PACKAGECONFIG[bpf-skel] = ",BUILD_BPF_SKEL=0"
To:
PACKAGECONFIG[bpf-skel] = "BUILD_BPF_SKEL=1,"
Quoted 8 lines
When bpf-skel is not in PACKAGECONFIG (the default), nothing is passed to make and
BUILD_BPF_SKELremains undefined, which correctly skips both checks. When enabled, BUILD_BPF_SKEL=1 is passed.Also move the PACKAGECONFIG entry to be grouped with the other PACKAGECONFIG options for consistency.
Signed-off-by Jaipaul Cheernam <[email protected]>
Hi Jaipaul,
Based on the line numbers and conditionals you've put in the commit message, I assume you're trying to build perf with a kernel source tree that doesn't contain commit 9925495d96ef ("perf build: Default BUILD_BPF_SKEL, warn/disable for missing deps") [1], i.e. before Linux 6.10.
[1]: https://git.kernel.org/torvalds/c/9925495d96efc14d885ba66c5696f664fe0e663c
The bpf-skel PACKAGECONFIG handling in master/wrynose appears to be correct for kernel versions 6.10 and later. Unfortunately, there's no single check that will work across all kernel versions:
- With Linux 6.9 & earlier,
BUILD_BPF_SKEL=1 -> enabled
BUILD_BPF_SKEL=0 -> enabled
BUILD_BPF_SKEL undef -> disabled- With Linux 6.10 & later,
BUILD_BPF_SKEL=1 -> enabled
BUILD_BPF_SKEL=0 -> disabled
BUILD_BPF_SKEL undef -> enabledI can't see any value that consistently disables that across all kernel versions :(
So, you'll need to handle this appropriately depending on your kernel version.
Best regards,
Signature · 1 line
Paul Barker
Hi Paul,
Thanks for pointing out .
Yes, we have older Kernel than 6.10 and we will have a fix in local .
Regards,
Jaipaul
On 2026-07-02, 15:29, "Paul Barker" <[email protected]> wrote:
Quoted 13 lines · Jaipaul Cheernam
The kernel's Makefile.config has two
BUILD_BPF_SKELchecks:
- Line 219: ifeq ($(BUILD_BPF_SKEL),1) - value check (works with =0)
- Line 668: ifdefBUILD_BPF_SKEL- defined check (triggers for ANY value)The previous fix (
f48f6fb91c) passed BUILD_BPF_SKEL=0 which correctly skips the first check but still triggers the second 'ifdef' check, causing a build failure when clang is not available or too old.Change from:
PACKAGECONFIG[bpf-skel] = ",BUILD_BPF_SKEL=0"
To:
PACKAGECONFIG[bpf-skel] = "BUILD_BPF_SKEL=1,"
Quoted 8 lines
When bpf-skel is not in PACKAGECONFIG (the default), nothing is passed to make and
BUILD_BPF_SKELremains undefined, which correctly skips both checks. When enabled, BUILD_BPF_SKEL=1 is passed.Also move the PACKAGECONFIG entry to be grouped with the other PACKAGECONFIG options for consistency.
Hi Jaipaul,
Based on the line numbers and conditionals you've put in the commit message, I assume you're trying to build perf with a kernel source tree that doesn't contain commit 9925495d96ef ("perf build: Default BUILD_BPF_SKEL, warn/disable for missing deps") [1], i.e. before Linux 6.10.
[1]: https://git.kernel.org/torvalds/c/9925495d96efc14d885ba66c5696f664fe0e663c
The bpf-skel PACKAGECONFIG handling in master/wrynose appears to be correct for kernel versions 6.10 and later. Unfortunately, there's no single check that will work across all kernel versions:
- With Linux 6.9 & earlier,
BUILD_BPF_SKEL=1 -> enabled
BUILD_BPF_SKEL=0 -> enabled
BUILD_BPF_SKEL undef -> disabled- With Linux 6.10 & later,
BUILD_BPF_SKEL=1 -> enabled
BUILD_BPF_SKEL=0 -> disabled
BUILD_BPF_SKEL undef -> enabledI can't see any value that consistently disables that across all kernel versions :(
So, you'll need to handle this appropriately depending on your kernel version.
Best regards,
--
Paul Barker
Regards,
Jaipaul Cheernam
🔗 EST Website<https://www.est.tech/>
🔗 EST LinkedIn<https://www.linkedin.com/company/ericsson-software-technology/>