Skip to content

Commit afe722e

Browse files
committed
kernel-open: fix BTF generation on kernel 6.15+
Kernel 6.15+ replaced scripts/pahole-flags.sh with scripts/Makefile.btf and scripts/gen-btf.sh for BTF generation. The existing check only looks for pahole-flags.sh, causing the PAHOLE_AWK_PROGRAM wrapper to be used unnecessarily on newer kernels. This wrapper has shell quoting issues that result in awk parse errors during module build. Update the condition to also check for Makefile.btf, allowing the kernel's native BTF infrastructure to handle generation without the awk wrapper. Signed-off-by: Cole Leavitt <cole@unwrap.rs>
1 parent f77ad61 commit afe722e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

kernel-open/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ else
9292
# system(pahole_cmd)
9393
# }
9494
PAHOLE_AWK_PROGRAM = BEGIN { pahole_cmd = \"pahole\"; for (i = 1; i < ARGC; i++) { if (ARGV[i] ~ /--lang_exclude=/) { pahole_cmd = pahole_cmd sprintf(\" %s,c++\", ARGV[i]); } else { pahole_cmd = pahole_cmd sprintf(\" %s\", ARGV[i]); } } system(pahole_cmd); }
95-
# If scripts/pahole-flags.sh is not present in the kernel tree, add PAHOLE and
96-
# PAHOLE_AWK_PROGRAM assignments to PAHOLE_VARIABLES; otherwise assign the
97-
# empty string to PAHOLE_VARIABLES.
98-
PAHOLE_VARIABLES=$(if $(wildcard $(KERNEL_SOURCES)/scripts/pahole-flags.sh),,"PAHOLE=$(AWK) '$(PAHOLE_AWK_PROGRAM)'")
95+
# If scripts/pahole-flags.sh or scripts/Makefile.btf is present in the kernel
96+
# tree, the kernel handles BTF generation natively; otherwise add PAHOLE and
97+
# PAHOLE_AWK_PROGRAM assignments to PAHOLE_VARIABLES.
98+
# Kernel 6.15+ uses Makefile.btf + gen-btf.sh instead of pahole-flags.sh.
99+
PAHOLE_VARIABLES=$(if $(or $(wildcard $(KERNEL_SOURCES)/scripts/pahole-flags.sh),$(wildcard $(KERNEL_SOURCES)/scripts/Makefile.btf)),,"PAHOLE=$(AWK) '$(PAHOLE_AWK_PROGRAM)'")
99100

100101
ifndef ARCH
101102
ARCH := $(shell uname -m | sed -e 's/i.86/i386/' \

0 commit comments

Comments
 (0)