From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/3] Rework of the init system
Date: Mon, 02 Jan 2012 10:52:13 +0100 [thread overview]
Message-ID: <4F017E4D.4020004@free-electrons.com> (raw)
In-Reply-To: <201112200903.41149.arnout@mind.be>
On 20/12/2011 09:03, Arnout Vandecappelle wrote:
> On Wednesday 23 November 2011 12:30:10 Maxime Ripard wrote:
>> Since we have now two uncompatible init systems, and we want only one of
>> them at the same time in the rootfs, we need to select a particular init
>> system. This patch also adds $(PKG)_INIT_SYSV and $(PKG)_INIT_SYSTEMD
>> variables, that basically moves the init script installation in the
>> package infrastructure, and installs them only when needed.
>>
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>
>> ---
>> package/Makefile.package.in | 8 ++++++++
>> package/busybox/busybox.mk | 11 +++++++++++
>> package/systemd/Config.in | 1 +
>> package/sysvinit/Config.in | 1 +
>> package/sysvinit/sysvinit.mk | 5 -----
>> target/generic/Config.in | 19 +++++++++++++++++++
>> 6 files changed, 40 insertions(+), 5 deletions(-)
>>
>> diff --git a/package/Makefile.package.in b/package/Makefile.package.in
>> index bd9ceb5..c0684d0 100644
>> --- a/package/Makefile.package.in
>> +++ b/package/Makefile.package.in
>> @@ -367,6 +367,10 @@ $(BUILD_DIR)/%/.stamp_images_installed:
>> # Install to target dir
>> $(BUILD_DIR)/%/.stamp_target_installed:
>> @$(call MESSAGE,"Installing to target")
>> + $(if $(and $(BR2_INIT_SYSTEMD),$($(PKG)_INIT_SYSTEMD)),\
>> + $(foreach init,$($(PKG)_INIT_SYSTEMD),$(INSTALL) -m 0755 -D $(init) $(TARGET_DIR)/etc/init.d/$(notdir $(init))))
>> + $(if $(and $(or $(BR2_INIT_SYSV),$(BR2_INIT_BUSYBOX)),$($(PKG)_INIT_SYSV)),\
>> + $(foreach init,$($(PKG)_INIT_SYSV),$(INSTALL) -m 0755 -D $(init) $(TARGET_DIR)/etc/init.d/$(notdir $(init))))
> Since this is used twice, it makes sense to either define a function for
> it or to go over SYSTEMD and SYSV in a loop. Also to simplify things, I
> would rename BR2_INIT_SYSV to BR2_INIT_SYSVINIT and define an additional
> BR2_INIT_SYSV that is selected by both INIT_BUSYBOX and INIT_SYSV (see
> below). So this becomes (untested!):
> $(foreach style,SYSTEMD SYSV,\
> $(if $(and $(BR2_INIT_$(style)),$($(PKG)_INIT_$(style))),\
> $(foreach init,$($(PKG)_INIT_$(style)),\
> $(INSTALL) -m 0755 -D $(init) $(TARGET_DIR)/etc/init.d/$(notdir $(init)))))
This seem to be a way better solution :)
>> $($(PKG)_INSTALL_TARGET_CMDS)
>> $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
>> $(Q)touch $@
>> @@ -384,6 +388,8 @@ $(BUILD_DIR)/%/.stamp_uninstalled:
>> rm -f $($(PKG)_TARGET_INSTALL_STAGING)
>> $($(PKG)_UNINSTALL_TARGET_CMDS)
>> rm -f $($(PKG)_TARGET_INSTALL_TARGET)
>> + $(foreach init, $($(PKG)_INIT_SYSV), rm -f $(TARGET_DIR)/etc/init.d/$(notdir $(init)))
>> + $(foreach init, $($(PKG)_INIT_SYSTEMD), rm -f $(TARGET_DIR)/etc/init.d/$(notdir $(init)))
>>
>> # Remove package sources
>> $(BUILD_DIR)/%/.stamp_dircleaned:
>> @@ -479,6 +485,8 @@ endif
>> endif
>>
>> $(2)_DEPENDENCIES ?=
>> +$(2)_INIT_SYSTEMD ?=
>> +$(2)_INIT_SYSV ?=
>> $(2)_INSTALL_STAGING ?= NO
>> $(2)_INSTALL_IMAGES ?= NO
>> $(2)_INSTALL_TARGET ?= YES
>> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
>> index 9e91136..73c4969 100644
>> --- a/package/busybox/busybox.mk
>> +++ b/package/busybox/busybox.mk
>> @@ -129,6 +129,16 @@ define BUSYBOX_DISABLE_MMU_APPLETS
>> endef
>> endif
>>
>> +ifeq ($(BR2_INIT_BUSYBOX),y)
>> +define BUSYBOX_SET_INIT
>> + $(call KCONFIG_ENABLE_OPT,CONFIG_INIT,$(BUSYBOX_BUILD_CONFIG))
>> +endef
>> +else
>> +define BUSYBOX_SET_INIT
>> + $(call KCONFIG_DISABLE_OPT,CONFIG_INIT,$(BUSYBOX_BUILD_CONFIG))
>> +endef
>> +endif
>> +
> I'm not sure if I'd want to have the disable there if BR2_INIT_BUSYBOX
> is not selected. There's nothing against a parallel install of
> systemd and busybox-init, selectable by 'init=...' on the kernel
> command line. (Well, except that systemd's symlinks destroy busybox init.)
Well mutually exclusive init systems is the more obvious solution.
Having an sysv init and systemd should be ok at the same time should be
ok indeed, at least from a filesystem and boot point of view, but it
will probably be more problematic for the init scripts.
From what I understood of it, if init scripts are presents, systemd will
check the name to see if it has a unit for this, and will prefer the
unit if it has one. But I'm not sure how it will behave with our way of
naming the init scripts.
For example, if there is S10udev installed, I'm afraid we will try to
launch udev twice, as systemd won't match S10udev to it udev unit.
I need to check that.
>> define BUSYBOX_INSTALL_LOGGING_SCRIPT
>> if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
>> [ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
>> @@ -145,6 +155,7 @@ define BUSYBOX_CONFIGURE_CMDS
>> $(BUSYBOX_SET_BB_PWD)
>> $(BUSYBOX_SET_LARGEFILE)
>> $(BUSYBOX_SET_IPV6)
>> + $(BUSYBOX_SET_INIT)
>> $(BUSYBOX_SET_RPC)
>> $(BUSYBOX_PREFER_STATIC)
>> $(BUSYBOX_SET_MDEV)
>> diff --git a/package/systemd/Config.in b/package/systemd/Config.in
>> index 09cedb9..33d5ccf 100644
>> --- a/package/systemd/Config.in
>> +++ b/package/systemd/Config.in
>> @@ -1,5 +1,6 @@
>> config BR2_PACKAGE_SYSTEMD
>> bool "systemd"
>> + depends on BR2_INIT_SYSTEMD
> Again, there is no reason why you can't have sysvinit and systemd in
> parallel (except for the symlinks). Also, if you really want them to
> be mutually exclusive, I'd prefer the more explicit
> depends on !BR2_PACKAGE_SYSVINIT
Hmmm, you mean BR2_INIT_SYSV ?
>> depends on BR2_PACKAGE_UDEV
>> depends on BR2_PACKAGE_DBUS
>> select BR2_PACKAGE_LIBCAP
>> diff --git a/package/sysvinit/Config.in b/package/sysvinit/Config.in
>> index 34ec391..d91c643 100644
>> --- a/package/sysvinit/Config.in
>> +++ b/package/sysvinit/Config.in
>> @@ -1,5 +1,6 @@
>> config BR2_PACKAGE_SYSVINIT
>> bool "sysvinit"
>> + depends on BR2_INIT_SYSV
>> help
>> /sbin/init - parent of all processes
>>
>> diff --git a/package/sysvinit/sysvinit.mk b/package/sysvinit/sysvinit.mk
>> index 0d65c43..163ba9b 100644
>> --- a/package/sysvinit/sysvinit.mk
>> +++ b/package/sysvinit/sysvinit.mk
>> @@ -8,11 +8,6 @@ SYSVINIT_SOURCE = sysvinit_$(SYSVINIT_VERSION)dsf.orig.tar.gz
>> SYSVINIT_PATCH = sysvinit_$(SYSVINIT_VERSION)dsf-13.1.diff.gz
>> SYSVINIT_SITE = $(BR2_DEBIAN_MIRROR)/debian/pool/main/s/sysvinit
>>
>> -# Override Busybox implementations if Busybox is enabled.
>> -ifeq ($(BR2_PACKAGE_BUSYBOX),y)
>> -SYSVINIT_DEPENDENCIES = busybox
>> -endif
>> -
>> define SYSVINIT_DEBIAN_PATCHES
>> if [ -d $(@D)/debian/patches ]; then \
>> support/scripts/apply-patches.sh $(@D) $(@D)/debian/patches \*.patch; \
>> diff --git a/target/generic/Config.in b/target/generic/Config.in
>> index a91de32..d9b93af 100644
>> --- a/target/generic/Config.in
>> +++ b/target/generic/Config.in
>> @@ -32,6 +32,25 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
>>
>> endchoice
>>
>> +choice
>> + prompt "Init system"
>> + default BR2_INIT_BUSYBOX
>> +
>> +config BR2_INIT_BUSYBOX
>> + bool "Busybox init"
>> + select BR2_PACKAGE_BUSYBOX
>> +
>> +config BR2_INIT_SYSTEMD
>> + bool "Use systemd"
>> + depends on BR2_PACKAGE_UDEV
> Missing:
> depends on BR2_PACKAGE_DBUS
> Also missing the comment in case the dependencies are not met.
Indeed
>> + select BR2_PACKAGE_SYSTEMD
>> +
>> +config BR2_INIT_SYSV
>> + bool "Use systemV init"
>> + select BR2_PACKAGE_SYSVINIT
>> +
>> +endchoice
>> +
> I'd prefer the ordering to be busybox, sysvinit, systemd, because:
> - systemd is newer
> - systemd has more dependencies
Ok
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2012-01-02 9:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 11:30 [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
2011-11-23 11:30 ` [Buildroot] [PATCH 1/3] Add the systemd package Maxime Ripard
2011-11-23 11:57 ` Baruch Siach
2011-11-23 13:53 ` Maxime Ripard
2011-12-20 7:05 ` Arnout Vandecappelle
2012-01-02 9:35 ` Maxime Ripard
2011-11-23 11:30 ` [Buildroot] [PATCH 2/3] Rework of the init system Maxime Ripard
2011-12-20 8:03 ` Arnout Vandecappelle
2012-01-02 9:52 ` Maxime Ripard [this message]
2012-01-02 14:52 ` Thomas Petazzoni
2012-01-06 7:13 ` Arnout Vandecappelle
2012-01-06 9:15 ` Maxime Ripard
2012-01-09 6:37 ` Arnout Vandecappelle
2011-11-23 11:30 ` [Buildroot] [PATCH 3/3] Migrate the packages to the new infra Maxime Ripard
2011-12-20 21:29 ` Arnout Vandecappelle
2012-01-02 10:02 ` Maxime Ripard
2012-01-06 6:52 ` Arnout Vandecappelle
2011-11-23 14:05 ` [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
2011-11-23 21:14 ` Belisko Marek
2011-11-23 21:35 ` Maxime Ripard
2011-12-20 21:14 ` Arnout Vandecappelle
2011-12-14 10:43 ` Maxime Ripard
2011-12-20 6:49 ` Arnout Vandecappelle
2012-01-02 9:58 ` Maxime Ripard
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=4F017E4D.4020004@free-electrons.com \
--to=maxime.ripard@free-electrons.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