summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2012-11-20 01:24:32 +0100
committerTom Gundersen <teg@jklm.no>2012-11-20 19:35:27 +0100
commite30431623a7d871da123cc37055ac49abf2c20ea (patch)
treeb07f9dcec833b65964e3b07b2907a73ebbd03184
parent1d0b59f932d96c108ad5e921213723a48e6b47b8 (diff)
build-sys: make loadable module support optional
kmod is unecessary if loadable module support is disabled in the kernel, so make the dependency optional.
-rw-r--r--Makefile.am62
-rw-r--r--README4
-rw-r--r--configure.ac14
-rw-r--r--rules/75-probe_mtd.rules1
-rw-r--r--rules/80-drivers.rules1
-rw-r--r--src/core/main.c4
-rw-r--r--src/udev/udev-builtin.c2
-rw-r--r--src/udev/udev.h4
8 files changed, 75 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am
index 11eaf863f5..5784962068 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -234,7 +234,6 @@ rootlibexec_PROGRAMS = \
systemd-update-utmp \
systemd-shutdownd \
systemd-shutdown \
- systemd-modules-load \
systemd-remount-fs \
systemd-reply-password \
systemd-fsck \
@@ -243,6 +242,11 @@ rootlibexec_PROGRAMS = \
systemd-sysctl \
systemd-sleep
+if HAVE_KMOD
+rootlibexec_PROGRAMS += \
+ systemd-modules-load
+endif
+
systemgenerator_PROGRAMS = \
systemd-getty-generator \
systemd-fstab-generator \
@@ -323,7 +327,6 @@ nodist_systemunit_DATA = \
units/console-getty.service \
units/systemd-initctl.service \
units/systemd-shutdownd.service \
- units/systemd-modules-load.service \
units/systemd-remount-fs.service \
units/systemd-update-utmp-runlevel.service \
units/systemd-update-utmp-shutdown.service \
@@ -349,6 +352,11 @@ nodist_systemunit_DATA = \
units/systemd-udev-settle.service \
units/debug-shell.service
+if HAVE_KMOD
+nodist_systemunit_DATA += \
+ units/systemd-modules-load.service
+endif
+
dist_userunit_DATA = \
units/user/default.target \
units/user/exit.target
@@ -364,7 +372,6 @@ EXTRA_DIST += \
units/rescue.service.m4.in \
units/systemd-initctl.service.in \
units/systemd-shutdownd.service.in \
- units/systemd-modules-load.service.in \
units/systemd-remount-fs.service.in \
units/systemd-update-utmp-runlevel.service.in \
units/systemd-update-utmp-shutdown.service.in \
@@ -393,6 +400,11 @@ EXTRA_DIST += \
introspect.awk \
man/custom-html.xsl
+if HAVE_KMOD
+EXTRA_DIST += \
+ units/systemd-modules-load.service.in
+endif
+
if TARGET_FEDORA
dist_systemunit_DATA += \
units/fedora/rc-local.service \
@@ -481,8 +493,6 @@ MANPAGES = \
man/locale.conf.5 \
man/os-release.5 \
man/machine-info.5 \
- man/modules-load.d.5 \
- man/systemd-modules-load.service.8 \
man/sysctl.d.5 \
man/systemd-sysctl.service.8 \
man/systemd-ask-password.1 \
@@ -531,7 +541,6 @@ MANPAGES_ALIAS = \
man/reboot.8 \
man/poweroff.8 \
man/init.1 \
- man/systemd-modules-load.8 \
man/systemd-sysctl.8 \
man/systemd-journald.socket.8 \
man/systemd-journald.8 \
@@ -603,10 +612,18 @@ MANPAGES_ALIAS = \
man/sd_journal_restart_unique.3 \
man/SD_JOURNAL_FOREACH_UNIQUE.3
+if HAVE_KMOD
+MANPAGES += \
+ man/modules-load.d.5 \
+ man/systemd-modules-load.service.8
+MANPAGES_ALIAS += \
+ man/systemd-modules-load.8
+man/systemd-modules-load.8: man/systemd-modules-load.service.8
+endif
+
man/reboot.8: man/halt.8
man/poweroff.8: man/halt.8
man/init.1: man/systemd.1
-man/systemd-modules-load.8: man/systemd-modules-load.service.8
man/systemd-sysctl.8: man/systemd-sysctl.service.8
man/systemd-journald.socket.8: man/systemd-journald.service.8
man/systemd-journald.8: man/systemd-journald.service.8
@@ -1015,8 +1032,6 @@ libsystemd_core_la_SOURCES = \
src/core/selinux-setup.h \
src/core/ima-setup.c \
src/core/ima-setup.h \
- src/core/kmod-setup.c \
- src/core/kmod-setup.h \
src/core/locale-setup.h \
src/core/locale-setup.c \
src/core/hostname-setup.c \
@@ -1052,6 +1067,12 @@ libsystemd_core_la_SOURCES = \
src/core/audit-fd.c \
src/core/audit-fd.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 \
@@ -1406,6 +1427,7 @@ systemd_shutdown_LDADD = \
libsystemd-shared.la \
libudev.la
+if HAVE_KMOD
# ------------------------------------------------------------------------------
systemd_modules_load_SOURCES = \
src/modules-load/modules-load.c
@@ -1417,6 +1439,7 @@ systemd_modules_load_CFLAGS = \
systemd_modules_load_LDADD = \
libsystemd-shared.la \
$(KMOD_LIBS)
+endif
# ------------------------------------------------------------------------------
systemd_tmpfiles_SOURCES = \
@@ -1836,9 +1859,13 @@ dist_udevrules_DATA += \
rules/75-net-description.rules \
rules/75-tty-description.rules \
rules/78-sound-card.rules \
- rules/80-drivers.rules \
rules/95-udev-late.rules
+if HAVE_KMOD
+dist_udevrules_DATA += \
+ rules/80-drivers.rules
+endif
+
dist_udevhwdb_DATA = \
hwdb/20-pci-vendor-product.hwdb \
hwdb/20-pci-classes.hwdb \
@@ -1904,7 +1931,6 @@ libudev_core_la_SOURCES = \
src/udev/udev-builtin-firmware.c \
src/udev/udev-builtin-hwdb.c \
src/udev/udev-builtin-input_id.c \
- src/udev/udev-builtin-kmod.c \
src/udev/udev-builtin-net_id.c \
src/udev/udev-builtin-path_id.c \
src/udev/udev-builtin-usb_id.c \
@@ -1926,6 +1952,11 @@ libudev_core_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DFIRMWARE_PATH="$(FIRMWARE_PATH)"
+if HAVE_KMOD
+libudev_core_la_SOURCES += \
+ src/udev/udev-builtin-kmod.c
+endif
+
if HAVE_BLKID
libudev_core_la_SOURCES += \
src/udev/udev-builtin-blkid.c
@@ -4026,7 +4057,6 @@ systemd-install-data-hook:
sys-kernel-config.mount \
sys-kernel-debug.mount \
sys-fs-fuse-connections.mount \
- systemd-modules-load.service \
systemd-tmpfiles-setup.service \
systemd-sysctl.service \
systemd-ask-password-console.path && \
@@ -4035,7 +4065,6 @@ systemd-install-data-hook:
$(LN_S) ../sys-kernel-config.mount sys-kernel-config.mount && \
$(LN_S) ../sys-kernel-debug.mount sys-kernel-debug.mount && \
$(LN_S) ../sys-fs-fuse-connections.mount sys-fs-fuse-connections.mount && \
- $(LN_S) ../systemd-modules-load.service systemd-modules-load.service && \
$(LN_S) ../systemd-tmpfiles-setup.service systemd-tmpfiles-setup.service && \
$(LN_S) ../systemd-sysctl.service systemd-sysctl.service && \
$(LN_S) ../systemd-ask-password-console.path systemd-ask-password-console.path )
@@ -4046,6 +4075,13 @@ systemd-install-data-hook:
rm -f org.freedesktop.systemd1.service && \
$(LN_S) ../system-services/org.freedesktop.systemd1.service org.freedesktop.systemd1.service )
+if HAVE_KMOD
+ ( cd $(DESTDIR)$(systemunitdir)/sysinit.target.wants && \
+ rm -f systemd-modules-load.service && \
+ $(LN_S) ../systemd-modules-load.service systemd-modules-load.service )
+endif
+
+
if TARGET_FEDORA
( cd $(DESTDIR)$(systemunitdir) && \
rm -f display-manager.service single.service && \
diff --git a/README b/README
index bcb4371cc2..8210f5e593 100644
--- a/README
+++ b/README
@@ -40,8 +40,8 @@ REQUIREMENTS:
optional but strongly recommended: autofs4, ipv6
dbus >= 1.4.0
libcap
- libblkid >= 2.20 (from util-linux)
- libkmod >= 5
+ libblkid >= 2.20 (from util-linux) (optional)
+ libkmod >= 5 (optional)
PAM >= 1.1.2 (optional)
libcryptsetup (optional)
libaudit (optional)
diff --git a/configure.ac b/configure.ac
index 437ca6025c..ea4f44cef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -193,7 +193,18 @@ AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at], [], [], [[#include <sys/
m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2])
-PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
+
+# ------------------------------------------------------------------------------
+have_kmod=no
+AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules support]))
+if test "x$enable_kmod" != "xno"; then
+ PKG_CHECK_MODULES(KMOD, [ libkmod >= 5 ],
+ [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available]) have_kmod=yes], have_kmod=no)
+ if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
+ AC_MSG_ERROR([*** kmod support requested but libraries not found])
+ fi
+fi
+AM_CONDITIONAL(HAVE_KMOD, [test "$have_kmod" = "yes"])
# ------------------------------------------------------------------------------
have_blkid=no
@@ -860,6 +871,7 @@ AC_MSG_RESULT([
timedated: ${have_timedated}
localed: ${have_localed}
coredump: ${have_coredump}
+ kmod: ${have_kmod}
blkid: ${have_blkid}
firmware path: ${FIRMWARE_PATH}
gudev: ${enable_gudev}
diff --git a/rules/75-probe_mtd.rules b/rules/75-probe_mtd.rules
index c0e0839785..8848aeeaed 100644
--- a/rules/75-probe_mtd.rules
+++ b/rules/75-probe_mtd.rules
@@ -3,6 +3,5 @@
ACTION!="add", GOTO="mtd_probe_end"
KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $devnode"
-KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl"
LABEL="mtd_probe_end"
diff --git a/rules/80-drivers.rules b/rules/80-drivers.rules
index 692510c912..a0615cc3b2 100644
--- a/rules/80-drivers.rules
+++ b/rules/80-drivers.rules
@@ -8,5 +8,6 @@ SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms
SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block"
SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block"
SUBSYSTEM=="module", KERNEL=="parport_pc", RUN{builtin}="kmod load ppdev"
+KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl"
LABEL="drivers_end"
diff --git a/src/core/main.c b/src/core/main.c
index 4da8ecb864..2fcd63d3e2 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -55,7 +55,9 @@
#include "mount-setup.h"
#include "loopback-setup.h"
+#ifdef HAVE_KMOD
#include "kmod-setup.h"
+#endif
#include "hostname-setup.h"
#include "machine-id-setup.h"
#include "locale-setup.h"
@@ -1574,7 +1576,9 @@ int main(int argc, char *argv[]) {
if (arg_show_status || plymouth_running())
status_welcome();
+#ifdef HAVE_KMOD
kmod_setup();
+#endif
hostname_setup();
machine_id_setup();
loopback_setup();
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index 26d65edd47..32e6e1e90c 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -37,7 +37,9 @@ static const struct udev_builtin *builtins[] = {
[UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
[UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
[UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
+#ifdef HAVE_KMOD
[UDEV_BUILTIN_KMOD] = &udev_builtin_kmod,
+#endif
[UDEV_BUILTIN_NET_ID] = &udev_builtin_net_id,
[UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id,
[UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id,
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 63de30c02d..32779ba486 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -141,7 +141,9 @@ enum udev_builtin_cmd {
UDEV_BUILTIN_FIRMWARE,
UDEV_BUILTIN_HWDB,
UDEV_BUILTIN_INPUT_ID,
+#ifdef HAVE_KMOD
UDEV_BUILTIN_KMOD,
+#endif
UDEV_BUILTIN_NET_ID,
UDEV_BUILTIN_PATH_ID,
UDEV_BUILTIN_USB_ID,
@@ -166,7 +168,9 @@ extern const struct udev_builtin udev_builtin_btrfs;
extern const struct udev_builtin udev_builtin_firmware;
extern const struct udev_builtin udev_builtin_hwdb;
extern const struct udev_builtin udev_builtin_input_id;
+#ifdef HAVE_KMOD
extern const struct udev_builtin udev_builtin_kmod;
+#endif
extern const struct udev_builtin udev_builtin_net_id;
extern const struct udev_builtin udev_builtin_path_id;
extern const struct udev_builtin udev_builtin_usb_id;