]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-install: fetch kernel modules from kmoddir
authorDaniel Cordero <dracut@0xdc.io>
Tue, 21 Jan 2020 18:43:59 +0000 (18:43 +0000)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 27 Jan 2020 08:02:46 +0000 (09:02 +0100)
dracut, when passing --kmoddir, would only install modules that exist at
the same location as it will appear in the initramfs.

For most (possibly all) outputs, the output path would be /lib/modules,
so previously all kernel modules must be copied there or the module
installation silently fails.

Now use the original path variable, and install to the shortened path
variable (as calculated by kerneldirlen).

Note: This means that the argument to --kmoddir (and the modules filetree)
should be a directory that ends in 'lib/modules/$kernelversion'.

install/dracut-install.c

index 2e2643349d2afc2a0604548c4702db66ddd1de97..419385045806a4c819703c5a5e32a0e464e88ad9 100644 (file)
@@ -1458,12 +1458,12 @@ static int install_dependent_modules(struct kmod_list *modlist)
                         continue;
                 }
 
-                ret = dracut_install(&path[kerneldirlen], &path[kerneldirlen], false, false, true);
+                ret = dracut_install(path, &path[kerneldirlen], false, false, true);
                 if (ret == 0) {
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
                        _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
-                        log_debug("dracut_install '%s' '%s' OK", &path[kerneldirlen], &path[kerneldirlen]);
+                        log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
                         install_firmware(mod);
                        modlist = kmod_module_get_dependencies(mod);
                        ret = install_dependent_modules(modlist);
@@ -1473,7 +1473,7 @@ static int install_dependent_modules(struct kmod_list *modlist)
                                        ret = install_dependent_modules(modpre);
                        }
                 } else {
-                        log_error("dracut_install '%s' '%s' ERROR", &path[kerneldirlen], &path[kerneldirlen]);
+                        log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
                 }
         }
 
@@ -1515,9 +1515,9 @@ static int install_module(struct kmod_module *mod)
                 return 1;
         }
 
-        log_debug("dracut_install '%s' '%s'", &path[kerneldirlen], &path[kerneldirlen]);
+        log_debug("dracut_install '%s' '%s'", path, &path[kerneldirlen]);
 
-        ret = dracut_install(&path[kerneldirlen], &path[kerneldirlen], false, false, true);
+        ret = dracut_install(path, &path[kerneldirlen], false, false, true);
         if (ret == 0) {
                 log_debug("dracut_install '%s' OK", kmod_module_get_name(mod));
         } else if (!arg_optional) {