All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH v3 2/2] oeqa/sdk: build the kernel's host tools with a host pkg-config
Date: Sat, 22 Aug 2026 10:38:07 -0400	[thread overview]
Message-ID: <20260822143807.2256028-3-twoerner@gmail.com> (raw)
In-Reply-To: <20260822143807.2256028-1-twoerner@gmail.com>

The 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 queries
pkg-config for the libelf include path. The answer is the target's
include directory, so a host tool is compiled against the target's C
library headers, and the build stops on warnings that
-Wno-system-headers would otherwise have covered:

  usr/include/sys/cdefs.h:486: error: "__attribute_const__" redefined

Pass pkg-config-native on the make command line when the test builds an
external module. The SDK already ships that wrapper, it already answers
for the build machine, and kernel.bbclass already gives its own host
tools the same one, so the two agree rather than each undoing the
environment in its own way. It has to be a command line assignment: the
kernel assigns HOSTPKG_CONFIG with '=', so an exported value is ignored.

Fixes [YOCTO #16239].

AI-Generated: codex/claude-opus 5 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v3:
- use pkg-config-native, the wrapper kernel.bbclass already gives its
  own host tools, instead of spelling out an env -u invocation of the
  SDK's pkg-config

changes in v2:
- drop the HOSTPKG_CONFIG export from the SDK environment script. It
  only ever took effect against a proposed kernel change that has since
  been abandoned, so no kernel honours it and it was dead weight. The
  make command line assignment, which is what makes the test work, is
  unchanged
- the subject loses its toolchain-scripts prefix, since that file is no
  longer touched
- drop the paragraph citing the kernel proposal
---
 meta/lib/oeqa/sdk/cases/kmod.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/sdk/cases/kmod.py b/meta/lib/oeqa/sdk/cases/kmod.py
index 1be23e994fd2..a55071a3e79a 100644
--- a/meta/lib/oeqa/sdk/cases/kmod.py
+++ b/meta/lib/oeqa/sdk/cases/kmod.py
@@ -26,8 +26,12 @@ 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, and kernel.bbclass already gives its own
+        # host tools this same wrapper
+        host_pkg_config = 'HOSTPKG_CONFIG="pkg-config-native"'
         # 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 +43,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"))
-- 
2.50.0.173.g8b6f19ccfc3a



      parent reply	other threads:[~2026-08-22 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22 14:38 [PATCH v3 0/2] fix the SDK kernel module test Trevor Woerner
2026-08-22 14:38 ` [PATCH v3 1/2] oeqa/sdk: update cryptodev to a revision that builds on kernel 6.18 Trevor Woerner
2026-08-22 14:38 ` Trevor Woerner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260822143807.2256028-3-twoerner@gmail.com \
    --to=twoerner@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.