fix the SDK kernel module test
cover fix the SDK kernel module test
The kernel module test in the SDK test suite does not pass today.
The cryptodev revision it builds no longer builds against kernel 6.18, and the kernel's host tools are compiled with a pkg-config that the SDK environment has pointed at the target sysroot, so a host compile is handed target include paths and fails under -Werror. OE-Core already solves the second one for its own kernel builds, where kernel.bbclass passes HOSTPKG_CONFIG=pkg-config-native; the SDK simply had no equivalent.
These are independent of any SDK feature work and fix a test that is broken in master today.
Trevor Woerner (2):
oeqa/sdk: update cryptodev to a revision that builds on kernel 6.18 toolchain-scripts, oeqa/sdk: build the kernel's host tools with a host
pkg-config
meta/classes-recipe/toolchain-scripts.bbclass | 3 +++ meta/lib/oeqa/sdk/cases/kmod.py | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
PATCH 1/2 oeqa/sdk: update cryptodev to a revision that builds on kernel 6.18
The out-of-tree kernel module test pins a cryptodev-linux revision from before the 1.14 release, which predates the removal of crypto_ahash_alignmask() from the kernel and so no longer compiles:
cryptlib.c:384:28: error: implicit declaration of function 'crypto_ahash_alignmask' [-Wimplicit-function-declaration]
Move to upstream's "Fix build for Linux 6.18-rc1", which is the revision that restores compatibility.
AI-Generated: codex/claude-opus 5 (xhigh)
--- meta/lib/oeqa/sdk/cases/kmod.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oeqa/sdk/cases/kmod.py +2 -2
@@ -31,8 +31,8 @@ class KernelModuleTest(OESDKTestCase): with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir: git_url = "https://github.com/cryptodev-linux/cryptodev-linux" - # This is a knnown-good commit post-1.13 that builds with kernel 6.7+ - git_sha = "bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f" + # This is a known-good commit post-1.14 that builds with kernel 6.18+ + git_sha = "08644db02d43478f802755903212f5ee506af73b" sourcedir = os.path.join(testdir, "cryptodev-linux") subprocess.check_output(["git", "clone", git_url, sourcedir], stderr=subprocess.STDOUT)
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
PATCH 2/2 toolchain-scripts, oeqa/sdk: build the kernel's host tools with a host pkg-config
In reply to Trevor WoernerThe SDK environment sets PKG_CONFIG_SYSROOT_DIR, PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR so that pkg-config answers for the target. That is right for everything built to run there and wrong for a program built to run on the SDK host.
The kernel build compiles host tools of its own, and objtool asks pkg-config where libelf is. It gets the target's include directory, compiles a host tool against the target's C library headers, and stops on warnings that -Wno-system-headers would otherwise have covered:
usr/include/sys/cdefs.h:486: error: "__attribute_const__" redefined
Export a HOSTPKG_CONFIG that undoes those three variables, and pass the same value on the make command line when the test builds an external module. Both halves are needed: the kernel assigns HOSTPKG_CONFIG with '=', so only a command line assignment takes effect today, and the export is there for kernels that assign it with '?=', which is proposed in
https://lore.kernel.org/linux-kbuild/[email protected]/
OE-Core already does the command line half for its own kernel builds, in kernel.bbclass.
Fixes [YOCTO #16239].
AI-Generated: codex/claude-opus 5 (xhigh)
--- meta/classes-recipe/toolchain-scripts.bbclass | 3 +++ meta/lib/oeqa/sdk/cases/kmod.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
meta/classes-recipe/toolchain-scripts.bbclass +3 -0
@@ -63,6 +63,9 @@ toolchain_create_sdk_env_script () { echo "export PATH=$sdkpathnative$bindir:$sdkpathnative$sbindir:$sdkpathnative$base_bindir:$sdkpathnative$base_sbindir:$sdkpathnative$bindir/../${HOST_SYS}/bin:$sdkpathnative$bindir/${TARGET_SYS}"$EXTRAPATH':"$PATH"' >> $script echo 'export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT' >> $script echo 'export PKG_CONFIG_PATH=$SDKTARGETSYSROOT'"$libdir"'/pkgconfig:$SDKTARGETSYSROOT'"$prefix"'/share/pkgconfig' >> $script + # pkg-config here answers for the target, which is wrong for the host + # tools the kernel build compiles. Honoured by kernels using '?='. + echo 'export HOSTPKG_CONFIG="env -u PKG_CONFIG_SYSROOT_DIR -u PKG_CONFIG_PATH -u PKG_CONFIG_LIBDIR pkg-config"' >> $script echo 'export CONFIG_SITE=${SDKPATH}/site-config-'"${multimach_target_sys}" >> $script echo "export OECORE_NATIVE_SYSROOT=\"$sdkpathnative\"" >> $script echo 'export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"' >> $script
meta/lib/oeqa/sdk/cases/kmod.py +5 -2
@@ -26,8 +26,11 @@ class KernelModuleTest(OESDKTestCase): parallel_make = "-j %d" % (pmv) if pmv else "" self.ensure_target_package("kernel-devsrc") + # the kernel assigns HOSTPKG_CONFIG with '=', so it has to come from + # the make command line, as kernel.bbclass does + host_pkg_config = 'HOSTPKG_CONFIG="env -u PKG_CONFIG_SYSROOT_DIR -u PKG_CONFIG_PATH -u PKG_CONFIG_LIBDIR pkg-config"' # These targets need to be built before kernel modules can be built. - self._run("make %s -C $OECORE_TARGET_SYSROOT/usr/src/kernel prepare scripts" % (parallel_make)) + self._run("make %s %s -C $OECORE_TARGET_SYSROOT/usr/src/kernel prepare scripts" % (parallel_make, host_pkg_config)) with tempfile.TemporaryDirectory(prefix="cryptodev", dir=self.tc.sdk_dir) as testdir: git_url = "https://github.com/cryptodev-linux/cryptodev-linux"
@@ -39,5 +42,5 @@ class KernelModuleTest(OESDKTestCase): self.assertTrue(os.path.isdir(sourcedir)) subprocess.check_output(["git", "-C", sourcedir, "checkout", git_sha], stderr=subprocess.STDOUT) - self._run("make -C %s V=1 KERNEL_DIR=$OECORE_TARGET_SYSROOT/usr/src/kernel" % sourcedir) + self._run("make -C %s V=1 %s KERNEL_DIR=$OECORE_TARGET_SYSROOT/usr/src/kernel" % (sourcedir, host_pkg_config)) self.check_elf(os.path.join(sourcedir, "cryptodev.ko"))
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a
Re: [OE-core] [PATCH 2/2] toolchain-scripts, oeqa/sdk: build the kernel's host tools with a host pkg-config
Quoted 24 lines · Trevor Woerner via lists.openembedded.org
The SDK environment sets
PKG_CONFIG_SYSROOT_DIR,PKG_CONFIG_PATHandPKG_CONFIG_LIBDIRso that pkg-config answers for the target. That is right for everything built to run there and wrong for a program built to run on the SDK host.The kernel build compiles host tools of its own, and objtool asks pkg-config where libelf is. It gets the target's include directory, compiles a host tool against the target's C library headers, and stops on warnings that -Wno-system-headers would otherwise have covered:
usr/include/sys/cdefs.h:486: error: "__attribute_const__" redefinedExport a
HOSTPKG_CONFIGthat undoes those three variables, and pass the same value on the make command line when the test builds an external module. Both halves are needed: the kernel assignsHOSTPKG_CONFIGwith '=', so only a command line assignment takes effect today, and the export is there for kernels that assign it with '?=', which is proposed inhttps://lore.kernel.org/linux-kbuild/[email protected]/
OE-Core already does the command line half for its own kernel builds, in kernel.bbclass.
Quoted 8 lines
Fixes [YOCTO #16239].
AI-Generated: codex/claude-opus 5 (xhigh)
Signed-off-by Trevor Woerner <[email protected]>---
meta/classes-recipe/toolchain-scripts.bbclass | 3 +++ meta/lib/oeqa/sdk/cases/kmod.py | 7 +++++--2 files changed, 8 insertions(+), 2 deletions(-)
The kmod test piece of this is probably ok, as you say, we do that in the kernel classes. I do note that the kernel class redirects to a pkg- config wrapper and perhaps the kmod class should match, rather than doing something different though?
The toolchain piece is a but more of a concern since we're encoding kernel specific variables into the generic toolchain environment file and in general we don't want to do recipe specific things there...
Cheers,
Richard
Re: [OE-core] [PATCH 2/2] toolchain-scripts, oeqa/sdk: build the kernel's host tools with a host pkg-config
Quoted 34 lines · Richard Purdie
Quoted 24 lines · Trevor Woerner via lists.openembedded.org
The SDK environment sets
PKG_CONFIG_SYSROOT_DIR,PKG_CONFIG_PATHandPKG_CONFIG_LIBDIRso that pkg-config answers for the target. That is right for everything built to run there and wrong for a program built to run on the SDK host.The kernel build compiles host tools of its own, and objtool asks pkg-config where libelf is. It gets the target's include directory, compiles a host tool against the target's C library headers, and stops on warnings that -Wno-system-headers would otherwise have covered:
usr/include/sys/cdefs.h:486: error: "__attribute_const__" redefinedExport a
HOSTPKG_CONFIGthat undoes those three variables, and pass the same value on the make command line when the test builds an external module. Both halves are needed: the kernel assignsHOSTPKG_CONFIGwith '=', so only a command line assignment takes effect today, and the export is there for kernels that assign it with '?=', which is proposed inhttps://lore.kernel.org/linux-kbuild/[email protected]/
OE-Core already does the command line half for its own kernel builds, in kernel.bbclass.
Quoted 8 lines
Fixes [YOCTO #16239].
AI-Generated: codex/claude-opus 5 (xhigh)
Signed-off-by Trevor Woerner <[email protected]>---
meta/classes-recipe/toolchain-scripts.bbclass | 3 +++ meta/lib/oeqa/sdk/cases/kmod.py | 7 +++++--2 files changed, 8 insertions(+), 2 deletions(-)
Quoted 4 lines
The kmod test piece of this is probably ok, as you say, we do that in the kernel classes. I do note that the kernel class redirects to a pkg- config wrapper and perhaps the kmod class should match, rather than doing something different though?
Agreed. I just sent a v3 that does that, so the test now passes the same wrapper rather than spelling it out.
Quoted 3 lines
The toolchain piece is a but more of a concern since we're encoding kernel specific variables into the generic toolchain environment file and in general we don't want to do recipe specific things there...
Yes, and it is dropped. My v2 crossed with this email and already does this.
Quoted 3 lines
Cheers,
Richard