kernel-selftest: Fix PTP selftest compilation for kernel 6.7+

The PTP selftest fails to compile with kernel versions 6.7+ due to
missing header definitions for PTP_MASK_CLEAR_ALL and PTP_MASK_EN_SINGLE.
These definitions were introduced in kernel v6.7 with commit c5a445b.

This fix adds kernel headers to CFLAGS during compilation to ensure
the required definitions are available.

Error before fix:
testptp.c:613:31: error: 'PTP_MASK_CLEAR_ALL' undeclared
testptp.c:615:38: error: 'PTP_MASK_EN_SINGLE' undeclared

Fixes: #878
Signed-off-by: Jacob Panov <jacobpanov@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
jacobpanov 2025-07-07 00:01:38 +00:00 committed by Khem Raj
parent a2f6dfd321
commit f30afbe04c
No known key found for this signature in database
GPG Key ID: BB053355919D3314

View File

@ -97,6 +97,12 @@ either install it and add it to HOSTTOOLS, or add clang-native from meta-clang t
sed -i -e '/mrecord-mcount/d' ${S}/Makefile
sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/Makefile
sed -i -e '/Wno-alloc-size-larger-than/d' ${S}/scripts/Makefile.*
# Add kernel headers to CFLAGS to fix PTP selftest compilation
# Required for PTP_MASK_CLEAR_ALL and PTP_MASK_EN_SINGLE definitions
# introduced in kernel v6.7 (commit c5a445b)
export CFLAGS="${CFLAGS} -I${STAGING_KERNEL_BUILDDIR}/usr/include"
oe_runmake -C ${S}/tools/testing/selftests TARGETS="${TEST_LIST}"
}