From 1bef2934d7f02c39f3220a794592db190e478a45 Mon Sep 17 00:00:00 2001 From: Daniel Cordero Date: Tue, 21 Jan 2020 18:43:59 +0000 Subject: [PATCH] dracut-install: fetch kernel modules from kmoddir 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/install/dracut-install.c b/install/dracut-install.c index 2e264334..41938504 100644 --- a/install/dracut-install.c +++ b/install/dracut-install.c @@ -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) {