Skip to contentSkip to conversation

Introduce libudev (branch yem/libudev-4)

PATCH Superseded Yann E. MORIN 4 participants 33 messages Jul 11, 2016 – Aug 13, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Hello All!

This series introduces the possibility to just build and install libudev, without requiring that the /dev management be handled by eudev or systemd.

A lot of packages that have a dependency on udev, in fact only require a libudev, not a udev daemon. That's the case for e.g. libinput, libcec, mesa3d...

During previous developers days, it was suggested that libudev was to be made a virtual package that could be selected (like jpeg is). So I eventually got some time to rework it (since the series was not adopted by Peter as it was discussed during those DevDays:
https://lite5.framapad.org/p/buildrootfosdem15 ;-) ).

This series is a full rewrite from scratch, with very little caried over from the previous attempts (far back in the past).

- first come a few cleanup patches;

- then eudev is split in two, virtually providing to different packages in one, with two different configure/build/install procedures, one for libudev only, one for the full package;

- then the libudev virtual package is introduced, with eudev and

    systemd both declared as providers;

- libudev is made selectable, so that packages can select it instead

    of depending (like is usual) on the virtual package;

- eventually, two packages are converted over to using libudev:
qt5base, as an optional implicit dependency, and libinput, as a mandatory dependency.

Not all packages that reference udev have been switched over to depend on libudev, though, since it is unclear to me whether they require a udev daemon, or would be happy with just libudev. This can be done in follow up patches once libudev is eventually in the tree (for good this time I hope! ;-) )

Changes v7 -> v8:
- total rewrite
- libudev is selectable

Regards,
Yann E. MORIN.

The following changes since commit c2dacf7e07cc0434475518e6f57863c829e16d34

python-tomako: bump to version 0.1.0.post1 (2016-07-11 14:12:13 +0200)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to ed0dbe6a8b6bc7dfcfc5e665fe07f9360c2e7723

package/libinput: only needs libudev, not udev daemon (2016-07-11 23:50:34 +0200)

----------------------------------------------------------------
Yann E. MORIN (12):
package/eudev: explicitly disable rules generator if not wanted package/eudev: use the description on their home page package/eudev: add option to enable the udev daemon package/eudev: fix configure options
package/eudev: libgudev is no longer provided by eudev package/eudev: allow building only libudev package/libudev: new virtual package
package/eudev: provides libudev
package/systemd: provides libudev
package/libudev: make it selectable
package/qt5base: optionally use libudev package/libinput: only needs libudev, not udev daemon

 package/Config.in              |  1 +
 package/eudev/Config.in        | 60 +++++++++++++++++++++++++++---------
 package/eudev/eudev.mk         | 70 +++++++++++++++++++++++++++++++++---------
 package/libinput/Config.in     | 10 ++++--
 package/libudev/Config.in      | 13 ++++++++
 package/libudev/libudev.mk     |  7 +++++
 package/qt5/qt5base/qt5base.mk |  4 +--
 package/systemd/Config.in      |  4 +++
 package/systemd/systemd.mk     |  2 +-
 system/Config.in               |  1 +
 10 files changed, 137 insertions(+), 35 deletions(-)
 create mode 100644 package/libudev/Config.in
 create mode 100644 package/libudev/libudev.mk
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v8 1/12 package/eudev: explicitly disable rules generator if not wanted

---
 package/eudev/eudev.mk | 2 ++
 1 file changed, 2 insertions(+)
package/eudev/eudev.mk +2 -0
index 4818ea5..e3d3d63 100644
@@ -31,6 +31,8 @@ endif
 
 ifeq ($(BR2_PACKAGE_EUDEV_RULES_GEN),y)
 EUDEV_CONF_OPTS += --enable-rule-generator
+else
+EUDEV_CONF_OPTS += --disable-rule-generator
 endif
 
 ifeq ($(BR2_PACKAGE_EUDEV_ENABLE_HWDB),y)
Signature · 1 line
2.7.4
#2 lore raw

PATCH v8 1/12 package/eudev: explicitly disable rules generator if not wanted

Hello,

Quoted 4 lines · Yann E. MORIN
---
 package/eudev/eudev.mk | 2 ++
 1 file changed, 2 insertions(+)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v8 2/12 package/eudev: use the description on their home page

In reply to Yann E. MORIN
---
 package/eudev/Config.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
package/eudev/Config.in +4 -5
index cda06e7..6412675 100644
@@ -9,11 +9,10 @@ config BR2_PACKAGE_EUDEV
 	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
 	select BR2_PACKAGE_KMOD
 	help
-	  Userspace device daemon. This is a standalone version,
-	  independent of systemd. It is a fork maintained by Gentoo.
-
-	  eudev requires a Linux kernel >= 2.6.34: it relies on devtmpfs
-	  and inotify.
+	  eudev is a fork of systemd-udev with the goal of obtaining better
+	  compatibility with existing software such as OpenRC and Upstart,
+	  older kernels, various toolchains and anything else required by
+	  users and various distributions.
 
 	  https://wiki.gentoo.org/wiki/Project:Eudev
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH v8 2/12 package/eudev: use the description on their home page

Hello,

Quoted 4 lines · Yann E. MORIN
---
 package/eudev/Config.in | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v8 3/12 package/eudev: add option to enable the udev daemon

In reply to Yann E. MORIN

This is currently forcefully enabled, and does not (yet) change the way we handle eudev-based /dev/management, but will help introduce libudev in followup commits.

---
 package/eudev/Config.in | 21 ++++++++++++++++-----
 system/Config.in        |  1 +
 2 files changed, 17 insertions(+), 5 deletions(-)
package/eudev/Config.in +16 -5
index 6412675..f2d5725 100644
@@ -4,10 +4,7 @@ config BR2_PACKAGE_EUDEV
 	depends on BR2_USE_MMU # uses fork()
 	depends on BR2_USE_WCHAR # util-linux
 	depends on !BR2_STATIC_LIBS # kmod
-	select BR2_PACKAGE_HAS_UDEV
-	select BR2_PACKAGE_UTIL_LINUX
-	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
-	select BR2_PACKAGE_KMOD
+	select BR2_PACKAGE_EUDEV_DAEMON
 	help
 	  eudev is a fork of systemd-udev with the goal of obtaining better
 	  compatibility with existing software such as OpenRC and Upstart,
@@ -18,6 +15,18 @@ config BR2_PACKAGE_EUDEV
 
 if BR2_PACKAGE_EUDEV
 
+config BR2_PACKAGE_EUDEV_DAEMON
+	bool "udev daemon"
+	depends on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
+	select BR2_PACKAGE_HAS_UDEV
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
+	select BR2_PACKAGE_KMOD
+	help
+	  Install the udev daemon.
+
+if BR2_PACKAGE_EUDEV_DAEMON
+
 config BR2_PACKAGE_PROVIDES_UDEV
 	default "eudev"
 
@@ -32,7 +41,9 @@ config BR2_PACKAGE_EUDEV_ENABLE_HWDB
 	help
 	  Enables hardware database installation to /etc/udev/hwdb.d
 
-endif
+endif # BR2_PACKAGE_EUDEV_DAEMON
+
+endif # BR2_PACKAGE_EUDEV
 
 comment "eudev needs eudev /dev management"
 	depends on BR2_USE_MMU
system/Config.in +1 -0
index b895db9..26861a5 100644
@@ -129,6 +129,7 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_USE_MMU # eudev
 	select BR2_PACKAGE_EUDEV
+	select BR2_PACKAGE_EUDEV_DAEMON
 
 comment "eudev needs a toolchain w/ wchar, dynamic library"
 	depends on BR2_USE_MMU
Signature · 1 line
2.7.4
#6 lore raw

PATCH v8 4/12 package/eudev: fix configure options

In reply to Yann E. MORIN

--enable-libkmod does not exist, but there's --enable-kmod.

Also, add --enable-blkid to the list of options, since we already depend on it (from util-linux).

Also do not align \ for line continuations.

---
 package/eudev/eudev.mk | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
package/eudev/eudev.mk +8 -7
index e3d3d63..0fe96e8 100644
@@ -14,13 +14,14 @@ EUDEV_INSTALL_STAGING = YES
 # mq_getattr is in librt
 EUDEV_CONF_ENV += LIBS=-lrt
 
-EUDEV_CONF_OPTS =		\
-	--disable-manpages	\
-	--sbindir=/sbin		\
-	--libexecdir=/lib	\
-	--with-firmware-path=/lib/firmware	\
-	--disable-introspection			\
-	--enable-libkmod
+EUDEV_CONF_OPTS = \
+	--disable-manpages \
+	--sbindir=/sbin \
+	--libexecdir=/lib \
+	--with-firmware-path=/lib/firmware \
+	--disable-introspection \
+	--enable-kmod \
+	--enable-blkid
 
 EUDEV_DEPENDENCIES = host-gperf host-pkgconf util-linux kmod
 EUDEV_PROVIDES = udev
Signature · 1 line
2.7.4
#7 lore raw

PATCH v8 4/12 package/eudev: fix configure options

Hello,

Quoted 11 lines · Yann E. MORIN

--enable-libkmod does not exist, but there's --enable-kmod.

Also, add --enable-blkid to the list of options, since we already depend on it (from util-linux).

Also do not align \ for line continuations.

---
 package/eudev/eudev.mk | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#8 lore raw

PATCH v8 5/12 package/eudev: libgudev is no longer provided by eudev

In reply to Yann E. MORIN

libgudev is now provided by the the eponym package libgudev.

---
 package/eudev/eudev.mk | 7 -------
 1 file changed, 7 deletions(-)
package/eudev/eudev.mk +0 -7
index 0fe96e8..6c61660 100644
@@ -42,13 +42,6 @@ else
 EUDEV_CONF_OPTS += --disable-hwdb
 endif
 
-ifeq ($(BR2_PACKAGE_LIBGLIB2),y)
-EUDEV_CONF_OPTS += --enable-gudev
-EUDEV_DEPENDENCIES += libglib2
-else
-EUDEV_CONF_OPTS += --disable-gudev
-endif
-
 ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
 EUDEV_CONF_OPTS += --enable-selinux
 EUDEV_DEPENDENCIES += libselinux
Signature · 1 line
2.7.4
#9 lore raw

PATCH v8 5/12 package/eudev: libgudev is no longer provided by eudev

Hello,

Quoted 6 lines · Yann E. MORIN

libgudev is now provided by the the eponym package libgudev.

---
 package/eudev/eudev.mk | 7 -------
 1 file changed, 7 deletions(-)

Applied to master, thanks. I've also made an additional commit to libgudev Config.in file, to update a comment that was saying that libgudev was provided by eudev (which was no longer the case since eudev 3.1.3).

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#10 lore raw

PATCH v8 6/12 package/eudev: allow building only libudev

In reply to Yann E. MORIN

We need to move the kconfig symbol for the daemon outside of the eudev conditional block, or we would, later, ahve circular dependencies, like so (here, with libinput converted to use libudev):

package/udev/Config.in:1:error: recursive dependency detected!
package/udev/Config.in:1: symbol BR2_PACKAGE_HAS_UDEV is selected by BR2_PACKAGE_EUDEV_DAEMON
package/eudev/Config.in:1: symbol BR2_PACKAGE_EUDEV_DAEMON is selected by BR2_PACKAGE_EUDEV
package/eudev/Config.in:11: symbol BR2_PACKAGE_EUDEV is selected by BR2_PACKAGE_LIBUDEV
package/libudev/Config.in:1: symbol BR2_PACKAGE_LIBUDEV is selected by BR2_PACKAGE_LIBINPUT
package/libinput/Config.in:1: symbol BR2_PACKAGE_LIBINPUT is selected by BR2_PACKAGE_WESTON
package/weston/Config.in:6: symbol BR2_PACKAGE_WESTON depends on BR2_PACKAGE_HAS_UDEV

Although the chain is short, it is rather difficult to interpret. Basically, what this means is that, by way of successive 'select' and 'depends on', we get a circular dependency. In fact, kconfig is wrong here, since there is *no* way we could trigger this loop by enabling one of the incriminated symbol: its dependency tracking is limited to looking at the symbols, not whether they are negated or not (i.e. in the chanin above, a symbol is negated, and is only valid when another is false, thus avoiding the loop). But kconfig has no way to know that...

So, we trick it and break the loop, by moving the kconfig symbol for the eudev daemon outside of the eudev if-block and making it promptless.

Still, for the convenience of the user, we keep a dummy udev daemon prompt in that if-block, so that he knows the daemon is enabled.

Fix the comments on dependencies, since they are also hard-dependencies of eudev itself.

For wchar, the reason is that configure.ac wants to check for a C99-compliant compiler, and autoconf always emits test-code that contains wchar_t variables, even if that's not required at all by eudev. This is not solved by an autoreconf either, obviously.

For !static, libudev (and thus eudev) includes dlfcn.h, which only exists in toolchains that have dynamic library support. However, eudev does not use anything provided by dlfcn.h; removing this dependency can be done in a follow-up change.

---
 package/eudev/Config.in | 48 +++++++++++++++++++++++++++++++++---------------
 package/eudev/eudev.mk  | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 15 deletions(-)
package/eudev/Config.in +33 -15
index f2d5725..b24ee02 100644
@@ -1,31 +1,47 @@
+# This symbol is outside the eudev if-block, so that we do not have
+# a circular dependency in kconfig. Thus, we need the dummy symbol,
+# below, to inform the user that the daemon has indeed been enabled.
+config BR2_PACKAGE_EUDEV_DAEMON
+	bool
+	select BR2_PACKAGE_HAS_UDEV
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
+	select BR2_PACKAGE_KMOD
+	# We can select this has we're sure eudev is selected when we are.
+	select BR2_PACKAGE_EUDEV_DAEMON_DUMMY
+
 config BR2_PACKAGE_EUDEV
 	bool "eudev"
-	depends on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
-	depends on BR2_USE_MMU # uses fork()
-	depends on BR2_USE_WCHAR # util-linux
-	depends on !BR2_STATIC_LIBS # kmod
-	select BR2_PACKAGE_EUDEV_DAEMON
+	depends on !BR2_INIT_SYSTEMD
+	depends on BR2_USE_MMU # uses fork() (for daemon) and dlfcn.h (for libudev)
+	depends on BR2_USE_WCHAR # C99
+	depends on !BR2_STATIC_LIBS # dlfcn.h
 	help
 	  eudev is a fork of systemd-udev with the goal of obtaining better
 	  compatibility with existing software such as OpenRC and Upstart,
 	  older kernels, various toolchains and anything else required by
 	  users and various distributions.
 
+	  This option only installs the libudev library. If you want /dev
+	  to be managed with the udev daemon, see "/dev management" in the
+	  top-level menu "System configuration".
+
 	  https://wiki.gentoo.org/wiki/Project:Eudev
 
 if BR2_PACKAGE_EUDEV
 
-config BR2_PACKAGE_EUDEV_DAEMON
+comment "udev daemon needs eudev /dev management"
+	depends on !BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
+
+# See comment at top of file.
+config BR2_PACKAGE_EUDEV_DAEMON_DUMMY
 	bool "udev daemon"
 	depends on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
-	select BR2_PACKAGE_HAS_UDEV
-	select BR2_PACKAGE_UTIL_LINUX
-	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
-	select BR2_PACKAGE_KMOD
 	help
 	  Install the udev daemon.
 
-if BR2_PACKAGE_EUDEV_DAEMON
+# Use the dummy symbol for proper indentation
+if BR2_PACKAGE_EUDEV_DAEMON_DUMMY
 
 config BR2_PACKAGE_PROVIDES_UDEV
 	default "eudev"
@@ -45,10 +61,12 @@ endif # BR2_PACKAGE_EUDEV_DAEMON
 
 endif # BR2_PACKAGE_EUDEV
 
-comment "eudev needs eudev /dev management"
-	depends on BR2_USE_MMU
-	depends on !BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
-
 comment "eudev needs a toolchain w/ wchar, dynamic library"
 	depends on BR2_USE_MMU
+	depends on !BR2_INIT_SYSTEMD
 	depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS
+
+comment "eudev incompatible with systemd init"
+	depends on BR2_USE_MMU
+	depends on BR2_INIT_SYSTEMD
+	depends on BR2_USE_WCHAR && !BR2_STATIC_LIBS
package/eudev/eudev.mk +42 -0

52 lines not on this page · raw message

Signature · 1 line
2.7.4
#11 lore raw

PATCH v8 6/12 package/eudev: allow building only libudev

Am Tue, 12 Jul 2016 00:16:29 +0200 schrieb Yann E. MORIN:

Quoted 5 lines
---
 package/eudev/Config.in | 48 +++++++++++++++++++++++++++++++++---------------
 package/eudev/eudev.mk  | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 15 deletions(-)

(run-time tested libdrm, mesa3d, libcec & kodi 17 using libudev
on a system using BR2_ROOTFS_DEVICE_CREATION_STATIC=y)

#12 lore raw

PATCH v8 7/12 package/libudev: new virtual package

In reply to Yann E. MORIN
---
 package/Config.in          | 1 +
 package/libudev/Config.in  | 6 ++++++
 package/libudev/libudev.mk | 7 +++++++
 3 files changed, 14 insertions(+)
 create mode 100644 package/libudev/Config.in
 create mode 100644 package/libudev/libudev.mk
package/Config.in +1 -0
index 1910251..910d386 100644
@@ -392,6 +392,7 @@ endmenu
 	source "package/iucode-tool/Config.in"
 	source "package/kbd/Config.in"
 	source "package/lcdproc/Config.in"
+	source "package/libudev/Config.in"
 	source "package/libuio/Config.in"
 	source "package/libump/Config.in"
 	source "package/linux-backports/Config.in"
package/libudev/Config.in new file +6 -0
new file mode 100644
index 0000000..2745fcc
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HAS_LIBUDEV
+	bool
+
+config BR2_PACKAGE_PROVIDES_LIBUDEV
+	depends on BR2_PACKAGE_HAS_LIBUDEV
+	string
package/libudev/libudev.mk new file +7 -0
new file mode 100644
index 0000000..af1b3dd
@@ -0,0 +1,7 @@
+################################################################################
+#
+# libudev
+#
+################################################################################
+
+$(eval $(virtual-package))
Signature · 1 line
2.7.4
#13 lore raw

PATCH v8 7/12 package/libudev: new virtual package

Am Tue, 12 Jul 2016 00:16:30 +0200 schrieb Yann E. MORIN:

Quoted 5 lines
---
 package/Config.in          | 1 +
 package/libudev/Config.in  | 6 ++++++
 package/libudev/libudev.mk | 7 +++++++

(run-time tested libdrm, mesa3d, libcec & kodi 17 using libudev
on a system using BR2_ROOTFS_DEVICE_CREATION_STATIC=y)

#14 lore raw

PATCH v8 8/12 package/eudev: provides libudev

In reply to Yann E. MORIN
---
 package/eudev/Config.in | 4 ++++
 package/eudev/eudev.mk  | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)
package/eudev/Config.in +4 -0
index b24ee02..3695143 100644
@@ -16,6 +16,7 @@ config BR2_PACKAGE_EUDEV
 	depends on BR2_USE_MMU # uses fork() (for daemon) and dlfcn.h (for libudev)
 	depends on BR2_USE_WCHAR # C99
 	depends on !BR2_STATIC_LIBS # dlfcn.h
+	select BR2_PACKAGE_HAS_LIBUDEV
 	help
 	  eudev is a fork of systemd-udev with the goal of obtaining better
 	  compatibility with existing software such as OpenRC and Upstart,
@@ -30,6 +31,9 @@ config BR2_PACKAGE_EUDEV
 
 if BR2_PACKAGE_EUDEV
 
+config BR2_PACKAGE_PROVIDES_LIBUDEV
+	default "eudev"
+
 comment "udev daemon needs eudev /dev management"
 	depends on !BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV
 
package/eudev/eudev.mk +3 -1
index a4c8ebf..27d88f8 100644
@@ -11,6 +11,8 @@ EUDEV_LICENSE = GPLv2+ (programs), LGPLv2.1+ (libraries)
 EUDEV_LICENSE_FILES = COPYING
 EUDEV_INSTALL_STAGING = YES
 
+EUDEV_PROVIDES = libudev
+
 ifeq ($(BR2_PACKAGE_EUDEV_DAEMON),y)
 
 # mq_getattr is in librt
@@ -26,7 +28,7 @@ EUDEV_CONF_OPTS = \
 	--enable-blkid
 
 EUDEV_DEPENDENCIES = host-gperf host-pkgconf util-linux kmod
-EUDEV_PROVIDES = udev
+EUDEV_PROVIDES += udev
 
 ifeq ($(BR2_ROOTFS_MERGED_USR),)
 EUDEV_CONF_OPTS += --with-rootlibdir=/lib --enable-split-usr
Signature · 1 line
2.7.4
#16 lore raw

PATCH v8 9/12 package/systemd: provides libudev

In reply to Yann E. MORIN
---
 package/systemd/Config.in  | 4 ++++
 package/systemd/systemd.mk | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
package/systemd/Config.in +4 -0
index ddaf3e2..ff685f8 100644
@@ -14,6 +14,7 @@ menuconfig BR2_PACKAGE_SYSTEMD
 	depends on !BR2_STATIC_LIBS # kmod
 	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus
 	depends on BR2_USE_MMU # dbus
+	select BR2_PACKAGE_HAS_LIBUDEV
 	select BR2_PACKAGE_HAS_UDEV
 	select BR2_PACKAGE_DBUS # runtime dependency only
 	select BR2_PACKAGE_LIBCAP
@@ -66,6 +67,9 @@ menuconfig BR2_PACKAGE_SYSTEMD
 
 if BR2_PACKAGE_SYSTEMD
 
+config BR2_PACKAGE_PROVIDES_LIBUDEV
+	default "systemd"
+
 config BR2_PACKAGE_PROVIDES_UDEV
 	default "systemd"
 
package/systemd/systemd.mk +1 -1
index 689b40d..9073299 100644
@@ -16,7 +16,7 @@ SYSTEMD_DEPENDENCIES = \
 	kmod \
 	host-gperf
 
-SYSTEMD_PROVIDES = udev
+SYSTEMD_PROVIDES = libudev udev
 SYSTEMD_AUTORECONF = YES
 
 # Make sure that systemd will always be built after busybox so that we have
Signature · 1 line
2.7.4
#17 lore raw

PATCH v8 10/12 package/libudev: make it selectable

In reply to Yann E. MORIN

Usually, it is not possible for a pacakge to select a virtual package it depends on, and expects a provider to suddenly be available.

However, for libudev, this is slightly simpler: there will be only two providers ever: eudev and systemd. Both are incompatible one with the other, systemd is only available if chosen as an init system.

So, if systemd is not enabled (as an init system), then we can forcefully enable eudev as the provider for libudev.

---
 package/libudev/Config.in | 7 +++++++
 1 file changed, 7 insertions(+)
package/libudev/Config.in +7 -0
index 2745fcc..036adce 100644
@@ -1,3 +1,10 @@
+config BR2_PACKAGE_LIBUDEV
+	bool
+	depends on BR2_USE_MMU # eudev / systemd
+	depends on BR2_USE_WCHAR # eudev / systemd
+	depends on !BR2_STATIC_LIBS # eudev / systemd
+	select BR2_PACKAGE_EUDEV if !BR2_PACKAGE_SYSTEMD
+
 config BR2_PACKAGE_HAS_LIBUDEV
 	bool
 
Signature · 1 line
2.7.4
#18 lore raw

PATCH v8 10/12 package/libudev: make it selectable

Am Tue, 12 Jul 2016 00:16:33 +0200 schrieb Yann E. MORIN:

Quoted 2 lines
 package/libudev/Config.in | 7 +++++++
 1 file changed, 7 insertions(+)

(run-time tested libdrm, mesa3d, libcec & kodi 17 using libudev
on a system using BR2_ROOTFS_DEVICE_CREATION_STATIC=y)

#19 lore raw

PATCH v8 11/12 package/qt5base: optionally use libudev

In reply to Yann E. MORIN

qt5base only requires libudev, not a full udev daemon.

---
 package/qt5/qt5base/qt5base.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/qt5/qt5base/qt5base.mk +2 -2
index bf541b0..1b46a31 100644
@@ -59,8 +59,8 @@ ifneq ($(QT5BASE_CONFIG_FILE),)
 QT5BASE_CONFIGURE_OPTS += -qconfig buildroot
 endif
 
-ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
-QT5BASE_DEPENDENCIES += udev
+ifeq ($(BR2_PACKAGE_HAS_LIBUDEV),y)
+QT5BASE_DEPENDENCIES += libudev
 endif
 
 # Qt5 SQL Plugins
Signature · 1 line
2.7.4
#20 lore raw

PATCH v8 12/12 package/libinput: only needs libudev, not udev daemon

In reply to Yann E. MORIN
---
 package/libinput/Config.in | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
package/libinput/Config.in +7 -3
index f7793df..58e70c8 100644
@@ -1,9 +1,12 @@
 config BR2_PACKAGE_LIBINPUT
 	bool "libinput"
+	depends on BR2_USE_MMU # libudev <- eudev/systemd
+	depends on BR2_USE_WCHAR # libudev <- eudev/systemd
+	depends on !BR2_STATIC_LIBS # libudev <- eudev/systemd
 	depends on BR2_ENABLE_LOCALE
-	depends on BR2_PACKAGE_HAS_UDEV
 	select BR2_PACKAGE_LIBEVDEV
 	select BR2_PACKAGE_MTDEV
+	select BR2_PACKAGE_LIBUDEV
 	help
 	  libinput is a library to handle input devices in Wayland
 	  compositors and to provide a generic X.Org input driver.
@@ -14,5 +17,6 @@ config BR2_PACKAGE_LIBINPUT
 
 	  http://freedesktop.org/wiki/Software/libinput/
 
-comment "libinput needs udev /dev management and a toolchain w/ locale"
-	depends on !BR2_PACKAGE_HAS_UDEV || !BR2_ENABLE_LOCALE
+comment "libinput needs a toolchain w/ locale, wchar, dynamic library"
+	depends on BR2_USE_MMU
+	depends on !BR2_ENABLE_LOCALE || !BR2_USE_WCHAR || BR2_STATIC_LIBS
Signature · 1 line
2.7.4
#21 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

In reply to Yann E. MORIN

[posted and mailed]

Hi Yann,

"Yann E. MORIN" <[email protected]> wrote in news:cover.1468274498.git.yann.morin.1998 at free.fr:

Quoted 5 lines

Not all packages that reference udev have been switched over to depend on libudev, though, since it is unclear to me whether they require a udev daemon, or would be happy with just libudev. This can be done in follow up patches once libudev is eventually in the tree (for good this time I hope! ;-) )

great to see the libudev patch series revived :)

I included your patch series in my buildroot repo and added four patches for libdrm, mesa3d, kodi and libcec, they do not need a udev daemon

https://github.com/bkuhls/buildroot/commits/libudev

* 4cb2069 - package/libdrm: optionally use libudev
* de1f466 - package/mesa3d: optionally use libudev
* 360d492 - package/kodi: libcec support only needs libudev, not udev daemon
* a6c4a70 - package/libcec: optionally use libudev

Feel free to pick them up to your patch series if you like.

On my kodi17 branch you will find the patches from the libudev branch as well
https://github.com/bkuhls/buildroot/commits/kodi17

Regards, Bernd

#22 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Bernd, All,

Quoted 1 line

[posted and mailed]

This is an annoyance: the way you reply means that messages arrive in duplicate to me: one is directed at the list only (as To:) and the other to me only (as To:). So when I replied to the personal reply, the list was not in Cc:. This is annoying... :-/

What is the reason to use an NNTP client to handle a mailing list (i.e. mails!) ? Can't you use a mail client instead?

Anyway, here is the message respun with the list in Cc: this time...

On 2016-07-12 22:16 +0200, Bernd Kuhls spake thusly:

Quoted 10 lines

"Yann E. MORIN" <[email protected]> wrote

Quoted 8 lines

Not all packages that reference udev have been switched over to depend
on libudev, though, since it is unclear to me whether they require a udev daemon, or would be happy with just libudev. This can be done in
follow up patches once libudev is eventually in the tree (for good this
time I hope! ;-) )

great to see the libudev patch series revived :)

Yeah, I was getting quite fed up with carrying this series and rebasing it over and over again for the past two years or so... ;-)

Not that this is my oldest series, either! :-/

Quoted 3 lines

I included your patch series in my buildroot repo and added four patches
for libdrm, mesa3d, kodi and libcec, they do not need a udev daemon

[--SNIP--]

Quoted 1 line

Feel free to pick them up to your patch series if you like.

Well, rather than accumulate patches in this series, I'd rather we focus on the core of it: building a stand-alone libudev.

I only included two converted packages in this series, as an example of what it could be used as: a package that selects it and a package that optionally depends on it.

Once libudev is in the tree, then we can look at converting more packages.

Quoted 3 lines

On my kodi17 branch you will find the patches from the libudev branch as well
https://github.com/bkuhls/buildroot/commits/kodi17

Oh, so you already have been testing this series, then?

Would you care doing a review of it, possibly even just "tested-by" tags would be a good indication that they work in your case too, so that the maintainers have more confidence in it, that it is useful.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#23 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Hi,

Am Tue, 12 Jul 2016 22:49:12 +0200 schrieb Yann E. MORIN:

Quoted 2 lines

Once libudev is in the tree, then we can look at converting more packages.

ok.

Quoted 5 lines
Quoted 3 lines

On my kodi17 branch you will find the patches from the libudev branch as well
https://github.com/bkuhls/buildroot/commits/kodi17

Oh, so you already have been testing this series, then?

Today I booted my Kodi rig with your patch series providing libudev, everything works fine, thanks!

Quoted 3 lines

Would you care doing a review of it, possibly even just "tested-by" tags would be a good indication that they work in your case too, so that the maintainers have more confidence in it, that it is useful.

Done.

Regards, Bernd

#24 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

In reply to Yann E. MORIN

Hello,

Quoted 3 lines · Yann E. MORIN

This series introduces the possibility to just build and install libudev, without requiring that the /dev management be handled by eudev or systemd.

Thanks. However, I am still not sure that the usefulness vs. complexity ratio of this patch series is big enough to have it merged.

I compared the installed size of a minimal uClibc system with just libudev, and a minimal uClibc system with eudev:

* Minimal uClibc system with just libudev: 1.8 MB
* Minimal uClibc system with eudev: 3.0 MB [1] [2]

[1] After removing the locales from usr/share/locale
[2] It would be further reduced to 2.8 MB by removing udevadm

So, there is indeed a 1.2 MB difference, but:

* This comparison is done without adding any "libudev" user, which would make the difference in percentage smaller.

* Many packages that use libudev are not small things (think mesa3d). For example, if you build libcec, the difference is then only 3.4 MB with full eudev against 2.4 MB with just libudev. And libcec is rarely used without a much bigger graphical framework to use it.

So I'm not sure if it's really worth the effort. After all, installing only libudev without eudev is not really supported upstream (we have to trick by building only some subdirectories).

I'm not entirely decided yet, so I'm waiting for arguments. But I'm hesitating between merging this, or asking people who really care about this to simply remove the eudev daemon in a post-build script.

What do others think?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#25 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Thomas, All,

On 2016-07-16 15:47 +0200, Thomas Petazzoni spake thusly:

Quoted 10 lines · Yann E. MORIN
Quoted 3 lines

This series introduces the possibility to just build and install libudev, without requiring that the /dev management be handled by eudev or systemd.

Thanks. However, I am still not sure that the usefulness vs. complexity ratio of this patch series is big enough to have it merged.

I compared the installed size of a minimal uClibc system with just libudev, and a minimal uClibc system with eudev:

[--SNIP--]

Quoted 1 line

So, there is indeed a 1.2 MB difference, but:

That is *not* about size; I don't think I even ever made that point as a reason to have only libudev.

[--SNIP--]

Quoted 7 lines

So I'm not sure if it's really worth the effort. After all, installing only libudev without eudev is not really supported upstream (we have to trick by building only some subdirectories).

I'm not entirely decided yet, so I'm waiting for arguments. But I'm hesitating between merging this, or asking people who really care about this to simply remove the eudev daemon in a post-build script.

But then you would not have libudev if you use mdev or a static /dev.

Note that libudev is not about managing /dev. It is about providing an abstraction to device descriptions (e.g. type and so on) as well as events (like hotplug).

A udev daemon (be it from eudev or systemd) is about managing the content of /dev. For that it uses libudev to get the device descriptions and events, and matches that to a DB of rules to generate the entries in /dev.

Bernd has a (imho, valid) use-case about using only libudev without a udev daemon altogether; there *are* other similar cases.

For example, we now have support (and have pending patches) for some "containerisation" stuff, like docker and lxc. You can also see that Buildroot can be used to generate lightweight containers. Such containers need not have a udev daemon of their own (the system has one, and /dev is bind-mounted into the container); however, an application inside that container will need to have access to the device "DB" and events, thus needs libudev.

There are various other use-cases...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#26 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Hello,

Quoted 2 lines · Yann E. MORIN

That is *not* about size; I don't think I even ever made that point as a reason to have only libudev.

OK, then I really don't see the point.

Quoted 9 lines
Quoted 7 lines

So I'm not sure if it's really worth the effort. After all, installing only libudev without eudev is not really supported upstream (we have to trick by building only some subdirectories).

I'm not entirely decided yet, so I'm waiting for arguments. But I'm hesitating between merging this, or asking people who really care about this to simply remove the eudev daemon in a post-build script.

But then you would not have libudev if you use mdev or a static /dev.

Correct. But why would you want mdev or a static /dev absolutely if you need udev?

Quoted 3 lines

Note that libudev is not about managing /dev. It is about providing an abstraction to device descriptions (e.g. type and so on) as well as events (like hotplug).

Right, but libudev is provided by eudev, and it does both, without even providing a configure option to build either one or the other.

Quoted 7 lines

A udev daemon (be it from eudev or systemd) is about managing the content of /dev. For that it uses libudev to get the device descriptions and events, and matches that to a DB of rules to generate the entries in /dev.

Bernd has a (imho, valid) use-case about using only libudev without a udev daemon altogether; there *are* other similar cases.

You still don't explain which use-case is that. You keep saying that Bernd wants to use libudev without the udev daemon, but you don't explain *why*.

As far as I'm aware, Bernd's use case is on using Kodi, so I'm sure you can agree that the build time savings and storage size savings are really in the noise.

Quoted 7 lines

For example, we now have support (and have pending patches) for some "containerisation" stuff, like docker and lxc. You can also see that Buildroot can be used to generate lightweight containers. Such containers need not have a udev daemon of their own (the system has one, and /dev is bind-mounted into the container); however, an application inside that container will need to have access to the device "DB" and events, thus needs libudev.

As far as I understand, in a Docker situation, you don't bind mount /dev into your container. Instead, you use the --device option of docker run to get only some specific devices visible in your container.

Regarding LXC
(https://linuxcontainers.org/fr/lxc/manpages/man5/lxc.container.conf.5.html) :

By default, lxc creates a few symbolic links (fd,stdin,stdout,stderr) in the container's /dev directory but does not automatically create device node entries. This allows the container's /dev to be set up as needed in the container rootfs. If lxc.autodev is set to 1, then after mounting the container's rootfs LXC will mount a fresh tmpfs under /dev (limited to 100k) and fill in a minimal set of initial devices. This is generally required when starting a container containing a "systemd" based "init" but may be optional at other times. Additional devices in the containers /dev directory may be created through the use of the lxc.hook.autodev hook.

So no, it does not seem like bind-mounting /dev inside a container is a typical use-case.

Again, this is a lot of additional complexity for very very dubious use-cases. I believe we have much more interesting and useful things to merge than this functionality, at least as long as it doesn't come with stronger arguments as to why it's useful.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#27 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

In reply to Yann E. MORIN
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Hi Yann,

Quoted 9 lines
Quoted 7 lines

So I'm not sure if it's really worth the effort. After all, installing only libudev without eudev is not really supported upstream (we have to trick by building only some subdirectories).

I'm not entirely decided yet, so I'm waiting for arguments. But I'm hesitating between merging this, or asking people who really care about this to simply remove the eudev daemon in a post-build script.

But then you would not have libudev if you use mdev or a static /dev.

Is that a common use case? I wouldn't expect anybody to use static /dev any more, and if you are using mdev then that is presumably for running scripts on hotplug events? If so, why not just use the udev daemon for this?

I do understand this could be useful for using libudev with devtmpfs /dev, but wouldn't a simple post-build script to rm S10udev + udevd get us 90% of the way without any extra complexity?

Signature · 2 lines
Venlig hilsen,
Peter Korsgaard 
#28 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Hi Peter,

[posted and mailed]

Peter Korsgaard <[email protected]> wrote in
news:87twfawymj.fsf at dell.be.48ers.dk:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]>

Quoted 5 lines · writes:
Quoted 2 lines

But then you would not have libudev if you use mdev or a static /dev.

Is that a common use case? I wouldn't expect anybody to use static /dev any more

the fli4l (http://www.fli4l.de/en/home/news/) distro uses buildroot to build its binaries and has BR2_ROOTFS_DEVICE_CREATION_STATIC=y

in both the development branch

https://ssl.nettworks.org/repo/browse/fli4l/branches/4.0/trunk/src/packages/s
rc/src/fbr/buildroot/.config-x86?hb=true#to309

and the stable branch

https://ssl.nettworks.org/repo/browse/fli4l/branches/3.10/trunk/src/packages/
src/src/fbr/buildroot/.config-x86?hb=true#to255

Regards, Bernd

#29 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Bernd" == Bernd Kuhls <[email protected]> writes:

Hi,

Quoted 10 lines
Quoted 4 lines
Quoted 1 line

But then you would not have libudev if you use mdev or a static /dev.

Is that a common use case? I wouldn't expect anybody to use static /dev any more

the fli4l (http://www.fli4l.de/en/home/news/) distro uses buildroot to build its binaries and has BR2_ROOTFS_DEVICE_CREATION_STATIC=y

in both the development branch

Quoted 7 lines

https://ssl.nettworks.org/repo/browse/fli4l/branches/4.0/trunk/src/packages/s
rc/src/fbr/buildroot/.config-x86?hb=true#to309

and the stable branch

https://ssl.nettworks.org/repo/browse/fli4l/branches/3.10/trunk/src/packages/
src/src/fbr/buildroot/.config-x86?hb=true#to255

Ok, but why? Devtmpfs has been available in the kernel since ~2.6.32 or so.

Signature · 1 line
Bye, Peter Korsgaard
#30 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

In reply to Yann E. MORIN

Am Mon, 18 Jul 2016 19:52:41 +0200 schrieb Yann E. MORIN:

Quoted 2 lines

Bernd has a (imho, valid) use-case about using only libudev without a udev daemon altogether; there *are* other similar cases.

Hi Yann,

years later there is a new solution for this problem: libudev-zero

Here is a hackish patch for buildroot which I am using with Kodi 19/gbm/ OpenGLES/no_X11 to provide udev support for libinput:

https://github.com/bkuhls/buildroot/commit/
ba49d2a8f9bb9879373d17711b82adfe867f4bdc

What about adding libudev-zero to buildroot?

Regards, Bernd

A message that is not in the archive (sent off-list or not yet received): [email protected]

#32 lore raw

v8 cover Introduce libudev (branch yem/libudev-4)

Bernd, All,

(sorry for the duplicate, but your mails are not real Cc...)

On 2021-03-08 22:59 +0100, Bernd Kuhls spake thusly:

Quoted 9 lines

years later there is a new solution for this problem: libudev-zero

Here is a hackish patch for buildroot which I am using with Kodi 19/gbm/ OpenGLES/no_X11 to provide udev support for libinput:

https://github.com/bkuhls/buildroot/commit/
ba49d2a8f9bb9879373d17711b82adfe867f4bdc

What about adding libudev-zero to buildroot?

Well, eudev now has had the ability to only build the library for a while already:

    https://github.com/gentoo/eudev/commit/18565392cfecb5be6f3261ae0f82827c9ecfa08b

One issue I see with libudev-zero, is that is installs a drop-in replacement for libudev, so it will conflict with eudev and systemd.

Also, packages that only need libudev would still need a generic abstraction in the form of a virtual package that abstract libudev.

So, I would prefer we first stick with just eudev like my latest branch:
https://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/libudev-6

Then, of course, we could add libudev-zero as a fourth provider for libudev, why not...

Sorry I haven't taken the time to properly rebase and resend this v6 of my branch yet... :-( I can try to have a look, but feel free to grab my patches and massage them as needed. Most patches need better commit log...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#33 lore raw

Hi Yann,

Am Mon, 08 Mar 2021 23:30:40 +0100 schrieb Yann E. MORIN:

Quoted 1 line

Well, eudev now has had the ability to only build the library for a

while

Quoted 3 lines

already:

https://github.com/gentoo/eudev/commit/

18565392cfecb5be6f3261ae0f82827c9ecfa08b

great, I did not know that.

Quoted 2 lines

So, I would prefer we first stick with just eudev like my latest branch:
https://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/libudev-6

Agreed.

Quoted 2 lines

Then, of course, we could add libudev-zero as a fourth provider for libudev, why not...

With eudev being able to provide libudev there is no need for libudev- zero from my pov anymore.

Quoted 4 lines

Sorry I haven't taken the time to properly rebase and resend this v6 of my branch yet... :-( I can try to have a look, but feel free to grab my patches and massage them as needed. Most patches need better commit log...

Here you can find your rebased branch with kodi support added:
https://github.com/bkuhls/buildroot/commits/master_libudev

Run-time test with libcec detecting the cec adapter using libudev provided by eudev was positive.

Regards, Bernd

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot