mbox series

[PATCH/next,v9,00/12] Introduce libudev (branch yem/libudev-6)

Message ID 20230806140241.4155773-1-bernd@kuhls.net
Headers show
Series Introduce libudev (branch yem/libudev-6) | expand

Message

Bernd Kuhls Aug. 6, 2023, 2:02 p.m. UTC
Hi,

quoting Yann from 2016:
https://lists.buildroot.org/pipermail/buildroot/2016-July/167371.html

"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! ;-) )"

This patch series was rebased on Yann's latest code from 2020:
https://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/libudev-6
as suggested in 2021:
https://lists.buildroot.org/pipermail/buildroot/2021-March/607988.html
"eudev now has had the ability to only build the library for a while
already"

and more packages were ported to make use of libudev.

Bernd Kuhls (4):
  package/kodi: only needs libudev, not udev daemon
  package/libv4l: optionally use libudev
  package/libcec: optionally use libudev
  package/usbutils: only needs libudev, not udev daemon

Yann E. MORIN (8):
  package/eudev: add option to enable the udev daemon
  package/eudev: allow building only the library
  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        | 45 +++++++++++++++++++++++++-------
 package/eudev/eudev.mk         | 47 ++++++++++++++++++++++++----------
 package/kodi/Config.in         |  4 +--
 package/kodi/kodi.mk           |  4 +--
 package/libcec/libcec.mk       |  4 +--
 package/libinput/Config.in     | 10 +++++---
 package/libinput/libinput.mk   |  2 +-
 package/libudev/Config.in      | 13 ++++++++++
 package/libudev/libudev.mk     |  7 +++++
 package/libv4l/libv4l.mk       |  4 +--
 package/qt5/qt5base/qt5base.mk |  4 +--
 package/systemd/Config.in      |  4 +++
 package/systemd/systemd.mk     |  2 +-
 package/usbutils/Config.in     | 12 ++++++---
 package/usbutils/usbutils.mk   |  2 +-
 system/Config.in               |  1 +
 17 files changed, 124 insertions(+), 42 deletions(-)
 create mode 100644 package/libudev/Config.in
 create mode 100644 package/libudev/libudev.mk

Comments

Thomas Petazzoni Aug. 22, 2023, 8:59 p.m. UTC | #1
Hello,

On Sun,  6 Aug 2023 16:02:29 +0200
Bernd Kuhls <bernd@kuhls.net> wrote:

> Bernd Kuhls (4):
>   package/kodi: only needs libudev, not udev daemon
>   package/libv4l: optionally use libudev
>   package/libcec: optionally use libudev
>   package/usbutils: only needs libudev, not udev daemon
> 
> Yann E. MORIN (8):
>   package/eudev: add option to enable the udev daemon
>   package/eudev: allow building only the library
>   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

Thanks Bernd for working on this. I didn't look carefully at the
patches in this iteration, but I remember looking at previous
iterations, and it was good.

I just wanted to question the relevance of this, so I did a quick
experiment. I applied just patches 1 and 2 of this patch series, which
allow to build eudev with and without the daemon. Then I built two
defconfigs:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
# BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set
# BR2_TARGET_ROOTFS_TAR is not set

which enables the full eudev (daemon included)

And:

BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_EUDEV=y
# BR2_PACKAGE_EUDEV_ENABLE_HWDB is not set
# BR2_TARGET_ROOTFS_TAR is not set

which enables only libudev.

The first defconfig generates an output/target/ of 7.4 MB, the second
defconfig generates an output/target/ of 5.4 MB.

In the first defconfig, the eudev package takes 1.69 MB, and the
util-linux-libs package takes 330 KB.

In the second defconfig, the eudev package takes 133 KB, and
util-linux-libs is not needed.

So in this "extreme" example, it saves 2 MB. I say "extreme" because a
realistic rootfs will have something that uses libudev and is going to
be bigger. util-linux-libs is used by a *lot* of system-level packages,
so it's relatively likely that it's going to be pulled in by some other
packages in most typical configurations. The size of eudev could be
reduced locally via post-build script.

I want to see if we really want to add this additional complexity of a
virtual package "just" to save 2 MB. I don't have a very strong opinion
on this so I could be convinced either way, but I find the extra
complexity quite high compared to the usefulness for most typical
use-cases.

Arnout, Peter, could you give your opinion here so that we can take a
decision, and either merge this patch series or reject it?

Thanks!

Thomas
Bernd Kuhls Aug. 25, 2023, 4:24 p.m. UTC | #2
Am Tue, 22 Aug 2023 22:59:49 +0200 schrieb Thomas Petazzoni via buildroot:

> I just wanted to question the relevance of this

> The first defconfig generates an output/target/ of 7.4 MB, the second
> defconfig generates an output/target/ of 5.4 MB.

> I don't have a very strong opinion on this so I could be convinced
> either way, but I find the extra complexity quite high compared to
> the usefulness for most typical use-cases.

Hi Thomas,

the reason I am carrying this patch in my personal tree is maintenance of 
a buildroot-based system which uses

BR2_ROOTFS_DEVICE_CREATION_STATIC=y

Without the libudev series I can not use packages like Kodi, and no, I can 
not change the rootfs setting for this system, sorry.

Regards, Bernd
Thomas Petazzoni Aug. 25, 2023, 5:05 p.m. UTC | #3
Hello Bernd,

On Fri, 25 Aug 2023 18:24:41 +0200
Bernd Kuhls <bernd@kuhls.net> wrote:

> the reason I am carrying this patch in my personal tree is maintenance of 
> a buildroot-based system which uses
> 
> BR2_ROOTFS_DEVICE_CREATION_STATIC=y
> 
> Without the libudev series I can not use packages like Kodi, and no, I can 
> not change the rootfs setting for this system, sorry.

So you can apply complicated patches/changes, but you cannot adjust the
configuration of your system to use eudev? This does not really sound
like a very good/solid argument in favor of this patch series :-/

Especially when you have Kodi, the size difference between "just
libudev" and "libudev + eudev" is insignificant compared to the size of
Kodi. 

Thomas
Bernd Kuhls Aug. 25, 2023, 5:22 p.m. UTC | #4
Am Fri, 25 Aug 2023 19:05:32 +0200 schrieb Thomas Petazzoni via buildroot:

> So you can apply complicated patches/changes, but you cannot adjust the
> configuration of your system to use eudev? 

Hi,

the init scripts of this system were created outside of buildroot and need 
a statically-populated /dev. As I said, changing the configuration is not 
possible, sorry.

Due to upstream now supporting a daemon-less build I thought I try again 
to get this series into buildroot. One of your arguments from 2016 was the 
lack of upstream support for this feature:
https://lists.buildroot.org/pipermail/buildroot/2016-July/470285.html

We do not need to trick-around with the build system anymore, we just add 
an option to build the package in a way which is supported by upstream 
now.

Regards, Bernd