diff mbox

[1/2] Rework of the init system

Message ID 1cbed22cb8b47ae0241f8ab981acb1662eca1f46.1338285613.git.maxime.ripard@free-electrons.com
State Superseded
Headers show

Commit Message

Maxime Ripard May 29, 2012, 10 a.m. UTC
Since we have now two uncompatible init systems, and we want only one of
them at the same time in use in the rootfs, we need to select a
particular init system. This patch also adds $(PKG)_INSTALL_INIT_SYSTEMD
and $(PKG)_INSTALL_INIT_SYSV hooks that are called when the matching
init systems are selected to install properly the init scripts of the
package.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 package/pkg-gentargets.mk  |    8 ++++++++
 package/sysvinit/Config.in |    1 +
 target/generic/Config.in   |   25 +++++++++++++++++++++++++
 3 files changed, 34 insertions(+)

Comments

Maxime Ripard June 18, 2012, 8:32 a.m. UTC | #1
Hi Arnout,

Thanks for the review.

Le 05/06/2012 01:28, Arnout Vandecappelle a écrit :
> On 05/29/12 12:00, Maxime Ripard wrote:
>> Since we have now two uncompatible init systems, and we want only one of
>> them at the same time in use in the rootfs, we need to select a
>> particular init system. This patch also adds $(PKG)_INSTALL_INIT_SYSTEMD
>> and $(PKG)_INSTALL_INIT_SYSV hooks that are called when the matching
>> init systems are selected to install properly the init scripts of the
>> package.
>>
>> Signed-off-by: Maxime Ripard<maxime.ripard@free-electrons.com>
> 
> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> 
>  Two remarks, but they don't need to stop this patch.
> 
> [snip]
>> 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
> 
>  I don't think this is needed.  If you do keep it, there should also be one
> for systemd.

Ok, I'll remove it.

>>       help
>>         /sbin/init - parent of all processes
>>
>> diff --git a/target/generic/Config.in b/target/generic/Config.in
>> index 88f0718..309ef55 100644
>> --- a/target/generic/Config.in
>> +++ b/target/generic/Config.in
>> @@ -37,6 +37,31 @@ comment "udev requires a toolchain with LARGEFILE +
>> WCHAR support"
>>
>>   endchoice
>>
>> +choice
>> +    prompt "Init system"
>> +    default BR2_INIT_BUSYBOX
>> +
>> +config BR2_INIT_BUSYBOX
>> +    bool "Busybox"
>> +    select BR2_PACKAGE_BUSYBOX
> 
>  Ideally, the busybox.mk should make sure init is selected in the
> busybox config
> if this option is chosen.


I actually did so at first, and you asked me back then to remove it :)
(http://lists.busybox.net/pipermail/buildroot/2011-December/048541.html)

Anyway, I'm fine with both approaches here, so I'm fine adding it again :)


>> +
>> +config BR2_INIT_SYSV
>> +    bool "systemV"
>> +    select BR2_PACKAGE_SYSVINIT
>> +
>> +config BR2_INIT_SYSTEMD
>> +    bool "systemd"
>> +    depends on BR2_LARGEFILE
>> +    depends on BR2_USE_WCHAR
>> +    depends on BR2_INET_IPV6
>> +    select BR2_PACKAGE_DBUS
>> +    select BR2_PACKAGE_SYSTEMD
>> +
>> +comment 'systemd requires largefile, wchar and IPv6 support'
>> +    depends on !(BR2_LARGEFILE&&  BR2_USE_WCHAR&&  BR2_INET_IPV6)
>> +
>> +endchoice
>> +
>>   config BR2_ROOTFS_DEVICE_TABLE
>>       string "Path to the permission tables"
>>       default "target/generic/device_table.txt"
>
Arnout Vandecappelle June 20, 2012, 6:59 a.m. UTC | #2
On 06/18/12 10:32, Maxime Ripard wrote:
>>> >>  +choice
>>> >>  +    prompt "Init system"
>>> >>  +    default BR2_INIT_BUSYBOX
>>> >>  +
>>> >>  +config BR2_INIT_BUSYBOX
>>> >>  +    bool "Busybox"
>>> >>  +    select BR2_PACKAGE_BUSYBOX
>> >
>> >    Ideally, the busybox.mk should make sure init is selected in the
>> >  busybox config
>> >  if this option is chosen.
>
> I actually did so at first, and you asked me back then to remove it:)
> (http://lists.busybox.net/pipermail/buildroot/2011-December/048541.html)

  You misunderstood my comment back then: I'm against _disabling_ the
busybox init.  The _enable_ should be kept.

  Regards,
  Arnout
Maxime Ripard June 20, 2012, 12:30 p.m. UTC | #3
Hi Arnout,

Le 20/06/2012 08:59, Arnout Vandecappelle a écrit :
> On 06/18/12 10:32, Maxime Ripard wrote:
>>>> >>  +choice
>>>> >>  +    prompt "Init system"
>>>> >>  +    default BR2_INIT_BUSYBOX
>>>> >>  +
>>>> >>  +config BR2_INIT_BUSYBOX
>>>> >>  +    bool "Busybox"
>>>> >>  +    select BR2_PACKAGE_BUSYBOX
>>> >
>>> >    Ideally, the busybox.mk should make sure init is selected in the
>>> >  busybox config
>>> >  if this option is chosen.
>>
>> I actually did so at first, and you asked me back then to remove it:)
>> (http://lists.busybox.net/pipermail/buildroot/2011-December/048541.html)
> 
>  You misunderstood my comment back then: I'm against _disabling_ the
> busybox init.  The _enable_ should be kept.

Yes, that's what I understood a bit later.
This is what is implemented in the third version of the pull request.

Maxime
diff mbox

Patch

diff --git a/package/pkg-gentargets.mk b/package/pkg-gentargets.mk
index 1c9b458..645f53b 100644
--- a/package/pkg-gentargets.mk
+++ b/package/pkg-gentargets.mk
@@ -133,6 +133,10 @@  $(BUILD_DIR)/%/.stamp_images_installed:
 # Install to target dir
 $(BUILD_DIR)/%/.stamp_target_installed:
 	@$(call MESSAGE,"Installing to target")
+	$(if $(BR2_INIT_SYSTEMD),\
+		$($(PKG)_INSTALL_INIT_SYSTEMD))
+	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
+		$($(PKG)_INSTALL_INIT_SYSV))
 	$($(PKG)_INSTALL_TARGET_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -151,6 +155,10 @@  $(BUILD_DIR)/%/.stamp_uninstalled:
 	rm -f $($(PKG)_TARGET_INSTALL_TARGET)
 	$($(PKG)_UNINSTALL_STAGING_CMDS)
 	$($(PKG)_UNINSTALL_TARGET_CMDS)
+	$(if $(BR2_INIT_SYSTEMD),\
+		$($(PKG)_UNINSTALL_INIT_SYSTEMD))
+	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
+		$($(PKG)_UNINSTALL_INIT_SYSV))
 
 # Remove package sources
 $(BUILD_DIR)/%/.stamp_dircleaned:
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/target/generic/Config.in b/target/generic/Config.in
index 88f0718..309ef55 100644
--- a/target/generic/Config.in
+++ b/target/generic/Config.in
@@ -37,6 +37,31 @@  comment "udev requires a toolchain with LARGEFILE + WCHAR support"
 
 endchoice
 
+choice
+	prompt "Init system"
+	default BR2_INIT_BUSYBOX
+
+config BR2_INIT_BUSYBOX
+	bool "Busybox"
+	select BR2_PACKAGE_BUSYBOX
+
+config BR2_INIT_SYSV
+	bool "systemV"
+	select BR2_PACKAGE_SYSVINIT
+
+config BR2_INIT_SYSTEMD
+	bool "systemd"
+	depends on BR2_LARGEFILE
+	depends on BR2_USE_WCHAR
+	depends on BR2_INET_IPV6
+	select BR2_PACKAGE_DBUS
+	select BR2_PACKAGE_SYSTEMD
+
+comment 'systemd requires largefile, wchar and IPv6 support'
+	depends on !(BR2_LARGEFILE && BR2_USE_WCHAR && BR2_INET_IPV6)
+
+endchoice
+
 config BR2_ROOTFS_DEVICE_TABLE
 	string "Path to the permission tables"
 	default "target/generic/device_table.txt"