From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 01/13] new recipe : host-systemd
Date: Thu, 12 Dec 2019 11:19:20 +0100 [thread overview]
Message-ID: <20191212111920.297bdca6@windsurf> (raw)
In-Reply-To: <20191212075400.1499536-2-jeremy.rosen@smile.fr>
Hello,
Thanks for this work, very useful!
On Thu, 12 Dec 2019 08:53:48 +0100
J?r?my Rosen <jeremy.rosen@smile.fr> wrote:
> diff --git a/package/systemd/Config.in b/package/systemd/Config.in
> index 8f1d6fc0c0..81761b33a4 100644
> --- a/package/systemd/Config.in
> +++ b/package/systemd/Config.in
> @@ -199,7 +199,6 @@ config BR2_PACKAGE_SYSTEMD_HOSTNAMED
> config BR2_PACKAGE_SYSTEMD_HWDB
> bool "enable hwdb installation"
> default y
> - select BR2_PACKAGE_HOST_EUDEV # for udevadm, during target-finalize
> help
> Enables hardware database installation to /usr/lib/udev/hwdb.d
>
> diff --git a/package/systemd/Config.in.host b/package/systemd/Config.in.host
> new file mode 100644
> index 0000000000..219f24239e
> --- /dev/null
> +++ b/package/systemd/Config.in.host
> @@ -0,0 +1,3 @@
> +# Select this if you need host systemd tools (e.g. systemctl)
> +config BR2_PACKAGE_HOST_SYSTEMD
> + bool
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index a292a7512b..ad16b58ceb 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -204,6 +204,11 @@ endif
>
> ifeq ($(BR2_PACKAGE_SYSTEMD_HWDB),y)
> SYSTEMD_CONF_OPTS += -Dhwdb=true
> +define SYSTEMD_BUILD_HWDB
> + $(HOST_DIR)/bin/udevadm hwdb --update --root $(TARGET_DIR)
> +endef
I think this change could be a separate patch, no? Or is the udevadm
binary installed by host-systemd conflicting with the one installed by
host-eudev ?
Should be explained in the commit log.
> +SYSTEMD_TARGET_FINALIZE_HOOKS += SYSTEMD_BUILD_HWDB
> +
> else
> SYSTEMD_CONF_OPTS += -Dhwdb=false
> endif
> @@ -551,3 +556,96 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV)
> SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV)
>
> $(eval $(meson-package))
We normally have both meson-package and host-meson-package macro
invocations at the end of .mk files.
> +#
> +# Host-systemd configuration
> +#
> +#Options tweaked for buildroot
> +HOST_SYSTEMD_CONF_OPTS= \
> + -Dsplit-bin=true \
> + -Dsplit-usr=false \
> + --prefix=/usr \
This should really be:
--prefix=$(HOST_DIR)
> + --libdir=lib \
> + --sysconfdir=/etc \
> + --localstatedir=/var
But in fact, all these options are already passed by the
host-meson-package infrastructure. Why are you overriding them ?
> +#disable everything else
Space after #
> +HOST_SYSTEMD_CONF_OPTS+= \
Space before +=
> +HOST_SYSTEMD_DEPENDENCIES = \
> + host-util-linux \
> + host-patchelf \
> + host-libcap \
> + host-gperf
> +
> +# Fix RPATH After installation
> +# * systemd provides a install_rpath instruction to meson because the binaries need to link with
> +# libsystemd which is not in a standard path
> +# * meson can only replace the RPATH, not append to it
> +# * the original rpatch is thus lost.
rpatch -> rpath
> +# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib
vial -> via
LD_FLAGS -> LDFLAGS
> +# * thus re-tweak rpath after the installation for all binaries that need it
I must admit I don't really understand what's going on here. Can't you
simply do something like this:
HOST_SYSTEMD_CONF_ENV = \
LDFLAGS="$(HOST_LDFLAGS) -Wl,-rpath,$(HOST_DIR)/lib/systemd"
and that's it ?
> +#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile
> +#unless properly integrated).
Space after #, and lines are too long.
> +HOST_SYSTEMD_HOST_TOOLS = \
> + systemd-analyze systemd-mount systemctl udevadm
> +
> +define HOST_SYSTEMD_FIX_RPATH
> + $(foreach f,$(HOST_SYSTEMD_HOST_TOOLS), \
> + $(HOST_DIR)/bin/patchelf --set-rpath $(HOST_DIR)/lib:$(HOST_DIR)/lib/systemd $(HOST_DIR)/bin/$(f)
> + )
> +endef
> +
> +HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH
> +HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR)
With the correct --prefix=$(HOST_DIR) passed by the default
host-meson-package infrastructure, this DESTDIR=$(HOST_DIR) should no
longer be necessary.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-12-12 10:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 7:53 [Buildroot] [PATCH v4 00/13] use host-systemd to enable units Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 01/13] new recipe : host-systemd Jérémy Rosen
2019-12-12 10:19 ` Thomas Petazzoni [this message]
2019-12-12 10:35 ` Jérémy ROSEN
2019-12-12 17:31 ` Yann E. MORIN
2019-12-12 7:53 ` [Buildroot] [PATCH v4 02/13] use host-systemctl preset all to enable units Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 03/13] fix tty handling Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 04/13] fix trivial packages with buildroot-provided services Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 05/13] fix trivial cases, upstream-provided services Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 06/13] package/connman: adapt to preset-all Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 07/13] package/linuxptp " Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 08/13] package/network-manager: " Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 09/13] package/wpa_supplicant: adapt for preset-all Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 10/13] package/sysrepo: update to new systemd Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 11/13] package/syslog-ng: implement default using DefaultInstance Jérémy Rosen
2019-12-12 7:53 ` [Buildroot] [PATCH v4 12/13] package/rauc: add a WantedBy section to the unit Jérémy Rosen
2019-12-12 7:54 ` [Buildroot] [PATCH v4 13/13] package/alsa-utils: " Jérémy Rosen
2019-12-12 10:14 ` [Buildroot] [PATCH v4 00/13] use host-systemd to enable units Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191212111920.297bdca6@windsurf \
--to=thomas.petazzoni@bootlin.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox