2011-10-13 00:02:20 +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-02-16 16:24:03 +01:00
|
|
|
Index: systemd-41/src/modules-load.c
|
2011-12-12 16:59:25 +01:00
|
|
|
===================================================================
|
2012-02-16 16:24:03 +01:00
|
|
|
--- systemd-41.orig/src/modules-load.c
|
|
|
|
+++ systemd-41/src/modules-load.c
|
|
|
|
@@ -44,6 +44,9 @@ static void systemd_kmod_log(void *data,
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
int r = EXIT_FAILURE;
|
2011-10-13 00:02:20 +02:00
|
|
|
char **files, **fn;
|
|
|
|
+#if defined(TARGET_SUSE)
|
|
|
|
+ char *modules_on_boot = NULL;
|
|
|
|
+#endif
|
2012-02-16 16:24:03 +01:00
|
|
|
struct kmod_ctx *ctx;
|
|
|
|
const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST|KMOD_PROBE_IGNORE_LOADED;
|
2011-10-13 00:02:20 +02:00
|
|
|
|
2012-02-16 16:24:03 +01:00
|
|
|
@@ -141,9 +144,58 @@ int main(int argc, char *argv[]) {
|
2011-10-13 00:02:20 +02:00
|
|
|
|
2012-02-16 16:24:03 +01:00
|
|
|
fclose(f);
|
|
|
|
}
|
2011-10-13 00:02:20 +02:00
|
|
|
+#if defined(TARGET_SUSE)
|
2012-02-16 16:24:03 +01:00
|
|
|
+ log_debug("apply: /etc/sysconfig/kernel MODULES_LOADED_ON_BOOT");
|
2011-10-13 00:02:20 +02:00
|
|
|
+ if ((r = parse_env_file("/etc/sysconfig/kernel", NEWLINE,
|
|
|
|
+ "MODULES_LOADED_ON_BOOT", &modules_on_boot,
|
|
|
|
+ NULL)) < 0) {
|
2012-02-03 10:26:59 +01:00
|
|
|
+ if (r != -ENOENT)
|
|
|
|
+ log_warning("Failed to read /etc/sysconfig/kernel: %s", strerror(-r));
|
|
|
|
+ } else
|
|
|
|
+ r = EXIT_SUCCESS;
|
2011-10-13 00:02:20 +02:00
|
|
|
+ if (modules_on_boot) {
|
|
|
|
+ char **modules = strv_split(modules_on_boot,WHITESPACE);
|
|
|
|
+ char **module;
|
2012-02-16 16:24:03 +01:00
|
|
|
+ struct kmod_list *itr, *modlist = NULL;
|
|
|
|
+ int err;
|
|
|
|
+
|
2011-10-13 00:02:20 +02:00
|
|
|
+ if (modules) {
|
|
|
|
+ STRV_FOREACH(module, modules) {
|
2012-02-16 16:24:03 +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-13 00:02:20 +02:00
|
|
|
+
|
2012-02-16 16:24:03 +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-13 00:02:20 +02:00
|
|
|
+ r = EXIT_FAILURE;
|
|
|
|
+ }
|
|
|
|
+
|
2012-02-16 16:24:03 +01:00
|
|
|
+ kmod_module_unref(mod);
|
2011-10-13 00:02:20 +02:00
|
|
|
+ }
|
2012-02-16 16:24:03 +01:00
|
|
|
|
|
|
|
+ kmod_module_unref_list(modlist);
|
2011-10-13 00:02:20 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ strv_free(modules);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
finish:
|
2012-02-16 16:24:03 +01:00
|
|
|
strv_free(files);
|
2011-10-13 00:02:20 +02:00
|
|
|
+#if defined(TARGET_SUSE)
|
|
|
|
+ free(modules_on_boot);
|
|
|
|
+#endif
|
2012-02-16 16:24:03 +01:00
|
|
|
kmod_unref(ctx);
|
2011-10-13 00:02:20 +02:00
|
|
|
|
|
|
|
return r;
|
2012-02-16 16:24:03 +01:00
|
|
|
Index: systemd-41/units/systemd-modules-load.service.in
|
2011-12-12 16:59:25 +01:00
|
|
|
===================================================================
|
2012-02-16 16:24:03 +01:00
|
|
|
--- systemd-41.orig/units/systemd-modules-load.service.in
|
|
|
|
+++ systemd-41/units/systemd-modules-load.service.in
|
2011-12-12 16:59:25 +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
|