Message ID | 20191103165640.21819-2-jeremy.rosen@smile.fr |
---|---|
State | Superseded |
Headers | show |
Series | use host-systemd to enable units | expand |
Does this depend on a minimum host kernel version? How should we be handling that? On Sun, Nov 3, 2019 at 11:57 AM Jérémy Rosen <jeremy.rosen@smile.fr> wrote: > > Add the infrastructure to build the host version of systemd > * disable all optional features, they can be re-added when needed > * systemd has creative way of dealing with cross compile > we build a "normal" host systemd, but install it in $HOST_DIR > we use systemctl --root to correctly act on TARGET_DIR > * we need to adjust RPATH using patchelf because meson can't do it > correctly by itsel > > Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr> > --- > package/Config.in.host | 1 + > package/systemd/Config.in.host | 4 ++ > package/systemd/systemd.mk | 92 ++++++++++++++++++++++++++++++++++ > 3 files changed, 97 insertions(+) > create mode 100644 package/systemd/Config.in.host > > diff --git a/package/Config.in.host b/package/Config.in.host > index c0ac4fbbcc..d4e31ade2d 100644 > --- a/package/Config.in.host > +++ b/package/Config.in.host > @@ -69,6 +69,7 @@ menu "Host utilities" > source "package/squashfs/Config.in.host" > source "package/sunxi-tools/Config.in.host" > source "package/swig/Config.in.host" > + source "package/systemd/Config.in.host" > source "package/tegrarcm/Config.in.host" > source "package/ti-cgt-pru/Config.in.host" > source "package/uboot-tools/Config.in.host" > diff --git a/package/systemd/Config.in.host b/package/systemd/Config.in.host > new file mode 100644 > index 0000000000..09099752d2 > --- /dev/null > +++ b/package/systemd/Config.in.host > @@ -0,0 +1,4 @@ > +config BR2_PACKAGE_HOST_SYSTEMD > + bool "host systemd tools" > + help > + Systemd command-line tools for the host > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > index 94d5f703cd..1e4f706517 100644 > --- a/package/systemd/systemd.mk > +++ b/package/systemd/systemd.mk > @@ -550,3 +550,95 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > > $(eval $(meson-package)) > + > + > + > +# > +# Host-systemd configuration > +# > +HOST_SYSTEMD_CONF_OPTS= \ > + -Dsplit-bin=true \ > + -Dsplit-usr=false \ > + -Dutmp=false \ > + -Dhibernate=false \ > + -Dldconfig=false \ > + -Dresolve=false \ > + -Defi=false \ > + -Dtpm=false \ > + -Denvironment-d=false \ > + -Dbinfmt=false \ > + -Dcoredump=false \ > + -Dpstore=false \ > + -Dlogind=false \ > + -Dhostnamed=false \ > + -Dlocaled=false \ > + -Dmachined=false \ > + -Dportabled=false \ > + -Dnetworkd=false \ > + -Dtimedated=false \ > + -Dtimesyncd=false \ > + -Dremote=false \ > + -Dcreate-log-dirs=false \ > + -Dnss-myhostname=false \ > + -Dnss-mymachines=false \ > + -Dnss-resolve=false \ > + -Dnss-systemd=false \ > + -Dfirstboot=false \ > + -Drandomseed=false \ > + -Dbacklight=false \ > + -Dvconsole=false \ > + -Dquotacheck=false \ > + -Dsysusers=false \ > + -Dtmpfiles=false \ > + -Dimportd=false \ > + -Dhwdb=false \ > + -Drfkill=false \ > + -Dman=false \ > + -Dhtml=false \ > + -Dsmack=false \ > + -Dpolkit=false \ > + -Dblkid=false \ > + -Didn=false \ > + -Dadm-group=false \ > + -Dwheel-group=false \ > + -Dzlib=false \ > + -Dgshadow=false \ > + -Dima=false \ > + -Dtests=false \ > + -Dglib=false \ > + -Dacl=false \ > + -Dsysvinit-path='' \ > + --prefix=/usr \ > + --libdir=lib \ > + --sysconfdir=/etc \ > + --localstatedir=/var \ > + > + > +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. > +# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib > +# * thus re-tweak rpath after the installation for all binaries that need it > +#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile > +#unless properly integrated). > +HOST_SYSTEMD_HOST_TOOLS = \ > + systemd-analyze systemd-mount systemctl > + > +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) > + > +$(eval $(host-meson-package)) > -- > 2.24.0.rc1 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
I have to admit I have trouble testing/evaluationg the host-side dependencies. Systemd needs a kernel >= 3.13 according to the README. Buildroot has no requirements for the host-side kernel right now, I'm not really sure how to handle that. Advice welcomed. Le dim. 3 nov. 2019 à 18:20, James Hilliard <james.hilliard1@gmail.com> a écrit : > Does this depend on a minimum host kernel version? How should we be > handling that? > > On Sun, Nov 3, 2019 at 11:57 AM Jérémy Rosen <jeremy.rosen@smile.fr> > wrote: > > > > Add the infrastructure to build the host version of systemd > > * disable all optional features, they can be re-added when needed > > * systemd has creative way of dealing with cross compile > > we build a "normal" host systemd, but install it in $HOST_DIR > > we use systemctl --root to correctly act on TARGET_DIR > > * we need to adjust RPATH using patchelf because meson can't do it > > correctly by itsel > > > > Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr> > > --- > > package/Config.in.host | 1 + > > package/systemd/Config.in.host | 4 ++ > > package/systemd/systemd.mk | 92 ++++++++++++++++++++++++++++++++++ > > 3 files changed, 97 insertions(+) > > create mode 100644 package/systemd/Config.in.host > > > > diff --git a/package/Config.in.host b/package/Config.in.host > > index c0ac4fbbcc..d4e31ade2d 100644 > > --- a/package/Config.in.host > > +++ b/package/Config.in.host > > @@ -69,6 +69,7 @@ menu "Host utilities" > > source "package/squashfs/Config.in.host" > > source "package/sunxi-tools/Config.in.host" > > source "package/swig/Config.in.host" > > + source "package/systemd/Config.in.host" > > source "package/tegrarcm/Config.in.host" > > source "package/ti-cgt-pru/Config.in.host" > > source "package/uboot-tools/Config.in.host" > > diff --git a/package/systemd/Config.in.host > b/package/systemd/Config.in.host > > new file mode 100644 > > index 0000000000..09099752d2 > > --- /dev/null > > +++ b/package/systemd/Config.in.host > > @@ -0,0 +1,4 @@ > > +config BR2_PACKAGE_HOST_SYSTEMD > > + bool "host systemd tools" > > + help > > + Systemd command-line tools for the host > > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > > index 94d5f703cd..1e4f706517 100644 > > --- a/package/systemd/systemd.mk > > +++ b/package/systemd/systemd.mk > > @@ -550,3 +550,95 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > > SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > > > > $(eval $(meson-package)) > > + > > + > > + > > +# > > +# Host-systemd configuration > > +# > > +HOST_SYSTEMD_CONF_OPTS= \ > > + -Dsplit-bin=true \ > > + -Dsplit-usr=false \ > > + -Dutmp=false \ > > + -Dhibernate=false \ > > + -Dldconfig=false \ > > + -Dresolve=false \ > > + -Defi=false \ > > + -Dtpm=false \ > > + -Denvironment-d=false \ > > + -Dbinfmt=false \ > > + -Dcoredump=false \ > > + -Dpstore=false \ > > + -Dlogind=false \ > > + -Dhostnamed=false \ > > + -Dlocaled=false \ > > + -Dmachined=false \ > > + -Dportabled=false \ > > + -Dnetworkd=false \ > > + -Dtimedated=false \ > > + -Dtimesyncd=false \ > > + -Dremote=false \ > > + -Dcreate-log-dirs=false \ > > + -Dnss-myhostname=false \ > > + -Dnss-mymachines=false \ > > + -Dnss-resolve=false \ > > + -Dnss-systemd=false \ > > + -Dfirstboot=false \ > > + -Drandomseed=false \ > > + -Dbacklight=false \ > > + -Dvconsole=false \ > > + -Dquotacheck=false \ > > + -Dsysusers=false \ > > + -Dtmpfiles=false \ > > + -Dimportd=false \ > > + -Dhwdb=false \ > > + -Drfkill=false \ > > + -Dman=false \ > > + -Dhtml=false \ > > + -Dsmack=false \ > > + -Dpolkit=false \ > > + -Dblkid=false \ > > + -Didn=false \ > > + -Dadm-group=false \ > > + -Dwheel-group=false \ > > + -Dzlib=false \ > > + -Dgshadow=false \ > > + -Dima=false \ > > + -Dtests=false \ > > + -Dglib=false \ > > + -Dacl=false \ > > + -Dsysvinit-path='' \ > > + --prefix=/usr \ > > + --libdir=lib \ > > + --sysconfdir=/etc \ > > + --localstatedir=/var \ > > + > > + > > +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. > > +# * the original path had been tweaked by buildroot vial LD_FLAGS to > add $(HOST_DIR)/lib > > +# * thus re-tweak rpath after the installation for all binaries that > need it > > +#buildroot detects incorrect RPATH, so adding new binaries should be > safe (it won't compile > > +#unless properly integrated). > > +HOST_SYSTEMD_HOST_TOOLS = \ > > + systemd-analyze systemd-mount systemctl > > + > > +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) > > + > > +$(eval $(host-meson-package)) > > -- > > 2.24.0.rc1 > > > > _______________________________________________ > > buildroot mailing list > > buildroot@busybox.net > > http://lists.busybox.net/mailman/listinfo/buildroot >
[adding back the list to the conversation] On Mon, Nov 4, 2019 at 3:53 PM Jérémy ROSEN <jeremy.rosen@smile.fr> wrote: > > Does systemd have a general policy with regard to that ? > > How old is the limit for the build system itself ? I don't know for sure but given the versions of host patch and coreutils that are still supported (check commits bef2a36d1f2f49bb50de33affea5a18b0b0b68d7 and ef60ef83c9e27899666c3c093007208c1203b3e1) I guess Debian 7 and Ubuntu 14.04 are still used. > > Le lun. 4 nov. 2019 à 19:40, Carlos Santos <unixmania@gmail.com> a écrit : >> >> On Mon, Nov 4, 2019 at 2:02 PM Jérémy ROSEN <jeremy.rosen@smile.fr> wrote: >> > >> > I have to admit I have trouble testing/evaluationg the host-side dependencies. >> > Systemd needs a kernel >= 3.13 according to the README. >> > Buildroot has no requirements for the host-side kernel right now, I'm not really sure how to handle that. Advice welcomed. >> > >> >> [flipping to plain text email] >> >> Requiring a kernel >= 3.13 will prevent building on RHEL/CentOS 7, >> which may be a too drastic restriction. >> >> -- >> Carlos Santos <unixmania@gmail.com> >
Jérémy, All, On 2019-11-03 17:56 +0100, Jérémy Rosen spake thusly: > Add the infrastructure to build the host version of systemd > * disable all optional features, they can be re-added when needed > * systemd has creative way of dealing with cross compile > we build a "normal" host systemd, but install it in $HOST_DIR > we use systemctl --root to correctly act on TARGET_DIR > * we need to adjust RPATH using patchelf because meson can't do it > correctly by itsel > > Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr> [--SNIP--] > diff --git a/package/systemd/Config.in.host b/package/systemd/Config.in.host > new file mode 100644 > index 0000000000..09099752d2 > --- /dev/null > +++ b/package/systemd/Config.in.host > @@ -0,0 +1,4 @@ > +config BR2_PACKAGE_HOST_SYSTEMD > + bool "host systemd tools" > + help > + Systemd command-line tools for the host I don;t think we (at the current point) need a user-visible option. This host-systemd is initially a way to get systemctl only, and this is just internal to how Buildroot will enable the units (by using systemctl preset-all or so). Later, if/when it becomes possible to build extra utilities for users to manually run (or in a post-build/image script), then we can expose a user-visible host-systemd option. But for now, it is not needed. > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > index 94d5f703cd..1e4f706517 100644 > --- a/package/systemd/systemd.mk > +++ b/package/systemd/systemd.mk > @@ -550,3 +550,95 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > > $(eval $(meson-package)) > + > + > + Too many empty lines. Run 'make check-package'. > +# > +# Host-systemd configuration > +# > +HOST_SYSTEMD_CONF_OPTS= \ > + -Dsplit-bin=true \ > + -Dsplit-usr=false \ > + -Dutmp=false \ > + -Dhibernate=false \ > + -Dldconfig=false \ > + -Dresolve=false \ [--SNIP--] > + -Dsysvinit-path='' \ > + --prefix=/usr \ > + --libdir=lib \ > + --sysconfdir=/etc \ > + --localstatedir=/var \ This list will be difficult to maintain on each version bump... :-( Can't we push for upstream to implement a simple switch: --disable-all-that-is-not-explicitly-enabled-please-and-i-d-like-a-pony-too-pretty-please > + > +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. > +# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib > +# * thus re-tweak rpath after the installation for all binaries that need it > +#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile > +#unless properly integrated). > +HOST_SYSTEMD_HOST_TOOLS = \ > + systemd-analyze systemd-mount systemctl Once again, I think we should just keep systemctl for now: remove everything else. We just need systemctl for now. We can then *later* add those (esp. analyse). > +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) It is not possible to make an RPATH longer than it previously was. How can we ensure that the rpath that is set by meson will be big enough to later cary our own rpath? Regards, Yann E. MORIN. > + ) > +endef > + > +HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH > +HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) > + > +$(eval $(host-meson-package)) > -- > 2.24.0.rc1 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
James, Jérémy, All, On 2019-11-03 12:20 -0500, James Hilliard spake thusly: > Does this depend on a minimum host kernel version? How should we be > handling that? So I mulled over that one for a little while... AFAIK, the headers version is especially usfull for a few things in systemd that we are not interested in and do not build (or need not build) for our host-systemd: - udevd - the spwaning of services in namespaces and control groups nad whatnot - maybe a few other things. But systemctl should be exempt from any such requirement. So, as long as we can do a very trimmed-down build, we should not have to worry too much about the host kernel headers... (Famous Last Words (TM)) Regards, Yann E. MORIN. > On Sun, Nov 3, 2019 at 11:57 AM Jérémy Rosen <jeremy.rosen@smile.fr> wrote: > > > > Add the infrastructure to build the host version of systemd > > * disable all optional features, they can be re-added when needed > > * systemd has creative way of dealing with cross compile > > we build a "normal" host systemd, but install it in $HOST_DIR > > we use systemctl --root to correctly act on TARGET_DIR > > * we need to adjust RPATH using patchelf because meson can't do it > > correctly by itsel > > > > Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr> > > --- > > package/Config.in.host | 1 + > > package/systemd/Config.in.host | 4 ++ > > package/systemd/systemd.mk | 92 ++++++++++++++++++++++++++++++++++ > > 3 files changed, 97 insertions(+) > > create mode 100644 package/systemd/Config.in.host > > > > diff --git a/package/Config.in.host b/package/Config.in.host > > index c0ac4fbbcc..d4e31ade2d 100644 > > --- a/package/Config.in.host > > +++ b/package/Config.in.host > > @@ -69,6 +69,7 @@ menu "Host utilities" > > source "package/squashfs/Config.in.host" > > source "package/sunxi-tools/Config.in.host" > > source "package/swig/Config.in.host" > > + source "package/systemd/Config.in.host" > > source "package/tegrarcm/Config.in.host" > > source "package/ti-cgt-pru/Config.in.host" > > source "package/uboot-tools/Config.in.host" > > diff --git a/package/systemd/Config.in.host b/package/systemd/Config.in.host > > new file mode 100644 > > index 0000000000..09099752d2 > > --- /dev/null > > +++ b/package/systemd/Config.in.host > > @@ -0,0 +1,4 @@ > > +config BR2_PACKAGE_HOST_SYSTEMD > > + bool "host systemd tools" > > + help > > + Systemd command-line tools for the host > > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > > index 94d5f703cd..1e4f706517 100644 > > --- a/package/systemd/systemd.mk > > +++ b/package/systemd/systemd.mk > > @@ -550,3 +550,95 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > > SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > > > > $(eval $(meson-package)) > > + > > + > > + > > +# > > +# Host-systemd configuration > > +# > > +HOST_SYSTEMD_CONF_OPTS= \ > > + -Dsplit-bin=true \ > > + -Dsplit-usr=false \ > > + -Dutmp=false \ > > + -Dhibernate=false \ > > + -Dldconfig=false \ > > + -Dresolve=false \ > > + -Defi=false \ > > + -Dtpm=false \ > > + -Denvironment-d=false \ > > + -Dbinfmt=false \ > > + -Dcoredump=false \ > > + -Dpstore=false \ > > + -Dlogind=false \ > > + -Dhostnamed=false \ > > + -Dlocaled=false \ > > + -Dmachined=false \ > > + -Dportabled=false \ > > + -Dnetworkd=false \ > > + -Dtimedated=false \ > > + -Dtimesyncd=false \ > > + -Dremote=false \ > > + -Dcreate-log-dirs=false \ > > + -Dnss-myhostname=false \ > > + -Dnss-mymachines=false \ > > + -Dnss-resolve=false \ > > + -Dnss-systemd=false \ > > + -Dfirstboot=false \ > > + -Drandomseed=false \ > > + -Dbacklight=false \ > > + -Dvconsole=false \ > > + -Dquotacheck=false \ > > + -Dsysusers=false \ > > + -Dtmpfiles=false \ > > + -Dimportd=false \ > > + -Dhwdb=false \ > > + -Drfkill=false \ > > + -Dman=false \ > > + -Dhtml=false \ > > + -Dsmack=false \ > > + -Dpolkit=false \ > > + -Dblkid=false \ > > + -Didn=false \ > > + -Dadm-group=false \ > > + -Dwheel-group=false \ > > + -Dzlib=false \ > > + -Dgshadow=false \ > > + -Dima=false \ > > + -Dtests=false \ > > + -Dglib=false \ > > + -Dacl=false \ > > + -Dsysvinit-path='' \ > > + --prefix=/usr \ > > + --libdir=lib \ > > + --sysconfdir=/etc \ > > + --localstatedir=/var \ > > + > > + > > +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. > > +# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib > > +# * thus re-tweak rpath after the installation for all binaries that need it > > +#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile > > +#unless properly integrated). > > +HOST_SYSTEMD_HOST_TOOLS = \ > > + systemd-analyze systemd-mount systemctl > > + > > +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) > > + > > +$(eval $(host-meson-package)) > > -- > > 2.24.0.rc1 > > > > _______________________________________________ > > buildroot mailing list > > buildroot@busybox.net > > http://lists.busybox.net/mailman/listinfo/buildroot > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Le sam. 9 nov. 2019 à 22:49, Yann E. MORIN <yann.morin.1998@free.fr> a écrit : > Jérémy, All, > > On 2019-11-03 17:56 +0100, Jérémy Rosen spake thusly: > > Add the infrastructure to build the host version of systemd > > * disable all optional features, they can be re-added when needed > > * systemd has creative way of dealing with cross compile > > we build a "normal" host systemd, but install it in $HOST_DIR > > we use systemctl --root to correctly act on TARGET_DIR > > * we need to adjust RPATH using patchelf because meson can't do it > > correctly by itsel > > > > Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr> > [--SNIP--] > > diff --git a/package/systemd/Config.in.host > b/package/systemd/Config.in.host > > new file mode 100644 > > index 0000000000..09099752d2 > > --- /dev/null > > +++ b/package/systemd/Config.in.host > > @@ -0,0 +1,4 @@ > > +config BR2_PACKAGE_HOST_SYSTEMD > > + bool "host systemd tools" > > + help > > + Systemd command-line tools for the host > > I don;t think we (at the current point) need a user-visible option. > > This host-systemd is initially a way to get systemctl only, and this is > just internal to how Buildroot will enable the units (by using systemctl > preset-all or so). > > Later, if/when it becomes possible to build extra utilities for users to > manually run (or in a post-build/image script), then we can expose a > user-visible host-systemd option. > > But for now, it is not needed. > Ok, will do... The host-tools are pretty usefull, but I don't see any use-cases where you would want the host-side tool without systemd on the target anyway... > > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > > index 94d5f703cd..1e4f706517 100644 > > --- a/package/systemd/systemd.mk > > +++ b/package/systemd/systemd.mk > > @@ -550,3 +550,95 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > > SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > > > > $(eval $(meson-package)) > > + > > + > > + > > Too many empty lines. Run 'make check-package'. > > done > > +# > > +# Host-systemd configuration > > +# > > +HOST_SYSTEMD_CONF_OPTS= \ > > + -Dsplit-bin=true \ > > + -Dsplit-usr=false \ > > + -Dutmp=false \ > > + -Dhibernate=false \ > > + -Dldconfig=false \ > > + -Dresolve=false \ > [--SNIP--] > > + -Dsysvinit-path='' \ > > + --prefix=/usr \ > > + --libdir=lib \ > > + --sysconfdir=/etc \ > > + --localstatedir=/var \ > > This list will be difficult to maintain on each version bump... :-( > Can't we push for upstream to implement a simple switch: > > --disable-all-that-is-not-explicitly-enabled-please-and-i-d-like-a-pony-too-pretty-please > > That's not the kind of stuff upstream would accept... we might have more chance if we provided a "make host-tools" target or something like that, but my meson-knowledge is too low to do that. so... not right now. I have split the options in two blocks, the ones we tweak and the long list of "=false" options, that might help readability > > + > > +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. > > +# * the original path had been tweaked by buildroot vial LD_FLAGS to > add $(HOST_DIR)/lib > > +# * thus re-tweak rpath after the installation for all binaries that > need it > > +#buildroot detects incorrect RPATH, so adding new binaries should be > safe (it won't compile > > +#unless properly integrated). > > +HOST_SYSTEMD_HOST_TOOLS = \ > > + systemd-analyze systemd-mount systemctl > > Once again, I think we should just keep systemctl for now: remove > everything else. We just need systemctl for now. > > This is already the minimal set... I can't reduce it more without patching upstream There are actually more binaries generated than those (we do build a PID1, after all) Those are the ones that need to be tweaked because of libsystemd. The others are fine. Again, an upstream patch to build on a tool per tool basis could be usefull, but beyond the scope of this patch We can then *later* add those (esp. analyse). > > > +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) > > It is not possible to make an RPATH longer than it previously was. How > can we ensure that the rpath that is set by meson will be big enough to > later cary our own rpath? > > I just checked the source and patchelf does increase the side of the section to fit the new size.... so we are good Cheers Jérémy > Regards, > Yann E. MORIN. > > > + ) > > +endef > > + > > +HOST_SYSTEMD_POST_INSTALL_HOOKS += HOST_SYSTEMD_FIX_RPATH > > +HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) > > + > > +$(eval $(host-meson-package)) > > -- > > 2.24.0.rc1 > > > > _______________________________________________ > > buildroot mailing list > > buildroot@busybox.net > > http://lists.busybox.net/mailman/listinfo/buildroot > > -- > > .-----------------.--------------------.------------------.--------------------. > | 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. | > > '------------------------------^-------^------------------^--------------------' >
diff --git a/package/Config.in.host b/package/Config.in.host index c0ac4fbbcc..d4e31ade2d 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -69,6 +69,7 @@ menu "Host utilities" source "package/squashfs/Config.in.host" source "package/sunxi-tools/Config.in.host" source "package/swig/Config.in.host" + source "package/systemd/Config.in.host" source "package/tegrarcm/Config.in.host" source "package/ti-cgt-pru/Config.in.host" source "package/uboot-tools/Config.in.host" diff --git a/package/systemd/Config.in.host b/package/systemd/Config.in.host new file mode 100644 index 0000000000..09099752d2 --- /dev/null +++ b/package/systemd/Config.in.host @@ -0,0 +1,4 @@ +config BR2_PACKAGE_HOST_SYSTEMD + bool "host systemd tools" + help + Systemd command-line tools for the host diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk index 94d5f703cd..1e4f706517 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -550,3 +550,95 @@ SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) $(eval $(meson-package)) + + + +# +# Host-systemd configuration +# +HOST_SYSTEMD_CONF_OPTS= \ + -Dsplit-bin=true \ + -Dsplit-usr=false \ + -Dutmp=false \ + -Dhibernate=false \ + -Dldconfig=false \ + -Dresolve=false \ + -Defi=false \ + -Dtpm=false \ + -Denvironment-d=false \ + -Dbinfmt=false \ + -Dcoredump=false \ + -Dpstore=false \ + -Dlogind=false \ + -Dhostnamed=false \ + -Dlocaled=false \ + -Dmachined=false \ + -Dportabled=false \ + -Dnetworkd=false \ + -Dtimedated=false \ + -Dtimesyncd=false \ + -Dremote=false \ + -Dcreate-log-dirs=false \ + -Dnss-myhostname=false \ + -Dnss-mymachines=false \ + -Dnss-resolve=false \ + -Dnss-systemd=false \ + -Dfirstboot=false \ + -Drandomseed=false \ + -Dbacklight=false \ + -Dvconsole=false \ + -Dquotacheck=false \ + -Dsysusers=false \ + -Dtmpfiles=false \ + -Dimportd=false \ + -Dhwdb=false \ + -Drfkill=false \ + -Dman=false \ + -Dhtml=false \ + -Dsmack=false \ + -Dpolkit=false \ + -Dblkid=false \ + -Didn=false \ + -Dadm-group=false \ + -Dwheel-group=false \ + -Dzlib=false \ + -Dgshadow=false \ + -Dima=false \ + -Dtests=false \ + -Dglib=false \ + -Dacl=false \ + -Dsysvinit-path='' \ + --prefix=/usr \ + --libdir=lib \ + --sysconfdir=/etc \ + --localstatedir=/var \ + + +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. +# * the original path had been tweaked by buildroot vial LD_FLAGS to add $(HOST_DIR)/lib +# * thus re-tweak rpath after the installation for all binaries that need it +#buildroot detects incorrect RPATH, so adding new binaries should be safe (it won't compile +#unless properly integrated). +HOST_SYSTEMD_HOST_TOOLS = \ + systemd-analyze systemd-mount systemctl + +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) + +$(eval $(host-meson-package))
Add the infrastructure to build the host version of systemd * disable all optional features, they can be re-added when needed * systemd has creative way of dealing with cross compile we build a "normal" host systemd, but install it in $HOST_DIR we use systemctl --root to correctly act on TARGET_DIR * we need to adjust RPATH using patchelf because meson can't do it correctly by itsel Signed-off-by: Jérémy Rosen <jeremy.rosen@smile.fr> --- package/Config.in.host | 1 + package/systemd/Config.in.host | 4 ++ package/systemd/systemd.mk | 92 ++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 package/systemd/Config.in.host