mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-11-23 23:10:57 +07:00
Permit users to disable module loading support
Inspired by e30431623a7d871da123cc37055ac49abf2c20ea from systemd. Signed-off-by: Richard Yao <ryao@gentoo.org>
This commit is contained in:
parent
c4d1ce9b75
commit
3bb4e05ce4
18
configure.ac
18
configure.ac
@ -275,12 +275,18 @@ AC_SUBST([rootprefix], [$with_rootprefix])
|
||||
AC_SUBST([rootlibdir], [$with_rootlibdir])
|
||||
AC_SUBST([udevlibexecdir], [${with_rootlibdir}/udev])
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
AC_ARG_ENABLE([libkmod], [AS_HELP_STRING([--enable-libkmod], [Enable module loading through kmod @<:@default=disabled@:>@])], [], [with_libkmod=no])
|
||||
|
||||
LIBKMOD=
|
||||
AS_IF([test "x$with_libkmod" != xno],
|
||||
AC_ARG_ENABLE([modules], [AS_HELP_STRING([--disable-modules], [Disable loadable module support @<:@default=enabled@:>@])], [have_modules=no], [have_modules=yes])
|
||||
AC_ARG_ENABLE([libkmod], [AS_HELP_STRING([--enable-libkmod], [Enable module loading through kmod @<:@default=disabled@:>@])], [have_libkmod=yes], [have_libkmod=no])
|
||||
|
||||
if test "x$have_modules" == "xyes"; then
|
||||
|
||||
AC_DEFINE([HAVE_MODULES], [1], [Define if we support loading modules])
|
||||
|
||||
AS_IF([test "x$have_libkmod" != xno],
|
||||
[AC_CHECK_LIB([kmod], [main],
|
||||
[PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
|
||||
AC_SUBST([LIBKMOD], ["-lkmod"])
|
||||
@ -291,7 +297,11 @@ AS_IF([test "x$with_libkmod" != xno],
|
||||
[--with-libkmod was given, but test for kmod failed])],
|
||||
[-lkmod])])
|
||||
|
||||
AM_CONDITIONAL([HAVE_LIBKMOD], [test "$with_kmod" = "yes"])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_MODULES], [test "x$have_modules" == "xyes"])
|
||||
AM_CONDITIONAL([HAVE_LIBKMOD], [test "x$have_libkmod" == "xyes"])
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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"
|
||||
|
@ -3,6 +3,7 @@
|
||||
ACTION=="remove", GOTO="drivers_end"
|
||||
|
||||
DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}"
|
||||
KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl"
|
||||
SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd"
|
||||
SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms"
|
||||
SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block"
|
||||
|
@ -20,9 +20,13 @@ dist_udevrules_DATA = \
|
||||
75-probe_mtd.rules \
|
||||
75-tty-description.rules \
|
||||
78-sound-card.rules \
|
||||
80-drivers.rules \
|
||||
95-udev-late.rules
|
||||
|
||||
if HAVE_MODULES
|
||||
dist_udevrules_DATA += \
|
||||
80-drivers.rules
|
||||
endif
|
||||
|
||||
if ENABLE_KEYMAP
|
||||
dist_udevrules_DATA += \
|
||||
95-keymap.rules \
|
||||
|
@ -50,7 +50,6 @@ libudev_core_la_SOURCES = \
|
||||
udev-builtin-firmware.c \
|
||||
udev-builtin-hwdb.c \
|
||||
udev-builtin-input_id.c \
|
||||
udev-builtin-kmod.c \
|
||||
udev-builtin-net_id.c \
|
||||
udev-builtin-path_id.c \
|
||||
udev-builtin-usb_id.c \
|
||||
@ -104,17 +103,19 @@ libudev_core_la_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(BLKID_CFLAGS)
|
||||
|
||||
if HAVE_LIBKMOD
|
||||
libudev_core_la_CFLAGS += $(KMOD_CFLAGS)
|
||||
endif
|
||||
|
||||
libudev_core_la_LIBADD = \
|
||||
$(top_builddir)/src/libudev/libudev-private.la \
|
||||
$(BLKID_LIBS)
|
||||
|
||||
if HAVE_MODULES
|
||||
libudev_core_la_SOURCES += \
|
||||
udev-builtin-kmod.c
|
||||
|
||||
if HAVE_LIBKMOD
|
||||
libudev_core_la_CFLAGS += $(KMOD_CFLAGS)
|
||||
libudev_core_la_LIBADD += $(KMOD_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
if HAVE_ACL
|
||||
libudev_core_la_SOURCES += \
|
||||
|
@ -35,7 +35,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_MODULES
|
||||
[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,
|
||||
|
@ -139,7 +139,9 @@ enum udev_builtin_cmd {
|
||||
UDEV_BUILTIN_FIRMWARE,
|
||||
UDEV_BUILTIN_HWDB,
|
||||
UDEV_BUILTIN_INPUT_ID,
|
||||
#ifdef HAVE_MODULES
|
||||
UDEV_BUILTIN_KMOD,
|
||||
#endif
|
||||
UDEV_BUILTIN_NET_ID,
|
||||
UDEV_BUILTIN_PATH_ID,
|
||||
UDEV_BUILTIN_USB_ID,
|
||||
@ -162,7 +164,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_MODULES
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user