2011-10-12 15:43:49 +02:00
|
|
|
From 051e407e1af70e779c092c81733a98832c29d6b4 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
|
|
Date: Wed, 12 Oct 2011 15:18:29 +0200
|
|
|
|
Subject: [PATCH] module-load: handle SUSE /etc/sysconfig/kernel module list
|
|
|
|
|
|
|
|
---
|
|
|
|
src/modules-load.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
1 files changed, 42 insertions(+), 0 deletions(-)
|
|
|
|
|
2012-07-02 17:48:09 +02:00
|
|
|
Index: systemd-44/src/modules-load.c
|
2011-12-09 15:44:59 +01:00
|
|
|
===================================================================
|
2012-07-02 17:48:09 +02:00
|
|
|
--- systemd-44.orig/src/modules-load.c
|
|
|
|
+++ systemd-44/src/modules-load.c
|
2012-02-09 18:04:56 +01:00
|
|
|
@@ -44,6 +44,9 @@ static void systemd_kmod_log(void *data,
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
int r = EXIT_FAILURE;
|
2011-10-12 15:43:49 +02:00
|
|
|
char **files, **fn;
|
|
|
|
+#if defined(TARGET_SUSE)
|
|
|
|
+ char *modules_on_boot = NULL;
|
|
|
|
+#endif
|
2012-02-09 18:04:56 +01:00
|
|
|
struct kmod_ctx *ctx;
|
|
|
|
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST|KMOD_PROBE_IGNORE_LOADED;
|
2011-10-12 15:43:49 +02:00
|
|
|
|
2012-07-02 17:48:09 +02:00
|
|
|
@@ -141,9 +144,59 @@ int main(int argc, char *argv[]) {
|
2011-10-12 15:43:49 +02:00
|
|
|
|
2012-02-09 18:04:56 +01:00
|
|
|
fclose(f);
|
|
|
|
}
|
2011-10-12 15:43:49 +02:00
|
|
|
+#if defined(TARGET_SUSE)
|
2012-02-09 18:04:56 +01:00
|
|
|
+ log_debug("apply: /etc/sysconfig/kernel MODULES_LOADED_ON_BOOT");
|
2011-10-12 15:43:49 +02:00
|
|
|
+ if ((r = parse_env_file("/etc/sysconfig/kernel", NEWLINE,
|
|
|
|
+ "MODULES_LOADED_ON_BOOT", &modules_on_boot,
|
|
|
|
+ NULL)) < 0) {
|
2012-01-26 17:29:45 +01:00
|
|
|
+ if (r != -ENOENT)
|
|
|
|
+ log_warning("Failed to read /etc/sysconfig/kernel: %s", strerror(-r));
|
|
|
|
+ } else
|
|
|
|
+ r = EXIT_SUCCESS;
|
2011-10-12 15:43:49 +02:00
|
|
|
+ if (modules_on_boot) {
|
|
|
|
+ char **modules = strv_split(modules_on_boot,WHITESPACE);
|
|
|
|
+ char **module;
|
2012-02-09 18:04:56 +01:00
|
|
|
+ struct kmod_list *itr, *modlist = NULL;
|
|
|
|
+ int err;
|
|
|
|
+
|
2011-10-12 15:43:49 +02:00
|
|
|
+ if (modules) {
|
|
|
|
+ STRV_FOREACH(module, modules) {
|
2012-02-09 18:04:56 +01:00
|
|
|
+ err = kmod_module_new_from_lookup(ctx, *module, &modlist);
|
|
|
|
+ if (err < 0) {
|
|
|
|
+ log_error("Failed to lookup alias '%s'", *module);
|
|
|
|
+ r = EXIT_FAILURE;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ kmod_list_foreach(itr, modlist) {
|
|
|
|
+ struct kmod_module *mod = kmod_module_get_module(itr);
|
|
|
|
+ err = kmod_module_probe_insert_module(mod, probe_flags,
|
|
|
|
+ NULL, NULL, NULL, NULL);
|
2011-10-12 15:43:49 +02:00
|
|
|
+
|
2012-02-09 18:04:56 +01:00
|
|
|
+ if (err == 0)
|
|
|
|
+ log_info("Inserted module '%s'", kmod_module_get_name(mod));
|
|
|
|
+ else if (err == KMOD_PROBE_APPLY_BLACKLIST)
|
|
|
|
+ log_info("Module '%s' is blacklisted", kmod_module_get_name(mod));
|
|
|
|
+ else {
|
|
|
|
+ log_error("Failed to insert '%s': %s", kmod_module_get_name(mod),
|
|
|
|
+ strerror(-err));
|
2011-10-12 15:43:49 +02:00
|
|
|
+ r = EXIT_FAILURE;
|
|
|
|
+ }
|
|
|
|
+
|
2012-02-09 18:04:56 +01:00
|
|
|
+ kmod_module_unref(mod);
|
2011-10-12 15:43:49 +02:00
|
|
|
+ }
|
2012-02-09 18:04:56 +01:00
|
|
|
|
|
|
|
+ kmod_module_unref_list(modlist);
|
2012-07-02 17:48:09 +02:00
|
|
|
+ modlist = NULL;
|
2011-10-12 15:43:49 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ strv_free(modules);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
finish:
|
2012-02-09 18:04:56 +01:00
|
|
|
strv_free(files);
|
2011-10-12 15:43:49 +02:00
|
|
|
+#if defined(TARGET_SUSE)
|
|
|
|
+ free(modules_on_boot);
|
|
|
|
+#endif
|
2012-02-09 18:04:56 +01:00
|
|
|
kmod_unref(ctx);
|
2011-10-12 15:43:49 +02:00
|
|
|
|
|
|
|
return r;
|
2012-07-02 17:48:09 +02:00
|
|
|
Index: systemd-44/units/systemd-modules-load.service.in
|
2011-12-09 15:44:59 +01:00
|
|
|
===================================================================
|
2012-07-02 17:48:09 +02:00
|
|
|
--- systemd-44.orig/units/systemd-modules-load.service.in
|
|
|
|
+++ systemd-44/units/systemd-modules-load.service.in
|
2011-12-09 15:44:59 +01:00
|
|
|
@@ -11,6 +11,7 @@ DefaultDependencies=no
|
|
|
|
Conflicts=shutdown.target
|
|
|
|
After=systemd-readahead-collect.service systemd-readahead-replay.service
|
|
|
|
Before=sysinit.target shutdown.target
|
|
|
|
+ConditionPathExists=|/etc/sysconfig/kernel
|
|
|
|
ConditionDirectoryNotEmpty=|/lib/modules-load.d
|
|
|
|
ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d
|
|
|
|
ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d
|