diff mbox series

[meta-oe,1/6] turbostat: fix build with kernel 7.x

Message ID 20260908171353.701307-1-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,1/6] turbostat: fix build with kernel 7.x | expand

Commit Message

Khem Raj Sept. 8, 2026, 5:13 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

Since kernel 7.x tools/include/linux/compiler_types.h includes
<linux/compiler-context-analysis.h>, a no-op stub for the new
compiler-based context analysis annotations. The recipe copies
compiler_types.h out of the kernel tree and rewrites its includes to
local headers, but did not know about the new one, so the build fails:

  ./compiler_types.h:16:10: fatal error: 'linux/compiler-context-analysis.h' file not found

Copy the new header when the kernel provides it and rewrite the include
like the others.

While here, fix the mangled quoting on the TMPCHECK line, which produced

  run.do_compile: line 138: TMPCHECK=grep: command not found

and left TMPCHECK unset. The unquoted [ -n $TMPCHECK ] test then always
succeeded, so the vdso branch was taken regardless of the grep result.

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 meta-oe/recipes-kernel/turbostat/turbostat.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-kernel/turbostat/turbostat.bb b/meta-oe/recipes-kernel/turbostat/turbostat.bb
index fcd1b116b8..2e69f9604a 100644
--- a/meta-oe/recipes-kernel/turbostat/turbostat.bb
+++ b/meta-oe/recipes-kernel/turbostat/turbostat.bb
@@ -59,6 +59,9 @@  do_configure:prepend() {
 	cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler.h ${S}
 	cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler_types.h ${S}
 	cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler-gcc.h ${S}
+	if [ -f "${STAGING_KERNEL_DIR}/tools/include/linux/compiler-context-analysis.h" ]; then
+		cp -r ${STAGING_KERNEL_DIR}/tools/include/linux/compiler-context-analysis.h ${S}
+	fi
 	cp -r ${STAGING_KERNEL_DIR}/tools/power/x86/turbostat/* ${S}
 }
 
@@ -68,8 +71,9 @@  do_compile() {
 	sed -i 's#<linux/compiler.h>#"compiler.h"#' build_bug.h
 	sed -i 's#<linux/compiler_types.h>#"compiler_types.h"#' compiler.h
 	sed -i 's#<linux/compiler-gcc.h>#"compiler-gcc.h"#' compiler_types.h
-	'TMPCHECK='grep "<vdso/const.h>" bits.h'' || true
-	if [ -n $TMPCHECK ]; then
+	sed -i 's#<linux/compiler-context-analysis.h>#"compiler-context-analysis.h"#' compiler_types.h
+	TMPCHECK=$(grep "<vdso/const.h>" bits.h || true)
+	if [ -n "$TMPCHECK" ]; then
 		sed -i 's#<vdso/const.h>#"const.h"#' bits.h
 		sed -i 's#<uapi/linux/const.h>#<linux/const.h>#' const.h
 	else