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'.
master
Daniel Cordero 2020-01-21 18:43:59 +00:00 committed by Harald Hoyer
parent 350ec5d9dd
commit 1bef2934d7
1 changed files with 5 additions and 5 deletions

View File

@ -1458,12 +1458,12 @@ static int install_dependent_modules(struct kmod_list *modlist)
continue; continue;
} }


ret = dracut_install(&path[kerneldirlen], &path[kerneldirlen], false, false, true); ret = dracut_install(path, &path[kerneldirlen], false, false, true);
if (ret == 0) { if (ret == 0) {
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; _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 *modpre = NULL;
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = 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); install_firmware(mod);
modlist = kmod_module_get_dependencies(mod); modlist = kmod_module_get_dependencies(mod);
ret = install_dependent_modules(modlist); ret = install_dependent_modules(modlist);
@ -1473,7 +1473,7 @@ static int install_dependent_modules(struct kmod_list *modlist)
ret = install_dependent_modules(modpre); ret = install_dependent_modules(modpre);
} }
} else { } 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; 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) { if (ret == 0) {
log_debug("dracut_install '%s' OK", kmod_module_get_name(mod)); log_debug("dracut_install '%s' OK", kmod_module_get_name(mod));
} else if (!arg_optional) { } else if (!arg_optional) {