summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am8
-rw-r--r--src/core/kmod-setup.c7
-rw-r--r--src/core/main.c6
3 files changed, 11 insertions, 10 deletions
diff --git a/Makefile.am b/Makefile.am
index 701666c278..1aef24260b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1121,6 +1121,8 @@ libsystemd_core_la_SOURCES = \
src/core/machine-id-setup.h \
src/core/mount-setup.c \
src/core/mount-setup.h \
+ src/core/kmod-setup.c \
+ src/core/kmod-setup.h \
src/core/loopback-setup.h \
src/core/loopback-setup.c \
src/core/namespace.c \
@@ -1136,12 +1138,6 @@ libsystemd_core_la_SOURCES = \
src/core/failure-action.c \
src/core/failure-action.h
-if HAVE_KMOD
-libsystemd_core_la_SOURCES += \
- src/core/kmod-setup.c \
- src/core/kmod-setup.h
-endif
-
nodist_libsystemd_core_la_SOURCES = \
src/core/load-fragment-gperf.c \
src/core/load-fragment-gperf-nulstr.c
diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index 8136d3c0f8..23df1fdf36 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -23,13 +23,17 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
+
+#ifdef HAVE_KMOD
#include <libkmod.h>
+#endif
#include "macro.h"
#include "execute.h"
#include "capability.h"
#include "kmod-setup.h"
+#ifdef HAVE_KMOD
static void systemd_kmod_log(
void *data,
int priority,
@@ -52,8 +56,10 @@ static bool cmdline_check_kdbus(void) {
return strstr(line, "kdbus") != NULL;
}
+#endif
int kmod_setup(void) {
+#ifdef HAVE_KMOD
static const struct {
const char *module;
@@ -123,5 +129,6 @@ int kmod_setup(void) {
if (ctx)
kmod_unref(ctx);
+#endif
return 0;
}
diff --git a/src/core/main.c b/src/core/main.c
index 59a2be97f3..64acdf76e1 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -75,9 +75,7 @@
#include "selinux-setup.h"
#include "ima-setup.h"
#include "smack-setup.h"
-#ifdef HAVE_KMOD
#include "kmod-setup.h"
-#endif
static enum {
ACTION_RUN,
@@ -1389,10 +1387,10 @@ int main(int argc, char *argv[]) {
/* Mount /proc, /sys and friends, so that /proc/cmdline and
* /proc/$PID/fd is available. */
if (getpid() == 1) {
-#ifdef HAVE_KMOD
+
+ /* Load the kernel modules early, so that we kdbus.ko is loaded before kdbusfs shall be mounted */
if (!skip_setup)
kmod_setup();
-#endif
r = mount_setup(loaded_policy);
if (r < 0)