kumquat-buildroot/package/eudev/eudev.mk

101 lines
2.6 KiB
Makefile
Raw Normal View History

################################################################################
#
# eudev
#
################################################################################
EUDEV_VERSION = 3.2.9
EUDEV_SITE = http://dev.gentoo.org/~blueness/eudev
EUDEV_LICENSE = GPL-2.0+ (programs), LGPL-2.1+ (libraries)
EUDEV_LICENSE_FILES = COPYING
EUDEV_INSTALL_STAGING = YES
EUDEV_CONF_OPTS = \
--disable-manpages \
--sbindir=/sbin \
--libexecdir=/lib \
--disable-introspection \
--enable-kmod \
--enable-blkid
EUDEV_DEPENDENCIES = host-gperf host-pkgconf util-linux kmod
EUDEV_PROVIDES = udev
system: add options for /bin /sbin and /lib to be symlinks into /usr systemd is increasingly expecting things to live in /usr/bin, /usr/sbin or /usr/lib nad not in /bin, /sbin or /lib. It has inherited those expectations from a Fedora change: https://fedoraproject.org/wiki/Features/UsrMove Note however, that systemd does support /usr being on a separate filesystem; it just expects an initramfs to mount it before the final switchroot over to the actual rootfs. But the traditional use-case for Buildroot is not to boot with an initramfs; although that is totally feasible, that's probably not what is commonly done in the vast majority of cases. However, a lot of packages still install stuff directly into /bin, /sbin or /lib, which systemd may need early-on in the boot process, even before it may have a chance to mount /usr. Even though we can tell systemd, at configure-time, where it should expect programs to be at runtime, it does not make sense to go head-first against an upstream wa^Hill. Add an option so that /bin, /sbin and /lib be symlinks to /usr/bin and /usr/sbin. That option is forcibly enabled when the init system is systemd. Note: we need not handle /lib32 or /lib64, as they already are symlinks to /lib, which means they will automatically be redirected to /usr/lib, as /usr/lib32 and /usr/lib64 already are. Furthermore, this means we're no longer supporting a split-usr setup, so the corresponding configure options have been removed as well for systemd and, when using a merged /usr, for eudev as well. In Buildroot, we decided (with this patch) not to support a split-usr when systemd is used as an init system. This is a design decision, not a systemd issue. Thus the select is with BR2_INIT_SYSTEMD rather than with BR2_PACKAGE_SYSTEMD. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Mike Williams <mike@mikebwilliams.com> Cc: Vicente Olivert Riera <Vincent.Riera@imgtec.com> Cc: Baruch Siach <baruch@tkos.co.il> Tested-by: Mike Williams <mike@mikebwilliams.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-09-04 22:17:32 +02:00
ifeq ($(BR2_ROOTFS_MERGED_USR),)
EUDEV_CONF_OPTS += --with-rootlibdir=/lib --enable-split-usr
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)
EUDEV_CONF_OPTS += --enable-hwdb
else
EUDEV_CONF_OPTS += --disable-hwdb
endif
ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
EUDEV_CONF_OPTS += --enable-selinux
EUDEV_DEPENDENCIES += libselinux
else
EUDEV_CONF_OPTS += --disable-selinux
endif
define EUDEV_INSTALL_INIT_SYSV
$(INSTALL) -D -m 0755 package/eudev/S10udev $(TARGET_DIR)/etc/init.d/S10udev
endef
# Avoid installing S10udev with openrc, as the service is started by a unit
# from the udev-gentoo-scripts package.
define EUDEV_INSTALL_INIT_OPENRC
@:
endef
# Required by default rules for input devices
define EUDEV_USERS
- - input -1 * - - - Input device group
- - render -1 * - - - DRI rendering nodes
- - kvm -1 * - - - kvm nodes
endef
package/eudev: introduce a host variant eudev and systemd provide a hardware database (hwdb) as a set of multiple files. Various other utilities may also use that database. Those files have to be "compiled" into a binary to be useful; libudev (and thus all utilities based on it) only use the compiled hwdb. Compiling the hwdb is done with udevadm, using the hwdb sub-command: udevadm hwdb --update Provide a simple host-variant of eudev, so that we can call udevadm at build time. When it is configured, eudev will shoehorn its --prefix path as the base location where the .hwdb file will be searched from, as well as where the hwdb.bin will be generated in. This means that with the usual --prefix=$(HOST_DIR), it would look into there. udevadm also accepts a --root=/path option at runtime, which prepends /path to all the paths it uses to find and generate files. Obviously, combining --root=$(TARGET_DIR) and --prefix=$(HOST_DIR) would not do what we want: all files would be searched for, and generated, in $(HOST_DIR)$(TARGET_DIR)/ . Avoiding use of --root would not help much either, as files would still searched in $(HOST_DIR) (we could use a trick to copy files there, generate and then move the hwdb.bin, but that's not nice). However, since we only need udevadm, and since udevadm has no internal and no external dependency, we can use a less dirty trick and configure host-eudev with --prefix=/usr (and similar for the other paths), manually copy udevadm to HOST_DIR, and then use --root when calling it. Then, we get a udevadm that can read files from, and generate files into $(TARGET_DIR). We register a target-finalize hook to generate the hwdb.bin, so that any pakage may install its .hwdb files (currently only eudev and systemd do, but other packages might (e.g. sane is known to do so on standard desktop distros)) The *.hwdb source files consume a lot of space, roughly the same as the generated database, i.e. ~8MiB as of today, and they are totally useless on the target; only the generated hwdb.bin is useful. So we want to get rid of them. However, we also want to be able to complete a build (e.g. make foo-reinstall to reinstall more hwdb files), so we don't want to irremediably lose them. As such, we register a pre-rootfs-cmd hook, that removes them just before assembling the filesystems, when we're only using a copy of the target directory. Note that this is the first host package to register a target-finalize hook, and also the first to register a pre-rootfs-cmd hook. This avoids duplicating these hooks logic in both eudev and systemd. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Carlos Santos <unixmania@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-10-29 23:07:53 +01:00
HOST_EUDEV_DEPENDENCIES = host-gperf host-pkgconf
HOST_EUDEV_SYSCONFDIR = $(if $(BR2_PACKAGE_SYSTEMD),/usr/lib,/etc)
HOST_EUDEV_CONF_OPTS = \
--prefix=/usr \
--sbindir=/sbin \
--libexecdir=/lib \
--with-rootlibdir=/lib \
--sysconfdir=$(HOST_EUDEV_SYSCONFDIR) \
--disable-blkid \
--disable-introspection \
--disable-kmod \
--disable-manpages \
--disable-rule-generator \
--disable-selinux \
--enable-hwdb
define HOST_EUDEV_INSTALL_CMDS
$(INSTALL) -D -m 0755 $(@D)/src/udev/udevadm \
$(HOST_DIR)/bin/udevadm
endef
define HOST_EUDEV_BUILD_HWDB
$(HOST_DIR)/bin/udevadm hwdb --update --root $(TARGET_DIR)
endef
HOST_EUDEV_TARGET_FINALIZE_HOOKS += HOST_EUDEV_BUILD_HWDB
# Note: this will run in the filesystem context, so will use a copy
# of tharget/, not the real one, so the files are still available on
# re-builds (foo-rebuild, etc...)
define HOST_EUDEV_RM_HWDB_SRC
rm -rf $(TARGET_DIR)/$(HOST_EUDEV_SYSCONFDIR)/udev/hwdb.d/
endef
HOST_EUDEV_ROOTFS_PRE_CMD_HOOKS += HOST_EUDEV_RM_HWDB_SRC
$(eval $(autotools-package))
package/eudev: introduce a host variant eudev and systemd provide a hardware database (hwdb) as a set of multiple files. Various other utilities may also use that database. Those files have to be "compiled" into a binary to be useful; libudev (and thus all utilities based on it) only use the compiled hwdb. Compiling the hwdb is done with udevadm, using the hwdb sub-command: udevadm hwdb --update Provide a simple host-variant of eudev, so that we can call udevadm at build time. When it is configured, eudev will shoehorn its --prefix path as the base location where the .hwdb file will be searched from, as well as where the hwdb.bin will be generated in. This means that with the usual --prefix=$(HOST_DIR), it would look into there. udevadm also accepts a --root=/path option at runtime, which prepends /path to all the paths it uses to find and generate files. Obviously, combining --root=$(TARGET_DIR) and --prefix=$(HOST_DIR) would not do what we want: all files would be searched for, and generated, in $(HOST_DIR)$(TARGET_DIR)/ . Avoiding use of --root would not help much either, as files would still searched in $(HOST_DIR) (we could use a trick to copy files there, generate and then move the hwdb.bin, but that's not nice). However, since we only need udevadm, and since udevadm has no internal and no external dependency, we can use a less dirty trick and configure host-eudev with --prefix=/usr (and similar for the other paths), manually copy udevadm to HOST_DIR, and then use --root when calling it. Then, we get a udevadm that can read files from, and generate files into $(TARGET_DIR). We register a target-finalize hook to generate the hwdb.bin, so that any pakage may install its .hwdb files (currently only eudev and systemd do, but other packages might (e.g. sane is known to do so on standard desktop distros)) The *.hwdb source files consume a lot of space, roughly the same as the generated database, i.e. ~8MiB as of today, and they are totally useless on the target; only the generated hwdb.bin is useful. So we want to get rid of them. However, we also want to be able to complete a build (e.g. make foo-reinstall to reinstall more hwdb files), so we don't want to irremediably lose them. As such, we register a pre-rootfs-cmd hook, that removes them just before assembling the filesystems, when we're only using a copy of the target directory. Note that this is the first host package to register a target-finalize hook, and also the first to register a pre-rootfs-cmd hook. This avoids duplicating these hooks logic in both eudev and systemd. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Carlos Santos <unixmania@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-10-29 23:07:53 +01:00
$(eval $(host-autotools-package))