[PATCH] session.cxx: change kernel .config path

Uday Shankar ushankar@purestorage.com
Mon Mar 31 21:52:07 GMT 2025


Kernel config is parsed from /lib/modules/$(uname -r)/build/.config.
Kernels packaged using the in-kernel-tree packaging targets no longer
include this file as of aaed5c7739be ("kbuild: slim down package for
building external modules") # v6.12-rc1~61^2~48, so trying to use
systemtap against such kernels fails quickly with something like the
following:

Checking "/lib/modules/6.14.0/build/.config" failed with error: No such file or directory

Parse the kernel config from /lib/modules/$(uname -r)/config instead.
This file exists for both distribution-packaged kernels (in kernel-core,
for RHEL and RHEL-similar distributions), and kernels packaged using the
in-kernel-tree packaging targets, so this dependency is more robust.
---
 session.cxx | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/session.cxx b/session.cxx
index 46abd3f98..50c0ac6a5 100644
--- a/session.cxx
+++ b/session.cxx
@@ -2101,21 +2101,14 @@ int
 systemtap_session::parse_kernel_config ()
 {
   // PR10702: pull config options
-  string kernel_config_file = kernel_build_tree + "/.config";
+  string kernel_config_file = sysroot + "/lib/modules/" + kernel_release + "/config";
   struct stat st;
   int rc = stat(kernel_config_file.c_str(), &st);
   if (rc != 0)
     {
         clog << _F("Checking \"%s\" failed with error: %s",
                    kernel_config_file.c_str(), strerror(errno)) << endl;
-	find_devel_rpms(*this, kernel_build_tree.c_str());
-        // Enable warnings, so that the rpm-installation help is sent
-        // out.  The above message is going to go to stderr anyway
-        // in the case of stap -L without a necessary -devel available.
-        // Might as well make the text more helpful.
-        this->suppress_warnings = false;
-	missing_rpm_list_print(*this, "-devel");
-	return rc;
+	      return rc;
     }
 
   ifstream kcf (kernel_config_file.c_str());

base-commit: ee6f7a9eb9e03dd3f8213fae27ffb8743be2fee3
-- 
2.34.1



More information about the Systemtap mailing list