turbostat: fix build with kernel 7.x

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>
This commit is contained in:
Khem Raj
2026-09-08 08:23:16 -07:00
committed by Khem Raj
parent fa8c85fb3b
commit 09ec1df384
@@ -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