Skip to contentSkip to conversation

package/systemd: allow empty SYSTEMD_DEFAULT_TARGET

PATCH In review Norbert Lange 3 participants 8 messages Jul 19, 2022 – Jul 23, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/systemd: allow empty SYSTEMD_DEFAULT_TARGET

Once you allow systemd to be build while not using it as init system, the variable will be mpty and the build fails.

---
 package/systemd/systemd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/systemd/systemd.mk +1 -1
index b6fffc553f..1510437617 100644
@@ -586,7 +586,7 @@ SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
 endif
 
 define SYSTEMD_INSTALL_INIT_HOOK
-	ln -fs "$(call qstrip,$(BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET))" \
+	ln -fs "$(or $(call qstrip,$(BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET)),multi-user.target)" \
 		$(TARGET_DIR)/usr/lib/systemd/system/default.target
 endef
 
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/systemd: allow package to be used without init system

Allow systemd to be built as normal package, this for example allows building systemd-boot without any init system.

---
 package/systemd/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/systemd/Config.in +0 -1
index 9f1a778e59..e0f5dbce0d 100644
@@ -16,7 +16,6 @@ config BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
 
 menuconfig BR2_PACKAGE_SYSTEMD
 	bool "systemd"
-	depends on BR2_INIT_SYSTEMD
 	depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
 	depends on BR2_USE_MMU
 	depends on !BR2_STATIC_LIBS # kmod
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/systemd: allow package to be used without init system

Norbert, All,

On 2022-07-19 15:16 +0200, Norbert Lange spake thusly:

Quoted 2 lines

Allow systemd to be built as normal package, this for example allows building systemd-boot without any init system.

How has the situation with upstream evolved since last time the topic was raised here:

    https://lore.kernel.org/buildroot/[email protected]/#t
and especially the sub-thread:
    https://lore.kernel.org/buildroot/d38239f86f99924e87dcb6e045b2de3ac0cb435f.1545814334.git.yann.morin.1998@free.fr/

As far as I know (and understand), upstream has decided to tie the build of systemd-boot (formerly the standalone gummiboot) to the build of the rest of the systemd suite; they did not accept to make it possible to only build systemd-boot to use it outside the systemd ecosystem.

From Buildroot's perspective, allowing to build systemd without it being an init system, and without the possibility to just build systemd-boot, is asking for troubles down the line.

The triviality of your patch does not make it possible to only just build systemd-boot; instead, it still builds the whole systemd suite, which hints that upstream did not make it possible to do separate builds.

So, unless things have evolved substantially, I am not very fond of alowing this, and stand by the decision that was made back then (i.e. abide by upstream decision and tie systemd-boot to the systemd ecosystem).

Regards,
Yann E. MORIN.

Quoted 24 lines
---
 package/systemd/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/systemd/Config.in +0 -1
index 9f1a778e59..e0f5dbce0d 100644
@@ -16,7 +16,6 @@ config BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
 
 menuconfig BR2_PACKAGE_SYSTEMD
 	bool "systemd"
-	depends on BR2_INIT_SYSTEMD
 	depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
 	depends on BR2_USE_MMU
 	depends on !BR2_STATIC_LIBS # kmod
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 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.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/2] package/systemd: allow package to be used without init system

Am Di., 19. Juli 2022 um 17:45 Uhr schrieb Yann E. MORIN <[email protected]>:

Quoted 18 lines

Norbert, All,

On 2022-07-19 15:16 +0200, Norbert Lange spake thusly:

Quoted 2 lines

Allow systemd to be built as normal package, this for example allows building systemd-boot without any init system.

How has the situation with upstream evolved since last time the topic was raised here:

    https://lore.kernel.org/buildroot/[email protected]/#t
and especially the sub-thread:
    https://lore.kernel.org/buildroot/d38239f86f99924e87dcb6e045b2de3ac0cb435f.1545814334.git.yann.morin.1998@free.fr/

As far as I know (and understand), upstream has decided to tie the build of systemd-boot (formerly the standalone gummiboot) to the build of the rest of the systemd suite; they did not accept to make it possible to only build systemd-boot to use it outside the systemd ecosystem.

Quoted 8 lines

From Buildroot's perspective, allowing to build systemd without it being an init system, and without the possibility to just build systemd-boot, is asking for troubles down the line.

The triviality of your patch does not make it possible to only just build systemd-boot; instead, it still builds the whole systemd suite, which hints that upstream did not make it possible to do separate builds.

This was an example, and I do just that, even you built more than just systemd-boot, picking "no init" speeds things up a bit.

Quoted 4 lines

So, unless things have evolved substantially, I am not very fond of alowing this, and stand by the decision that was made back then (i.e. abide by upstream decision and tie systemd-boot to the systemd ecosystem).

I want to build systemd without using it as init system. Is there any reason to artificially prohibit that?
It's just a regular package for me.

Norbert
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH 2/2] package/systemd: allow package to be used without init system

Quoted 32 lines · Norbert Lange

Am Di., 19. Juli 2022 um 17:45 Uhr schrieb Yann E. MORIN <[email protected]>:

Quoted 18 lines

Norbert, All,

On 2022-07-19 15:16 +0200, Norbert Lange spake thusly:

Quoted 2 lines

Allow systemd to be built as normal package, this for example allows building systemd-boot without any init system.

How has the situation with upstream evolved since last time the topic was raised here:

     https://lore.kernel.org/buildroot/[email protected]/#t
and especially the sub-thread:
     https://lore.kernel.org/buildroot/d38239f86f99924e87dcb6e045b2de3ac0cb435f.1545814334.git.yann.morin.1998@free.fr/

As far as I know (and understand), upstream has decided to tie the build of systemd-boot (formerly the standalone gummiboot) to the build of the rest of the systemd suite; they did not accept to make it possible to only build systemd-boot to use it outside the systemd ecosystem.

Quoted 8 lines

From Buildroot's perspective, allowing to build systemd without it being
an init system, and without the possibility to just build systemd-boot, is asking for troubles down the line.

The triviality of your patch does not make it possible to only just build systemd-boot; instead, it still builds the whole systemd suite, which hints that upstream did not make it possible to do separate builds.

This was an example, and I do just that, even you built more than just systemd-boot, picking "no init" speeds things up a bit.

Quoted 8 lines
Quoted 4 lines

So, unless things have evolved substantially, I am not very fond of alowing this, and stand by the decision that was made back then (i.e. abide by upstream decision and tie systemd-boot to the systemd ecosystem).

I want to build systemd without using it as init system. Is there any reason to artificially prohibit that?
It's just a regular package for me.

AFAIU, systemd will unconditionally install /sbin/init, which will conflict
with the other init system you have defined. So to complete this patch you should make the prompt depend on BR2_INIT_NONE.

Same reasoning for udev (possible conflict with eudev), I'm not sure how to
fix that one.

There may be other conflicts as well, but the autobuilders will report those
(once we re-enable the conflict check...).

Regards,
Arnout

Quoted 6 lines

Norbert
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Re: [Buildroot] [PATCH 2/2] package/systemd: allow package to be used without init system

In reply to Yann E. MORIN
Quoted 12 lines · Yann E. MORIN

Norbert, All,

On 2022-07-19 15:16 +0200, Norbert Lange spake thusly:

Quoted 2 lines

Allow systemd to be built as normal package, this for example allows building systemd-boot without any init system.

How has the situation with upstream evolved since last time the topic was raised here:

     https://lore.kernel.org/buildroot/[email protected]/#t
and especially the sub-thread:
     https://lore.kernel.org/buildroot/d38239f86f99924e87dcb6e045b2de3ac0cb435f.1545814334.git.yann.morin.1998@free.fr/
Quoted 8 lines

As far as I know (and understand), upstream has decided to tie the build of systemd-boot (formerly the standalone gummiboot) to the build of the rest of the systemd suite; they did not accept to make it possible to only build systemd-boot to use it outside the systemd ecosystem.

From Buildroot's perspective, allowing to build systemd without it being
an init system, and without the possibility to just build systemd-boot, is asking for troubles down the line.

However, it does make sense if you're not actually building a full system.
That's not a use case that is really well supported by buildroot, but we shouldn't go out of our way to actively block that use case.

I've been thinking for a while to make an explicit option for this, which
would basically override/disable all the system/Config.in stuff. There's just one thing though: in such a use case, ou probably do still want to install the appropriate init scripts, so setting BR2_INIT_NONE is not exactly the correct either...

Regards,
Arnout

Quoted 34 lines

The triviality of your patch does not make it possible to only just build systemd-boot; instead, it still builds the whole systemd suite, which hints that upstream did not make it possible to do separate builds.

So, unless things have evolved substantially, I am not very fond of alowing this, and stand by the decision that was made back then (i.e. abide by upstream decision and tie systemd-boot to the systemd ecosystem).

Regards,
Yann E. MORIN.

Quoted 20 lines
---
  package/systemd/Config.in | 1 -
  1 file changed, 1 deletion(-)
package/systemd/Config.in +0 -1
index 9f1a778e59..e0f5dbce0d 100644
@@ -16,7 +16,6 @@ config BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
 
  menuconfig BR2_PACKAGE_SYSTEMD
  	bool "systemd"
-	depends on BR2_INIT_SYSTEMD
  	depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
  	depends on BR2_USE_MMU
  	depends on !BR2_STATIC_LIBS # kmod
Signature · 1 line
2.35.1
Quoted 5 lines
Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

Re: [Buildroot] [PATCH 2/2] package/systemd: allow package to be used without init system

Quoted 20 lines · Arnout Vandecappelle
Quoted 17 lines · Yann E. MORIN

Norbert, All,

On 2022-07-19 15:16 +0200, Norbert Lange spake thusly:

Quoted 2 lines

Allow systemd to be built as normal package, this for example allows building systemd-boot without any init system.

How has the situation with upstream evolved since last time the topic was raised here:
https://lore.kernel.org/buildroot/[email protected]/#t
and especially the sub-thread:
https://lore.kernel.org/buildroot/d38239f86f99924e87dcb6e045b2de3ac0cb435f.1545814334.git.yann.morin.1998@free.fr/

As far as I know (and understand), upstream has decided to tie the build of systemd-boot (formerly the standalone gummiboot) to the build of the rest of the systemd suite; they did not accept to make it possible to only build systemd-boot to use it outside the systemd ecosystem.

Quoted 5 lines
Quoted 3 lines

 From Buildroot's perspective, allowing to build systemd without it being an init system, and without the possibility to just build systemd-boot, is asking for troubles down the line.

 However, it does make sense if you're not actually building a full system. That's not a use case that is really well supported by buildroot, but we shouldn't go out of our way to actively block that use case.

 ... on the other hand, you can just select systemd as the init system even in that case. In the end, its only effects are:

- using the systemd skeleton rather than the empty skeleton;

- installing the systemd unit files for packages.

 The skeleton is not much of an overhead and is probably what you want anyway; the systemd unit files you probably want as well, as I observed before.

 So simply use BR2_INIT_SYSTEMD even if you're not actually using any init.

 Regards,
 Arnout

Quoted 44 lines

 I've been thinking for a while to make an explicit option for this, which would basically override/disable all the system/Config.in stuff. There's just one thing though: in such a use case, ou probably do still want to install the appropriate init scripts, so setting BR2_INIT_NONE is not exactly the correct either...

 Regards,
 Arnout

Quoted 38 lines

The triviality of your patch does not make it possible to only just build systemd-boot; instead, it still builds the whole systemd suite, which hints that upstream did not make it possible to do separate builds.

So, unless things have evolved substantially, I am not very fond of alowing this, and stand by the decision that was made back then (i.e. abide by upstream decision and tie systemd-boot to the systemd ecosystem).

Regards,
Yann E. MORIN.

Quoted 23 lines

---
  package/systemd/Config.in | 1 -

  1 file changed, 1 deletion(-)
package/systemd/Config.in +0 -0
index 9f1a778e59..e0f5dbce0d 100644
@@ -16,7 +16,6 @@ config BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS

    menuconfig BR2_PACKAGE_SYSTEMD
      bool "systemd"
-    depends on BR2_INIT_SYSTEMD
      depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS depends on BR2_USE_MMU
      depends on !BR2_STATIC_LIBS # kmod

Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#7 lore raw
In reply to Norbert Lange

Norbert, All,

On 2022-07-19 15:16 +0200, Norbert Lange spake thusly:

Quoted 2 lines

Once you allow systemd to be build while not using it as init system, the variable will be mpty and the build fails.

A better commit log would be:

Currently, we forcefully require that a default target be specified. However, systemd does install a default target, but it's not possible to just use that target.

Allow the user to blank-out the config setting to not override whatever systemd installed and keep that.

(I don't think we want to be able to build systemd when it is not selected as an init system, so we should not refer to that in the commit log; see my reply to your next patch...)

Quoted 10 lines
---
 package/systemd/systemd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/systemd/systemd.mk +0 -0
index b6fffc553f..1510437617 100644

package/systemd/systemd.mk SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME) · line 591

Quoted 7 lines
package/systemd/systemd.mk +1 -1
@@ -586,7 +586,7 @@ SYSTEMD_CONF_OPTS += -Dfallback-hostname=$(SYSTEMD_FALLBACK_HOSTNAME)
 endif
 
 define SYSTEMD_INSTALL_INIT_HOOK
-	ln -fs "$(call qstrip,$(BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET))" \
+	ln -fs "$(or $(call qstrip,$(BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET)),multi-user.target)" \
 		$(TARGET_DIR)/usr/lib/systemd/system/default.target
 endef

Instead, the whole hook should be made conditional to whether the default target is to be overriden:

    SYSTEMD_DEFAULT_TARGET = $(call qstrip,$(BR2_PACKAGE_SYSTEMD_DEFAULT_TARGET))
    ifneq ($(SYSTEMD_DEFAULT_TARGET),)
    define SYSTEMD_INSTALL_FORCE_TARGET
        ln -fs $(SYSTEMD_DEFAULT_TARGET) \
            $(TARGET_DIR)/usr/lib/systemd/system/default.target
    endef
    SYSTEMD_POST_INSTALL_TARGET_HOOKS += SYSTEMD_INSTALL_FORCE_TARGET
    endif

... and drop the assignment a few lines later, of course.

Regards,
Yann E. MORIN.

Quoted 7 lines
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 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.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot