chiark / gitweb /
udev: make firmware loading optional and disable by default
authorTom Gundersen <teg@jklm.no>
Mon, 18 Mar 2013 14:12:18 +0000 (15:12 +0100)
committerKay Sievers <kay@vrfy.org>
Mon, 18 Mar 2013 14:19:51 +0000 (15:19 +0100)
Distros that whish to support old kernels should set
  --with-firmware-dirs="/usr/lib/firmware/updates:/usr/lib/firmware"
to retain the old behaviour.

Makefile.am
configure.ac
rules/50-firmware.rules [new file with mode: 0644]
rules/50-udev-default.rules
shell-completion/bash/udevadm
src/udev/udev-builtin.c
src/udev/udev.h

index 7e9cdfd..37eeb01 100644 (file)
@@ -1352,12 +1352,10 @@ rootlibexec_PROGRAMS += \
 
 nodist_systemunit_DATA += \
        units/systemd-modules-load.service
+
 SYSINIT_TARGET_WANTS += \
        systemd-modules-load.service
 
-dist_udevrules_DATA += \
-       rules/80-drivers.rules
-
 endif
 
 EXTRA_DIST += \
@@ -1809,7 +1807,6 @@ libudev_core_la_SOURCES = \
        src/udev/udev-ctrl.c \
        src/udev/udev-builtin.c \
        src/udev/udev-builtin-btrfs.c \
-       src/udev/udev-builtin-firmware.c \
        src/udev/udev-builtin-hwdb.c \
        src/udev/udev-builtin-input_id.c \
        src/udev/udev-builtin-net_id.c \
@@ -1833,9 +1830,20 @@ libudev_core_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -DFIRMWARE_PATH="$(FIRMWARE_PATH)"
 
+if ENABLE_FIRMWARE
+libudev_core_la_SOURCES += \
+       src/udev/udev-builtin-firmware.c
+
+dist_udevrules_DATA += \
+       rules/50-firmware.rules
+endif
+
 if HAVE_KMOD
 libudev_core_la_SOURCES += \
        src/udev/udev-builtin-kmod.c
+
+dist_udevrules_DATA += \
+       rules/80-drivers.rules
 endif
 
 if HAVE_BLKID
index 28d7286..14411e3 100644 (file)
@@ -705,8 +705,8 @@ AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
 # ------------------------------------------------------------------------------
 AC_ARG_WITH(firmware-path,
        AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
-          [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]),
-       [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
+          [Firmware search path (default="")]),
+       [], [with_firmware_path=""])
 OLD_IFS=$IFS
 IFS=:
 for i in $with_firmware_path; do
@@ -717,7 +717,8 @@ for i in $with_firmware_path; do
        fi
 done
 IFS=$OLD_IFS
-AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
+AC_SUBST(FIRMWARE_PATH)
+AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
 
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([gudev],
diff --git a/rules/50-firmware.rules b/rules/50-firmware.rules
new file mode 100644 (file)
index 0000000..f0ae684
--- /dev/null
@@ -0,0 +1,3 @@
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM=="firmware", ACTION=="add", RUN{builtin}="firmware"
index 5d8bde5..9d17cf7 100644 (file)
@@ -64,5 +64,4 @@ SUBSYSTEM=="virtio-ports", KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-
 
 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id", IMPORT{builtin}="hwdb --subsystem=usb"
 SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id"
-SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware"
 ENV{MODALIAS}!="", IMPORT{builtin}="hwdb --subsystem=$env{SUBSYSTEM}"
index a31d465..123fb51 100644 (file)
@@ -93,7 +93,7 @@ _udevadm() {
                 fi
 
         elif __contains_word "$verb" ${VERBS[TESTBUILTIN]}; then
-                      comps='blkid btrfs firmware hwdb input_id kmod net_id path_id usb_id uaccess'
+                      comps='blkid btrfs hwdb input_id kmod net_id path_id usb_id uaccess'
         fi
 
         COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
index 57d75a1..13922d3 100644 (file)
@@ -34,7 +34,9 @@ static const struct udev_builtin *builtins[] = {
         [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
 #endif
         [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
+#ifdef ENABLE_FIRMWARE
         [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware,
+#endif
         [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
         [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
 #ifdef HAVE_KMOD
index b54cb58..aa2edbe 100644 (file)
@@ -140,7 +140,9 @@ enum udev_builtin_cmd {
         UDEV_BUILTIN_BLKID,
 #endif
         UDEV_BUILTIN_BTRFS,
+#ifdef ENABLE_FIRMWARE
         UDEV_BUILTIN_FIRMWARE,
+#endif
         UDEV_BUILTIN_HWDB,
         UDEV_BUILTIN_INPUT_ID,
 #ifdef HAVE_KMOD
@@ -167,7 +169,9 @@ struct udev_builtin {
 extern const struct udev_builtin udev_builtin_blkid;
 #endif
 extern const struct udev_builtin udev_builtin_btrfs;
+#ifdef ENABLE_FIRMWARE
 extern const struct udev_builtin udev_builtin_firmware;
+#endif
 extern const struct udev_builtin udev_builtin_hwdb;
 extern const struct udev_builtin udev_builtin_input_id;
 #ifdef HAVE_KMOD