3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #118362 from gebner/ddcutil-warning

ddcutil: use nixos paths for kernel modules
This commit is contained in:
Gabriel Ebner 2021-04-03 08:10:49 +02:00 committed by GitHub
commit 990196a381
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View file

@ -12,6 +12,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-F/tKW81bAyYtwpxhl5XC8YyMB+6S0XmqqigwJY2WFDU=";
};
patches = [
# Look for kernel modules in /run/booted-system/kernel-modules/lib/modules/*
./nixos-paths.diff
];
nativeBuildInputs = [ autoreconfHook pkg-config ];
buildInputs = [
i2c-tools udev libgudev

View file

@ -0,0 +1,32 @@
diff --git a/src/app_sysenv/query_sysenv_modules.c b/src/app_sysenv/query_sysenv_modules.c
index 59df64f1..fb244dd0 100644
--- a/src/app_sysenv/query_sysenv_modules.c
+++ b/src/app_sysenv/query_sysenv_modules.c
@@ -50,7 +50,9 @@ bool is_module_loadable(char * module_name, int depth) {
g_snprintf(module_name_ko, 100, "%s.ko", module_name);
char dirname[PATH_MAX];
- g_snprintf(dirname, PATH_MAX, "/lib/modules/%s/kernel/drivers/i2c", utsbuf.release);
+ g_snprintf(dirname, PATH_MAX,
+ "/run/booted-system/kernel-modules/lib/modules/%s/kernel/drivers/i2c",
+ utsbuf.release);
struct dirent *dent;
DIR *d;
diff --git a/src/util/linux_util.c b/src/util/linux_util.c
index 5eb8491c..3a129ccf 100644
--- a/src/util/linux_util.c
+++ b/src/util/linux_util.c
@@ -29,8 +29,10 @@ bool is_module_builtin(char * module_name)
int rc = uname(&utsbuf);
assert(rc == 0);
- char modules_builtin_fn[100];
- snprintf(modules_builtin_fn, 100, "/lib/modules/%s/modules.builtin", utsbuf.release);
+ char modules_builtin_fn[PATH_MAX];
+ snprintf(modules_builtin_fn, PATH_MAX,
+ "/run/booted-system/kernel-modules/lib/modules/%s/modules.builtin",
+ utsbuf.release);
char ko_name[40];
snprintf(ko_name, 40, "%s.ko", module_name);