Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [RFC] Add systemd to buildroot
@ 2011-11-23 11:30 Maxime Ripard
  2011-11-23 11:30 ` [Buildroot] [PATCH 1/3] Add the systemd package Maxime Ripard
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 11:30 UTC (permalink / raw)
  To: buildroot

Hi list,

I've been working for some time on adding systemd to buildroot in a nice way. It
is now in a pretty nice state I guess, at least nice enough to send an RFC and
get some review about the basic mechanics.

While the system should boot with systemd, for a reason unknown to me, udev
doesn't take into account its rules, and don't tag the devices for systemd,
which, in turn, doesn't expose a getty.

Another problem is that I still have some sysv init scripts added to the
filesystem through the skeleton. Since it is completely static, I don't find a
good way around this problem. Maybe we don't care. I don't know.

So, give it a look, and please tell me what you think :)

Maxime

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 1/3] Add the systemd package
  2011-11-23 11:30 [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
@ 2011-11-23 11:30 ` Maxime Ripard
  2011-11-23 11:57   ` Baruch Siach
  2011-12-20  7:05   ` Arnout Vandecappelle
  2011-11-23 11:30 ` [Buildroot] [PATCH 2/3] Rework of the init system Maxime Ripard
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 11:30 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 fs/skeleton/etc/mtab       |    2 +-
 linux/linux.mk             |    2 +
 package/Config.in          |    1 +
 package/dbus/dbus.mk       |    4 +++
 package/systemd/Config.in  |   16 +++++++++++++++
 package/systemd/systemd.mk |   45 ++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 69 insertions(+), 1 deletions(-)
 create mode 100644 package/systemd/Config.in
 create mode 100644 package/systemd/systemd.mk

diff --git a/fs/skeleton/etc/mtab b/fs/skeleton/etc/mtab
index e1c2045..4c0a094 120000
--- a/fs/skeleton/etc/mtab
+++ b/fs/skeleton/etc/mtab
@@ -1 +1 @@
-../proc/mounts
\ No newline at end of file
+/proc/mounts
\ No newline at end of file
diff --git a/linux/linux.mk b/linux/linux.mk
index 5c5a1d2..22f50b4 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -149,6 +149,8 @@ define LINUX_CONFIGURE_CMDS
 	$(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),
 		$(call KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$(@D)/.config))
 	yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig
+	$(if $(BR2_INIT_SYSTEMD),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config),)
 endef
 
 # Compilation. We make sure the kernel gets rebuilt when the
diff --git a/package/Config.in b/package/Config.in
index 4b5e5d8..42ec82a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -534,6 +534,7 @@ source "package/psmisc/Config.in"
 source "package/rsyslog/Config.in"
 source "package/sysklogd/Config.in"
 source "package/sysvinit/Config.in"
+source "package/systemd/Config.in"
 endif
 source "package/util-linux/Config.in"
 source "package/dsp-tools/Config.in"
diff --git a/package/dbus/dbus.mk b/package/dbus/dbus.mk
index e18e291..f18d84a 100644
--- a/package/dbus/dbus.mk
+++ b/package/dbus/dbus.mk
@@ -39,6 +39,10 @@ else
 DBUS_CONF_OPT += --without-x
 endif
 
+ifeq ($(BR2_INIT_SYSTEMD),y)
+DBUS_CONF_OPT += --with-systemdsystemunitdir=/lib/systemd/system
+endif
+
 # fix rebuild (dbus makefile errors out if /var/lib/dbus is a symlink)
 define DBUS_REMOVE_VAR_LIB_DBUS
 	rm -rf $(TARGET_DIR)/var/lib/dbus
diff --git a/package/systemd/Config.in b/package/systemd/Config.in
new file mode 100644
index 0000000..09cedb9
--- /dev/null
+++ b/package/systemd/Config.in
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_SYSTEMD
+	bool "systemd"
+	depends on BR2_PACKAGE_UDEV
+	depends on BR2_PACKAGE_DBUS
+	select BR2_PACKAGE_LIBCAP
+	help
+	  systemd is a system and service manager for Linux, compatible with
+	  SysV and LSB init scripts. systemd provides aggressive parallelization
+	  capabilities, uses socket and D-Bus activation for starting services,
+	  offers on-demand starting of daemons, keeps track of processes using
+	  Linux cgroups, supports snapshotting and restoring of the system
+	  state, maintains mount and automount points and implements an
+	  elaborate transactional dependency-based service control logic. It can
+	  work as a drop-in replacement for sysvinit. 
+
+	  http://freedesktop.org/wiki/Software/systemd
diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
new file mode 100644
index 0000000..8733ce0
--- /dev/null
+++ b/package/systemd/systemd.mk
@@ -0,0 +1,45 @@
+#############################################################
+#
+# systemd
+#
+#############################################################
+SYSTEMD_VERSION = 37
+SYSTEMD_SITE = http://www.freedesktop.org/software/systemd/
+SYSTEMD_SOURCE = systemd-$(SYSTEMD_VERSION).tar.bz2
+SYSTEMD_DEPENDENCIES = \
+	host-intltool \
+	libcap \
+	udev \
+	dbus
+
+SYSTEMD_CONF_OPT = \
+	--with-distro=other \
+	--disable-selinux \
+	--disable-acl \
+	--disable-pam \
+	--disable-libcryptsetup \
+	--disable-gtk \
+	--disable-plymouth \
+	--with-rootdir=/ \
+	--with-dbuspolicydir=/etc/dbus-1/system.d \
+	--with-dbussessionservicedir=/usr/share/dbus-1/services \
+	--with-dbussystemservicedir=/usr/share/dbus-1/system-services \
+	--with-dbusinterfacedir=/usr/share/dbus-1/interfaces \
+	--with-udevrulesdir=/etc/udev/rules.d \
+
+define SYSTEMD_INSTALL_INIT_HOOK
+	ln -fs /bin/systemd $(TARGET_DIR)/sbin/init
+	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/halt
+	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/poweroff
+	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/reboot
+endef
+
+define SYSTEMD_INSTALL_TTY_HOOK
+	ln -fs /lib/systemd/system/getty at .service $(TARGET_DIR)/etc/systemd/system/getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service
+endef
+
+SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
+	SYSTEMD_INSTALL_INIT_HOOK \
+	SYSTEMD_INSTALL_TTY_HOOK \
+
+$(eval $(call AUTOTARGETS))
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  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:30 ` Maxime Ripard
  2011-12-20  8:03   ` Arnout Vandecappelle
  2011-11-23 11:30 ` [Buildroot] [PATCH 3/3] Migrate the packages to the new infra Maxime Ripard
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 11:30 UTC (permalink / raw)
  To: buildroot

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>
---
 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))))
 	$($(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
+
 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
 	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
+	select BR2_PACKAGE_SYSTEMD
+
+config BR2_INIT_SYSV
+	bool "Use systemV init"
+	select BR2_PACKAGE_SYSVINIT
+
+endchoice
+
 config BR2_ROOTFS_DEVICE_TABLE
 	string "Path to the permission tables"
 	default "target/generic/device_table.txt"
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 3/3] Migrate the packages to the new infra
  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:30 ` [Buildroot] [PATCH 2/3] Rework of the init system Maxime Ripard
@ 2011-11-23 11:30 ` Maxime Ripard
  2011-12-20 21:29   ` Arnout Vandecappelle
  2011-11-23 14:05 ` [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 11:30 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 package/at/at.mk                                 |    7 +------
 package/avahi/avahi.mk                           |    8 ++------
 package/busybox/busybox.mk                       |   13 ++++++-------
 package/dbus/dbus.mk                             |    3 ++-
 package/dhcp/dhcp.mk                             |    6 ++----
 package/dropbear/dropbear.mk                     |    6 ++----
 package/gdk-pixbuf/gdk-pixbuf.mk                 |    6 +-----
 package/gpsd/gpsd.mk                             |    2 +-
 package/input-event-daemon/input-event-daemon.mk |    4 +---
 package/multimedia/mpd/mpd.mk                    |    3 +--
 package/netplug/netplug.mk                       |    2 +-
 package/netsnmp/netsnmp.mk                       |    6 +++---
 package/nfs-utils/nfs-utils.mk                   |    4 ++--
 package/ntp/ntp.mk                               |    6 ++++--
 package/olsr/olsr.mk                             |    3 +--
 package/openssh/openssh.mk                       |    7 +------
 package/pango/pango.mk                           |    9 ++-------
 package/portmap/portmap.mk                       |    3 +--
 package/proftpd/proftpd.mk                       |    4 ++--
 package/radvd/radvd.mk                           |    7 +------
 package/rsyslog/rsyslog.mk                       |    3 +--
 package/samba/samba.mk                           |    9 +++------
 package/stunnel/stunnel.mk                       |    2 +-
 package/tftpd/tftpd.mk                           |    2 +-
 package/tinyhttpd/tinyhttpd.mk                   |    2 +-
 package/udev/udev.mk                             |    8 ++------
 26 files changed, 46 insertions(+), 89 deletions(-)

diff --git a/package/at/at.mk b/package/at/at.mk
index 4270c83..c88e207 100644
--- a/package/at/at.mk
+++ b/package/at/at.mk
@@ -21,17 +21,12 @@ AT_CONF_OPT = \
         --with-daemon_groupname=root \
 	SENDMAIL=/usr/sbin/sendmail
 
-define AT_INSTALL_INITSCRIPT
-	$(INSTALL) -m 0755 -D package/at/S99at $(TARGET_DIR)/etc/init.d/S99at
-endef
-
-AT_POST_INSTALL_TARGET_HOOKS += AT_INSTALL_INITSCRIPT
+AT_INIT_SYSV = package/at/S99at
 
 define AT_UNINSTALL_TARGET_CMDS
 	rm -rf $(addprefix $(TARGET_DIR),/usr/lib/atspool \
 					 /usr/lib/atjobs \
 					 /etc/at.deny \
-					 /etc/init.d/S99at \
 					 /usr/bin/at \
 					 /usr/bin/atrm \
 					 /usr/bin/atq \
diff --git a/package/avahi/avahi.mk b/package/avahi/avahi.mk
index 739c5f2..b495c96 100644
--- a/package/avahi/avahi.mk
+++ b/package/avahi/avahi.mk
@@ -146,22 +146,18 @@ AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_REMOVE_INITSCRIPT
 define AVAHI_INSTALL_AUTOIPD
 	rm -rf $(TARGET_DIR)/etc/dhcp3/
 	$(INSTALL) -D -m 0755 package/avahi/busybox-udhcpc-default.script $(TARGET_DIR)/usr/share/udhcpc/default.script
-	$(INSTALL) -m 0755 package/avahi/S05avahi-setup.sh $(TARGET_DIR)/etc/init.d/
 	rm -f $(TARGET_DIR)/var/lib/avahi-autoipd
 	$(INSTALL) -d -m 0755 $(TARGET_DIR)/var/lib
 	ln -sf /tmp/avahi-autoipd $(TARGET_DIR)/var/lib/avahi-autoipd
 endef
 
 ifeq ($(BR2_PACKAGE_AVAHI_AUTOIPD),y)
+AVAHI_INIT_SYSV += package/avahi/S05avahi-setup.sh
 AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_INSTALL_AUTOIPD
 endif
 
-define AVAHI_INSTALL_DAEMON_INITSCRIPT
-	$(INSTALL) -m 0755 package/avahi/S50avahi-daemon $(TARGET_DIR)/etc/init.d/
-endef
-
 ifeq ($(BR2_PACKAGE_AVAHI_DAEMON),y)
-AVAHI_POST_INSTALL_TARGET_HOOKS += AVAHI_INSTALL_DAEMON_INITSCRIPT
+AVAHI_INIT_SYSV += package/avahi/S50avahi-daemon
 endif
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index 73c4969..0ff27ca 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -30,11 +30,7 @@ endif
 
 # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
 ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
-define BUSYBOX_INSTALL_MDEV_SCRIPT
-	[ -f $(TARGET_DIR)/etc/init.d/S10mdev ] || \
-		install -D -m 0755 package/busybox/S10mdev \
-			$(TARGET_DIR)/etc/init.d/S10mdev
-endef
+BUSYBOX_INIT_SYSV += package/busybox/S10mdev
 define BUSYBOX_INSTALL_MDEV_CONF
 	[ -f $(TARGET_DIR)/etc/mdev.conf ] || \
 		install -D -m 0644 package/busybox/mdev.conf \
@@ -139,6 +135,7 @@ define BUSYBOX_SET_INIT
 endef
 endif
 
+ifeq ($(BR2_INIT_BUSYBOX)$(BR2_INIT_SYSV),y)
 define BUSYBOX_INSTALL_LOGGING_SCRIPT
 	if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
 		[ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
@@ -146,12 +143,15 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
 				$(TARGET_DIR)/etc/init.d/S01logging; \
 	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
 endef
+else
+define BUSYBOX_INSTALL_LOGGING_SCRIPT
+endef
+endif
 
 # We do this here to avoid busting a modified .config in configure
 BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
 
 define BUSYBOX_CONFIGURE_CMDS
-	$(BUSYBOX_SET_SYSKLOGD)
 	$(BUSYBOX_SET_BB_PWD)
 	$(BUSYBOX_SET_LARGEFILE)
 	$(BUSYBOX_SET_IPV6)
@@ -177,7 +177,6 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 		$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
 			$(TARGET_DIR)/usr/share/udhcpc/default.script; \
 	fi
-	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
 endef
diff --git a/package/dbus/dbus.mk b/package/dbus/dbus.mk
index f18d84a..9d2255d 100644
--- a/package/dbus/dbus.mk
+++ b/package/dbus/dbus.mk
@@ -24,6 +24,8 @@ DBUS_CONF_OPT = --with-dbus-user=dbus \
 		--with-system-socket=/var/run/dbus/system_bus_socket \
 		--with-system-pid-file=/var/run/messagebus.pid
 
+DBUS_INIT_SYSV = package/dbus/S30dbus
+
 ifeq ($(BR2_DBUS_EXPAT),y)
 DBUS_CONF_OPT += --with-xml=expat
 DBUS_DEPENDENCIES += expat
@@ -61,7 +63,6 @@ endif
 define DBUS_INSTALL_TARGET_FIXUP
 	rm -rf $(TARGET_DIR)/var/lib/dbus
 	ln -sf /tmp/dbus $(TARGET_DIR)/var/lib/dbus
-	$(INSTALL) -m 0755 -D package/dbus/S30dbus $(TARGET_DIR)/etc/init.d/S30dbus
 endef
 
 DBUS_POST_INSTALL_TARGET_HOOKS += DBUS_INSTALL_TARGET_FIXUP
diff --git a/package/dhcp/dhcp.mk b/package/dhcp/dhcp.mk
index 7548f41..db4b5e1 100644
--- a/package/dhcp/dhcp.mk
+++ b/package/dhcp/dhcp.mk
@@ -20,25 +20,23 @@ ifneq ($(BR2_INET_IPV6),y)
 endif
 
 ifeq ($(BR2_PACKAGE_DHCP_SERVER),y)
+DHCP_INIT_SYSV += package/dhcp/S80dhcp-server
 define DHCP_INSTALL_SERVER
 	mkdir -p $(TARGET_DIR)/var/lib
 	(cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp)
 	$(INSTALL) -m 0755 -D $(@D)/server/dhcpd $(TARGET_DIR)/usr/sbin/dhcpd
-	$(INSTALL) -m 0755 -D package/dhcp/S80dhcp-server \
-		$(TARGET_DIR)/etc/init.d/S80dhcp-server
 	$(INSTALL) -m 0644 -D package/dhcp/dhcpd.conf \
 		$(TARGET_DIR)/etc/dhcp/dhcpd.conf
 endef
 endif
 
 ifeq ($(BR2_PACKAGE_DHCP_RELAY),y)
+DHCP_INIT_SYSV += package/dhcp/S80dhcp-relay
 define DHCP_INSTALL_RELAY
 	mkdir -p $(TARGET_DIR)/var/lib
 	(cd $(TARGET_DIR)/var/lib; ln -snf /tmp dhcp)
 	$(INSTALL) -m 0755 -D $(DHCP_DIR)/relay/dhcrelay \
 		$(TARGET_DIR)/usr/sbin/dhcrelay
-	$(INSTALL) -m 0755 -D package/dhcp/S80dhcp-relay \
-		$(TARGET_DIR)/etc/init.d/S80dhcp-relay
 endef
 endif
 
diff --git a/package/dropbear/dropbear.mk b/package/dropbear/dropbear.mk
index bced0ef..348a5cb 100644
--- a/package/dropbear/dropbear.mk
+++ b/package/dropbear/dropbear.mk
@@ -11,6 +11,8 @@ DROPBEAR_TARGET_BINS = dbclient dropbearkey dropbearconvert scp ssh
 DROPBEAR_MAKE =	$(MAKE) MULTI=1 SCPPROGRESS=1 \
 		PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
 
+DROPBEAR_INIT_SYSV = package/dropbear/S50dropbear
+
 ifeq ($(BR2_PREFER_STATIC_LIB),y)
 DROPBEAR_MAKE += STATIC=1
 endif
@@ -59,15 +61,11 @@ define DROPBEAR_INSTALL_TARGET_CMDS
 	for f in $(DROPBEAR_TARGET_BINS); do \
 		ln -snf ../sbin/dropbear $(TARGET_DIR)/usr/bin/$$f ; \
 	done
-	if [ ! -f $(TARGET_DIR)/etc/init.d/S50dropbear ]; then \
-		$(INSTALL) -m 0755 -D package/dropbear/S50dropbear $(TARGET_DIR)/etc/init.d/S50dropbear; \
-	fi
 endef
 
 define DROPBEAR_UNINSTALL_TARGET_CMDS
 	rm -f $(TARGET_DIR)/usr/sbin/dropbear
 	rm -f $(addprefix $(TARGET_DIR)/usr/bin/, $(DROPBEAR_TARGET_BINS))
-	rm -f $(TARGET_DIR)/etc/init.d/S50dropbear
 endef
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/gdk-pixbuf/gdk-pixbuf.mk b/package/gdk-pixbuf/gdk-pixbuf.mk
index 65b3dbd..e885649 100644
--- a/package/gdk-pixbuf/gdk-pixbuf.mk
+++ b/package/gdk-pixbuf/gdk-pixbuf.mk
@@ -9,6 +9,7 @@ GDK_PIXBUF_VERSION = $(GDK_PIXBUF_MAJOR_VERSION).0
 GDK_PIXBUF_SOURCE = gdk-pixbuf-$(GDK_PIXBUF_VERSION).tar.bz2
 GDK_PIXBUF_SITE = http://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/$(GDK_PIXBUF_MAJOR_VERSION)
 GDK_PIXBUF_INSTALL_STAGING = YES
+GDK_PIXBUF_INIT_SYSV = package/gdk-pixbuf/S26gdk-pixbuf
 
 GDK_PIXBUF_CONF_ENV = \
 	ac_cv_path_GLIB_GENMARSHAL=$(LIBGLIB2_HOST_BINARY) \
@@ -43,11 +44,6 @@ GDK_PIXBUF_DEPENDENCIES += \
 	$(if $(BR2_ENABLE_LOCALE),,libiconv) \
 	host-pkg-config libglib2
 
-define GDK_PIXBUF_POST_INSTALL_TWEAKS
-	$(INSTALL) -m 755 -D package/gdk-pixbuf/S26gdk-pixbuf \
-		$(TARGET_DIR)/etc/init.d/S26gdk-pixbuf
-endef
-
 GDK_PIXBUF_POST_INSTALL_TARGET_HOOKS += GDK_PIXBUF_POST_INSTALL_TWEAKS
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/gpsd/gpsd.mk b/package/gpsd/gpsd.mk
index be6daeb..d9b5cc2 100644
--- a/package/gpsd/gpsd.mk
+++ b/package/gpsd/gpsd.mk
@@ -8,6 +8,7 @@ GPSD_VERSION = 2.95
 GPSD_SITE = http://download.berlios.de/gpsd
 GPSD_INSTALL_STAGING = YES
 GPSD_TARGET_BINS = cgps gpsctl gpsdecode gpsmon gpspipe gpxlogger lcdgps
+GPSD_INIT_SYSV = package/gpsd/S50gpsd
 
 # Build libgpsmm if we've got C++
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
@@ -169,7 +170,6 @@ endef
 define GPSD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
 	if [ ! -f $(TARGET_DIR)/etc/init.d/S50gpsd ]; then \
-		$(INSTALL) -m 0755 -D package/gpsd/S50gpsd $(TARGET_DIR)/etc/init.d/S50gpsd; \
 		$(SED) 's,^DEVICES=.*,DEVICES=$(BR2_PACKAGE_GPSD_DEVICES),' $(TARGET_DIR)/etc/init.d/S50gpsd; \
 	fi
 endef
diff --git a/package/input-event-daemon/input-event-daemon.mk b/package/input-event-daemon/input-event-daemon.mk
index a938ae7..523e764 100644
--- a/package/input-event-daemon/input-event-daemon.mk
+++ b/package/input-event-daemon/input-event-daemon.mk
@@ -6,6 +6,7 @@
 
 INPUT_EVENT_DAEMON_VERSION = v0.1.3
 INPUT_EVENT_DAEMON_SITE = git://github.com/gandro/input-event-daemon.git
+INPUT_EVENT_INIT_SYSV = package/input-event-daemon/S99input-event-daemon
 
 define INPUT_EVENT_DAEMON_BUILD_CMDS
 	touch  $(@D)/input-event-table.h
@@ -19,9 +20,6 @@ define INPUT_EVENT_DAEMON_INSTALL_TARGET_CMDS
 	[ -f $(TARGET_DIR)/etc/input-event-daemon.conf ] || \
 		$(INSTALL) -m 644 -D $(@D)/docs/sample.conf \
 			$(TARGET_DIR)/etc/input-event-daemon.conf
-	[ -f $(TARGET_DIR)/etc/init.d/S99input-event-daemon ] || \
-		$(INSTALL) -m 0755 -D package/input-event-daemon/S99input-event-daemon \
-			$(TARGET_DIR)/etc/init.d/S99input-event-daemon
 endef
 
 define INPUT_EVENT_DAEMON_CLEAN_CMDS
diff --git a/package/multimedia/mpd/mpd.mk b/package/multimedia/mpd/mpd.mk
index b29b9f7..0cc5a0b 100644
--- a/package/multimedia/mpd/mpd.mk
+++ b/package/multimedia/mpd/mpd.mk
@@ -8,6 +8,7 @@ MPD_VERSION = 0.16.5
 MPD_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/musicpd
 MPD_AUTORECONF = YES
 MPD_DEPENDENCIES = host-pkg-config libglib2
+MPD_INIT_SYSV = package/multimedia/mpd/S95mpd
 
 # Some options need an explicit --disable or --enable
 
@@ -125,8 +126,6 @@ define MPD_INSTALL_EXTRA_FILES
 		$(INSTALL) -D package/multimedia/mpd/mpd.conf \
 			$(TARGET_DIR)/etc/mpd.conf; \
 	fi
-	$(INSTALL) -m 0755 -D package/multimedia/mpd/S95mpd \
-		$(TARGET_DIR)/etc/init.d/S95mpd
 endef
 
 MPD_POST_INSTALL_TARGET_HOOKS += MPD_INSTALL_EXTRA_FILES
diff --git a/package/netplug/netplug.mk b/package/netplug/netplug.mk
index db76021..f0052d8 100644
--- a/package/netplug/netplug.mk
+++ b/package/netplug/netplug.mk
@@ -6,6 +6,7 @@
 NETPLUG_VERSION=1.2.9.2
 NETPLUG_SOURCE=netplug-$(NETPLUG_VERSION).tar.bz2
 NETPLUG_SITE=http://www.red-bean.com/~bos/netplug
+NETPLUG_INIT_SYSV = package/netplug/S29netplug
 
 define NETPLUG_BUILD_CMDS
 	$(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)
@@ -18,7 +19,6 @@ endef
 define NETPLUG_UNINSTALL_TARGET_CMDS
 	rm -f $(TARGET_DIR)/sbin/netplugd
 	rm -rf $(TARGET_DIR)/etc/netplug*
-	rm -f $(TARGET_DIR)/etc/init.d/S*netplug
 endef
 
 define NETPLUG_CLEAN_CMDS
diff --git a/package/netsnmp/netsnmp.mk b/package/netsnmp/netsnmp.mk
index 5d789b9..1716ba0 100644
--- a/package/netsnmp/netsnmp.mk
+++ b/package/netsnmp/netsnmp.mk
@@ -21,6 +21,9 @@ NETSNMP_CONF_OPT = --with-persistent-directory=/var/lib/snmp --disable-static \
 		--with-mib-modules="host ucd-snmp/dlmod" \
 		--with-out-mib-modules="disman/event disman/schedule utilities" \
 		--with-out-transports="Unix"
+
+NETSNMP_INIT_SYSV = package/netsnmp/S59snmpd
+
 NETSNMP_BLOAT_MIBS = BRIDGE DISMAN-EVENT DISMAN-SCHEDULE DISMAN-SCRIPT EtherLike RFC-1215 RFC1155-SMI RFC1213 SCTP SMUX
 
 ifeq ($(BR2_ENDIAN),"BIG")
@@ -58,8 +61,6 @@ endif
 define NETSNMP_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		DESTDIR=$(TARGET_DIR) install
-	$(INSTALL) -D -m 0755 package/netsnmp/S59snmpd \
-		$(TARGET_DIR)/etc/init.d/S59snmpd
 	for mib in $(NETSNMP_BLOAT_MIBS); do \
 		rm -f $(TARGET_DIR)/usr/share/snmp/mibs/$$mib-MIB.txt; \
 	done
@@ -69,7 +70,6 @@ endef
 define NETSNMP_UNINSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
 		DESTDIR=$(TARGET_DIR) uninstall
-	rm -f $(TARGET_DIR)/etc/init.d/S59snmpd
 	rm -f $(TARGET_DIR)/usr/lib/libnetsnmp*
 endef
 
diff --git a/package/nfs-utils/nfs-utils.mk b/package/nfs-utils/nfs-utils.mk
index bbe25fe..d3a26db 100644
--- a/package/nfs-utils/nfs-utils.mk
+++ b/package/nfs-utils/nfs-utils.mk
@@ -7,6 +7,8 @@ NFS_UTILS_VERSION = 1.2.3
 NFS_UTILS_SOURCE = nfs-utils-$(NFS_UTILS_VERSION).tar.bz2
 NFS_UTILS_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/nfs/
 
+NFS_UTILS_INIT_SYSV = package/nfs-utils/S60nfs
+
 NFS_UTILS_CONF_ENV = knfsd_cv_bsd_signals=no
 
 NFS_UTILS_CONF_OPT = \
@@ -22,8 +24,6 @@ NFS_UTILS_TARGETS_$(BR2_PACKAGE_NFS_UTILS_RPC_LOCKD) += usr/sbin/rpc.lockd
 NFS_UTILS_TARGETS_$(BR2_PACKAGE_NFS_UTILS_RPC_RQUOTAD) += usr/sbin/rpc.rquotad
 
 define NFS_UTILS_INSTALL_FIXUP
-	$(INSTALL) -m 0755 package/nfs-utils/S60nfs \
-		$(TARGET_DIR)/etc/init.d/S60nfs
 	rm -f $(NFS_UTILS_TARGETS_)
 endef
 
diff --git a/package/ntp/ntp.mk b/package/ntp/ntp.mk
index f17193f..b3144ca 100644
--- a/package/ntp/ntp.mk
+++ b/package/ntp/ntp.mk
@@ -8,6 +8,10 @@ NTP_VERSION = 4.2.6p4
 NTP_SITE = http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2
 NTP_CONF_ENV = ac_cv_lib_md5_MD5Init=no
 
+ifdef ($(BR2_PACKAGE_NTP_NTPD))
+	NTP_INIT_SYSV += package/ntp/S49ntp
+endif
+
 ifneq ($(BR2_INET_IPV6),y)
 	NTP_CONF_ENV += isc_cv_have_in6addr_any=no
 endif
@@ -49,7 +53,6 @@ NTP_INSTALL_FILES_$(BR2_PACKAGE_NTP_TICKADJ) += util/tickadj
 define NTP_INSTALL_TARGET_CMDS
 	$(if $(BR2_PACKAGE_NTP_NTPD), install -m 755 $(@D)/ntpd/ntpd $(TARGET_DIR)/usr/sbin/ntpd)
 	test -z "$(NTP_INSTALL_FILES_y)" || install -m 755 $(addprefix $(@D)/,$(NTP_INSTALL_FILES_y)) $(TARGET_DIR)/usr/bin/
-	$(if $(BR2_PACKAGE_NTP_NTPD), install -m 755 package/ntp/S49ntp $(TARGET_DIR)/etc/init.d/S49ntp)
 	@if [ ! -f $(TARGET_DIR)/etc/default/ntpd ]; then \
 		install -m 755 -d $(TARGET_DIR)/etc/default ; \
 		install -m 644 package/ntp/ntpd.etc.default $(TARGET_DIR)/etc/default/ntpd ; \
@@ -59,7 +62,6 @@ endef
 define NTP_UNINSTALL_TARGET_CMDS
 	rm $(TARGET_DIR)/usr/sbin/ntpd
 	rm -f $(addprefix $(TARGET_DIR)/usr/bin/,$(NTP_INSTALL_FILES_y))
-	rm $(TARGET_DIR)/etc/init.d/S49ntp
 	rm $(TARGET_DIR)/etc/default/ntpd
 endef
 
diff --git a/package/olsr/olsr.mk b/package/olsr/olsr.mk
index 9ed4d5b..5c3a87c 100644
--- a/package/olsr/olsr.mk
+++ b/package/olsr/olsr.mk
@@ -14,6 +14,7 @@ OLSR_TARGET_BINARY:=usr/sbin/olsrd
 #OLSR_PLUGINS=httpinfo tas dot_draw nameservice dyn_gw dyn_gw_plain pgraph bmf quagga secure
 OLSR_PLUGINS=dot_draw dyn_gw secure
 OLSR_TARGET_PLUGIN=usr/lib/
+OLSR_INIT_SYSV = package/olsr/S50olsr
 
 define OLSR_BUILD_CMDS
  $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd $(OLSR_PLUGINS)
@@ -22,8 +23,6 @@ endef
 define OLSR_INSTALL_TARGET_CMDS
  cp -dpf $(@D)/$(OLSR_BINARY) $(TARGET_DIR)/$(OLSR_TARGET_BINARY)
  cp -R $(@D)/lib/*/olsrd_*.so* $(TARGET_DIR)/$(OLSR_TARGET_PLUGIN)
- mkdir -p $(TARGET_DIR)/etc/init.d
- cp -dpf package/olsr/S50olsr $(TARGET_DIR)/etc/init.d/
  test -r $(TARGET_DIR)/etc/olsrd.conf || \
    cp -dpf $(@D)/files/olsrd.conf.default.lq $(TARGET_DIR)/etc/olsrd.conf
  -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/$(OLSR_TARGET_PLUGIN)/olsrd_*.so*
diff --git a/package/openssh/openssh.mk b/package/openssh/openssh.mk
index 08bb499..e49547e 100644
--- a/package/openssh/openssh.mk
+++ b/package/openssh/openssh.mk
@@ -11,11 +11,6 @@ OPENSSH_CONF_OPT = --libexecdir=/usr/lib --disable-lastlog --disable-utmp \
 		--disable-utmpx --disable-wtmp --disable-wtmpx --disable-strip
 
 OPENSSH_DEPENDENCIES = zlib openssl
-
-define OPENSSH_INSTALL_INITSCRIPT
-	$(INSTALL) -D -m 755 package/openssh/S50sshd $(TARGET_DIR)/etc/init.d/S50sshd
-endef
-
-OPENSSH_POST_INSTALL_TARGET_HOOKS += OPENSSH_INSTALL_INITSCRIPT
+OPENSSH_INIT_SYSV = package/openssh/S50sshd
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/pango/pango.mk b/package/pango/pango.mk
index 2691b88..228a9fd 100644
--- a/package/pango/pango.mk
+++ b/package/pango/pango.mk
@@ -13,6 +13,8 @@ PANGO_AUTORECONF = YES
 PANGO_INSTALL_STAGING = YES
 PANGO_INSTALL_TARGET = YES
 
+PANGO_INIT_SYSV = package/pango/S25pango
+
 PANGO_CONF_ENV = ac_cv_func_posix_getpwuid_r=yes glib_cv_stack_grows=no \
 		glib_cv_uscore=no ac_cv_func_strtod=yes \
 		ac_fsusage_space=yes fu_cv_sys_stat_statfs2_bsize=yes \
@@ -53,11 +55,4 @@ else
         PANGO_CONF_OPT += --without-x
 endif
 
-define PANGO_INSTALL_INITSCRIPT
-	$(INSTALL) -m 755 -D package/pango/S25pango \
-		$(TARGET_DIR)/etc/init.d/S25pango
-endef
-
-PANGO_POST_INSTALL_TARGET_HOOKS += PANGO_INSTALL_INITSCRIPT
-
 $(eval $(call AUTOTARGETS))
diff --git a/package/portmap/portmap.mk b/package/portmap/portmap.mk
index cb7c0e3..25fb65e 100644
--- a/package/portmap/portmap.mk
+++ b/package/portmap/portmap.mk
@@ -8,6 +8,7 @@ PORTMAP_VERSION = 6.0
 PORTMAP_SOURCE = portmap-$(PORTMAP_VERSION).tgz
 PORTMAP_SITE = http://neil.brown.name/portmap
 PORTMAP_SBINS = portmap pmap_dump pmap_set
+PORTMAP_INIT_SYSV = package/portmap/S13portmap
 
 PORTMAP_FLAGS = NO_TCP_WRAPPER=1 NO_PIE=1 NO_PERROR=1
 ifeq ($(BR2_USE_MMU),)
@@ -33,8 +34,6 @@ define PORTMAP_INSTALL_TARGET_CMDS
 		$(TARGET_DIR)/usr/share/man/man8/pmap_dump.8
 	$(INSTALL) -D $(@D)/pmap_set.8 \
 		$(TARGET_DIR)/usr/share/man/man8/pmap_set.8
-	$(INSTALL) -m 0755 package/portmap/S13portmap \
-		$(TARGET_DIR)/etc/init.d
 endef
 
 define PORTMAP_UNINSTALL_TARGET_CMDS
diff --git a/package/proftpd/proftpd.mk b/package/proftpd/proftpd.mk
index 2523dd2..bc91f25 100644
--- a/package/proftpd/proftpd.mk
+++ b/package/proftpd/proftpd.mk
@@ -7,6 +7,8 @@ PROFTPD_VERSION = 1.3.3e
 PROFTPD_SOURCE = proftpd-$(PROFTPD_VERSION).tar.bz2
 PROFTPD_SITE = ftp://ftp.proftpd.org/distrib/source/
 
+PROFTPD_INIT_SYSV = package/proftpd/S50proftpd
+
 PROFTPD_CONF_ENV = ac_cv_func_setpgrp_void=yes \
 		ac_cv_func_setgrent_void=yes
 
@@ -33,12 +35,10 @@ define PROFTPD_INSTALL_TARGET_CMDS
 		$(INSTALL) -m 0644 -D $(@D)/sample-configurations/basic.conf $(TARGET_DIR)/etc/proftpd.conf; \
 		$(if $(BR2_INET_IPV6),,$(SED) 's/^UseIPv6/# UseIPv6/' $(TARGET_DIR)/etc/proftpd.conf;) \
 	fi
-	$(INSTALL) -m 0755 package/proftpd/S50proftpd $(TARGET_DIR)/etc/init.d
 endef
 
 define PROFTPD_UNINSTALL_TARGET_CMDS
 	rm -f $(TARGET_DIR)/$(PROFTPD_TARGET_BINARY)
-	rm -f $(TARGET_DIR)/etc/init.d/S50proftpd
 	rm -f $(TARGET_DIR)/etc/proftpd.conf
 endef
 
diff --git a/package/radvd/radvd.mk b/package/radvd/radvd.mk
index d4b9a73..6155236 100644
--- a/package/radvd/radvd.mk
+++ b/package/radvd/radvd.mk
@@ -7,11 +7,6 @@
 RADVD_VERSION = 1.8.3
 RADVD_SITE = http://www.litech.org/radvd/dist/
 RADVD_DEPENDENCIES = flex host-flex
-
-define RADVD_INSTALL_INITSCRIPT
-	$(INSTALL) -m 0755 package/radvd/S50radvd $(TARGET_DIR)/etc/init.d
-endef
-
-RADVD_POST_INSTALL_TARGET_HOOKS += RADVD_INSTALL_INITSCRIPT
+RADVD_INIT_SYSV = package/radvd/S50radvd
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/rsyslog/rsyslog.mk b/package/rsyslog/rsyslog.mk
index 6582812..e9dc8ac 100644
--- a/package/rsyslog/rsyslog.mk
+++ b/package/rsyslog/rsyslog.mk
@@ -6,6 +6,7 @@
 RSYSLOG_VERSION = 5.8.0
 RSYSLOG_SITE = http://rsyslog.com/files/download/rsyslog/
 RSYSLOG_DEPENDENCIES = zlib
+RSYSLOG_INIT_SYSV = package/rsyslog/S01rsyslog
 
 # Build after Busybox
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
@@ -13,8 +14,6 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 endif
 
 define RSYSLOG_INSTALL_CONF_SCRIPT
-	$(INSTALL) -m 0755 -D package/rsyslog/S01rsyslog \
-		$(TARGET_DIR)/etc/init.d/S01rsyslog
 	[ -f $(TARGET_DIR)/etc/rsyslog.conf ] || \
 		$(INSTALL) -m 0644 -D $(@D)/rsyslog.conf \
 			$(TARGET_DIR)/etc/rsyslog.conf
diff --git a/package/samba/samba.mk b/package/samba/samba.mk
index de2c13b..0c563d7 100644
--- a/package/samba/samba.mk
+++ b/package/samba/samba.mk
@@ -13,6 +13,7 @@ SAMBA_AUTORECONF = NO
 SAMBA_INSTALL_STAGING = YES
 SAMBA_INSTALL_TARGET = YES
 
+SAMBA_INIT_SYSV = package/samba/S91smb
 
 SAMBA_DEPENDENCIES = \
 	$(if $(BR2_ENABLE_LOCALE),,libiconv) \
@@ -173,17 +174,13 @@ SAMBA_POST_INSTALL_TARGET_HOOKS += SAMBA_REMOVE_SWAT_DOCUMENTATION
 endif
 endif
 
-define SAMBA_INSTALL_INITSCRIPTS_CONFIG
-	# install start/stop script
-	@if [ ! -f $(TARGET_DIR)/etc/init.d/S91smb ]; then \
-		$(INSTALL) -m 0755 -D package/samba/S91smb $(TARGET_DIR)/etc/init.d/S91smb; \
-	fi
+define SAMBA_INSTALL_CONFIG
 	# install config
 	@if [ ! -f $(TARGET_DIR)/etc/samba/smb.conf ]; then \
 		$(INSTALL) -m 0755 -D package/samba/simple.conf $(TARGET_DIR)/etc/samba/smb.conf; \
 	fi
 endef
 
-SAMBA_POST_INSTALL_TARGET_HOOKS += SAMBA_INSTALL_INITSCRIPTS_CONFIG
+SAMBA_POST_INSTALL_TARGET_HOOKS += SAMBA_INSTALL_CONFIG
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/stunnel/stunnel.mk b/package/stunnel/stunnel.mk
index 6088e58..c718525 100644
--- a/package/stunnel/stunnel.mk
+++ b/package/stunnel/stunnel.mk
@@ -10,9 +10,9 @@ STUNNEL_DEPENDENCIES = openssl
 STUNNEL_CONF_OPT += \
 	--with-ssl=$(STAGING_DIR)/usr \
 	--with-threads=fork
+STUNNEL_INIT_SYSV = package/stunnel/S50stunnel
 
 define STUNNEL_INSTALL_CONF_SCRIPT
-	$(INSTALL) -m 0755 -D package/stunnel/S50stunnel $(TARGET_DIR)/etc/init.d/S50stunnel
 	[ -f $(TARGET_DIR)/etc/stunnel/stunnel.conf ] || \
 		$(INSTALL) -m 0644 -D $(@D)/tools/stunnel.conf \
 			$(TARGET_DIR)/etc/stunnel/stunnel.conf
diff --git a/package/tftpd/tftpd.mk b/package/tftpd/tftpd.mk
index 728319b..45eb8b3 100644
--- a/package/tftpd/tftpd.mk
+++ b/package/tftpd/tftpd.mk
@@ -7,6 +7,7 @@ TFTPD_VERSION  = 5.0
 TFTPD_SOURCE   = tftp-hpa-$(TFTPD_VERSION).tar.bz2
 TFTPD_SITE     = $(BR2_KERNEL_MIRROR)/software/network/tftp/
 TFTPD_CONF_OPT = --without-tcpwrappers
+TFTP_INIT_SYSV = package/tftpd/S80tftpd-hpa
 
 ifneq ($(BR2_INET_IPV6),y)
 TFTPD_CONF_OPT += --without-ipv6
@@ -14,7 +15,6 @@ endif
 
 define TFTPD_INSTALL_TARGET_CMDS
 	$(INSTALL) -D $(@D)/tftpd/tftpd $(TARGET_DIR)/usr/sbin/tftpd
-	$(INSTALL) -D package/tftpd/S80tftpd-hpa $(TARGET_DIR)/etc/init.d/
 endef
 
 $(eval $(call AUTOTARGETS))
diff --git a/package/tinyhttpd/tinyhttpd.mk b/package/tinyhttpd/tinyhttpd.mk
index 739849f..c86c056 100644
--- a/package/tinyhttpd/tinyhttpd.mk
+++ b/package/tinyhttpd/tinyhttpd.mk
@@ -10,6 +10,7 @@ TINYHTTPD_DIR:=$(BUILD_DIR)/tinyhttpd-$(TINYHTTPD_VER)
 TINYHTTPD_CAT:=$(ZCAT)
 TINYHTTPD_BINARY:=httpd
 TINYHTTPD_TARGET_BINARY:=usr/sbin/tinyhttpd
+TINYHTTPD_INIT_SYSV = package/tinyhttpd/S85tinyhttpd
 
 $(DL_DIR)/$(TINYHTTPD_SOURCE):
 	 $(call DOWNLOAD,$(TINYHTTPD_SITE),$(TINYHTTPD_SOURCE))
@@ -32,7 +33,6 @@ $(TINYHTTPD_DIR)/$(TINYHTTPD_BINARY): $(TINYHTTPD_DIR)/.unpacked
 $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY): $(TINYHTTPD_DIR)/$(TINYHTTPD_BINARY)
 	$(INSTALL) -m 0755 $(TINYHTTPD_DIR)/$(TINYHTTPD_BINARY) $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)
 	$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)
-	$(INSTALL) -m 0755 package/tinyhttpd/S85tinyhttpd $(TARGET_DIR)/etc/init.d
 	mkdir -p $(TARGET_DIR)/var/www
 
 tinyhttpd: $(TARGET_DIR)/$(TINYHTTPD_TARGET_BINARY)
diff --git a/package/udev/udev.mk b/package/udev/udev.mk
index 1825396..2dac4e8 100644
--- a/package/udev/udev.mk
+++ b/package/udev/udev.mk
@@ -16,6 +16,8 @@ UDEV_CONF_OPT =			\
 
 UDEV_DEPENDENCIES = host-gperf host-pkg-config
 
+UDEV_INIT_SYSV = package/udev/S10udev
+
 ifeq ($(BR2_PACKAGE_UDEV_ALL_EXTRAS),y)
 UDEV_DEPENDENCIES += libusb libusb-compat acl usbutils hwdata libglib2
 UDEV_CONF_OPT +=							\
@@ -28,10 +30,4 @@ UDEV_CONF_OPT +=		\
 	--disable-gudev
 endif
 
-define UDEV_INSTALL_INITSCRIPT
-	$(INSTALL) -m 0755 package/udev/S10udev $(TARGET_DIR)/etc/init.d/S10udev
-endef
-
-UDEV_POST_INSTALL_TARGET_HOOKS += UDEV_INSTALL_INITSCRIPT
-
 $(eval $(call AUTOTARGETS))
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 1/3] Add the systemd package
  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
  1 sibling, 1 reply; 24+ messages in thread
From: Baruch Siach @ 2011-11-23 11:57 UTC (permalink / raw)
  To: buildroot

Hi Maxime,

On Wed, Nov 23, 2011 at 12:30:09PM +0100, Maxime Ripard wrote:
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
>  fs/skeleton/etc/mtab       |    2 +-
>  linux/linux.mk             |    2 +
>  package/Config.in          |    1 +
>  package/dbus/dbus.mk       |    4 +++
>  package/systemd/Config.in  |   16 +++++++++++++++
>  package/systemd/systemd.mk |   45 ++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 69 insertions(+), 1 deletions(-)
>  create mode 100644 package/systemd/Config.in
>  create mode 100644 package/systemd/systemd.mk
> 
> diff --git a/fs/skeleton/etc/mtab b/fs/skeleton/etc/mtab
> index e1c2045..4c0a094 120000
> --- a/fs/skeleton/etc/mtab
> +++ b/fs/skeleton/etc/mtab
> @@ -1 +1 @@
> -../proc/mounts
> \ No newline at end of file
> +/proc/mounts
> \ No newline at end of file

Why is this change needed?

[snip]

> +define SYSTEMD_INSTALL_INIT_HOOK
> +	ln -fs /bin/systemd $(TARGET_DIR)/sbin/init
> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/halt
> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/poweroff
> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/reboot
> +endef

You should probably add busybox to your dependencies to make sure you override 
the busybox provided applets.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 1/3] Add the systemd package
  2011-11-23 11:57   ` Baruch Siach
@ 2011-11-23 13:53     ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 13:53 UTC (permalink / raw)
  To: buildroot

Hi,

On 23/11/2011 12:57, Baruch Siach wrote:
> On Wed, Nov 23, 2011 at 12:30:09PM +0100, Maxime Ripard wrote:
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>> ---
>>  fs/skeleton/etc/mtab       |    2 +-
>>  linux/linux.mk             |    2 +
>>  package/Config.in          |    1 +
>>  package/dbus/dbus.mk       |    4 +++
>>  package/systemd/Config.in  |   16 +++++++++++++++
>>  package/systemd/systemd.mk |   45 ++++++++++++++++++++++++++++++++++++++++++++
>>  6 files changed, 69 insertions(+), 1 deletions(-)
>>  create mode 100644 package/systemd/Config.in
>>  create mode 100644 package/systemd/systemd.mk
>>
>> diff --git a/fs/skeleton/etc/mtab b/fs/skeleton/etc/mtab
>> index e1c2045..4c0a094 120000
>> --- a/fs/skeleton/etc/mtab
>> +++ b/fs/skeleton/etc/mtab
>> @@ -1 +1 @@
>> -../proc/mounts
>> \ No newline at end of file
>> +/proc/mounts
>> \ No newline at end of file
> 
> Why is this change needed?

Because systemd tests if /etc/mtab is a link to /proc/mounts or
/proc/self/mounts, and thus fails with this link.

http://cgit.freedesktop.org/systemd/tree/src/main.c#n1082

>> +define SYSTEMD_INSTALL_INIT_HOOK
>> +	ln -fs /bin/systemd $(TARGET_DIR)/sbin/init
>> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/halt
>> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/poweroff
>> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/reboot
>> +endef
> 
> You should probably add busybox to your dependencies to make sure you override 
> the busybox provided applets.

Right


-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-11-23 11:30 [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
                   ` (2 preceding siblings ...)
  2011-11-23 11:30 ` [Buildroot] [PATCH 3/3] Migrate the packages to the new infra Maxime Ripard
@ 2011-11-23 14:05 ` Maxime Ripard
  2011-11-23 21:14 ` Belisko Marek
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 14:05 UTC (permalink / raw)
  To: buildroot

Also, what needs to be done:
  - Convert some packages to have systemd units
  - Change the folder I install the scripts in to /etc/systemd/system
for $(PKG)_INIT_SYSTEMD

On 23/11/2011 12:30, Maxime Ripard wrote:
> Hi list,
> 
> I've been working for some time on adding systemd to buildroot in a nice way. It
> is now in a pretty nice state I guess, at least nice enough to send an RFC and
> get some review about the basic mechanics.
> 
> While the system should boot with systemd, for a reason unknown to me, udev
> doesn't take into account its rules, and don't tag the devices for systemd,
> which, in turn, doesn't expose a getty.
> 
> Another problem is that I still have some sysv init scripts added to the
> filesystem through the skeleton. Since it is completely static, I don't find a
> good way around this problem. Maybe we don't care. I don't know.
> 
> So, give it a look, and please tell me what you think :)
> 
> Maxime
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot


-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-11-23 11:30 [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
                   ` (3 preceding siblings ...)
  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-14 10:43 ` Maxime Ripard
  2011-12-20  6:49 ` Arnout Vandecappelle
  6 siblings, 1 reply; 24+ messages in thread
From: Belisko Marek @ 2011-11-23 21:14 UTC (permalink / raw)
  To: buildroot

Hi Maxime,

On Wed, Nov 23, 2011 at 12:30 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi list,
>
> I've been working for some time on adding systemd to buildroot in a nice way. It
> is now in a pretty nice state I guess, at least nice enough to send an RFC and
> get some review about the basic mechanics.
>
> While the system should boot with systemd, for a reason unknown to me, udev
> doesn't take into account its rules, and don't tag the devices for systemd,
> which, in turn, doesn't expose a getty.
>
> Another problem is that I still have some sysv init scripts added to the
> filesystem through the skeleton. Since it is completely static, I don't find a
> good way around this problem. Maybe we don't care. I don't know.
>
> So, give it a look, and please tell me what you think :)
thanks for good work. I don't see any patches where adding systemd
specific services.
Are they in your queue or this was only basic patches?

>
> Maxime
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>

Thanks,

Marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-11-23 21:14 ` Belisko Marek
@ 2011-11-23 21:35   ` Maxime Ripard
  2011-12-20 21:14     ` Arnout Vandecappelle
  0 siblings, 1 reply; 24+ messages in thread
From: Maxime Ripard @ 2011-11-23 21:35 UTC (permalink / raw)
  To: buildroot

Hi Marek,

Le 23/11/2011 22:14, Belisko Marek a ?crit :
> On Wed, Nov 23, 2011 at 12:30 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com>  wrote:
>> I've been working for some time on adding systemd to buildroot in a nice way. It
>> is now in a pretty nice state I guess, at least nice enough to send an RFC and
>> get some review about the basic mechanics.
>>
>> While the system should boot with systemd, for a reason unknown to me, udev
>> doesn't take into account its rules, and don't tag the devices for systemd,
>> which, in turn, doesn't expose a getty.
>>
>> Another problem is that I still have some sysv init scripts added to the
>> filesystem through the skeleton. Since it is completely static, I don't find a
>> good way around this problem. Maybe we don't care. I don't know.
>>
>> So, give it a look, and please tell me what you think :)
> thanks for good work. I don't see any patches where adding systemd
> specific services.
> Are they in your queue or this was only basic patches?

It's still a work to be done.
Once we will have a nice way to add systemd to buildroot, which is not 
sure yet, I guess we will add the systemd units one unit at a time.

This patchset was more to send a proof of concept and all agree on the 
path to follow, so adding the units seem a little too early.

Maxime

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-11-23 11:30 [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
                   ` (4 preceding siblings ...)
  2011-11-23 21:14 ` Belisko Marek
@ 2011-12-14 10:43 ` Maxime Ripard
  2011-12-20  6:49 ` Arnout Vandecappelle
  6 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2011-12-14 10:43 UTC (permalink / raw)
  To: buildroot

Hi,

Do you all agree on that ?

Also, this patchset should include the rework of the shutdown policy
like we discussed last week.

Maxime

On 23/11/2011 12:30, Maxime Ripard wrote:
> Hi list,
> 
> I've been working for some time on adding systemd to buildroot in a nice way. It
> is now in a pretty nice state I guess, at least nice enough to send an RFC and
> get some review about the basic mechanics.
> 
> While the system should boot with systemd, for a reason unknown to me, udev
> doesn't take into account its rules, and don't tag the devices for systemd,
> which, in turn, doesn't expose a getty.
> 
> Another problem is that I still have some sysv init scripts added to the
> filesystem through the skeleton. Since it is completely static, I don't find a
> good way around this problem. Maybe we don't care. I don't know.
> 
> So, give it a look, and please tell me what you think :)
> 
> Maxime
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot


-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-11-23 11:30 [Buildroot] [RFC] Add systemd to buildroot Maxime Ripard
                   ` (5 preceding siblings ...)
  2011-12-14 10:43 ` Maxime Ripard
@ 2011-12-20  6:49 ` Arnout Vandecappelle
  2012-01-02  9:58   ` Maxime Ripard
  6 siblings, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2011-12-20  6:49 UTC (permalink / raw)
  To: buildroot

On Wednesday 23 November 2011 12:30:08 Maxime Ripard wrote:
> Hi list,
> 
> I've been working for some time on adding systemd to buildroot in a nice way. It
> is now in a pretty nice state I guess, at least nice enough to send an RFC and
> get some review about the basic mechanics.

 You didn't get much comments, so I'll try to do some review.  No testing though.

> While the system should boot with systemd, for a reason unknown to me, udev
> doesn't take into account its rules, and don't tag the devices for systemd,
> which, in turn, doesn't expose a getty.

 This is of course a show-stopper for inclusion.  People expect the git
HEAD to work.

> Another problem is that I still have some sysv init scripts added to the
> filesystem through the skeleton. Since it is completely static, I don't find a
> good way around this problem. Maybe we don't care. I don't know.

 I guess you mean the S20urandom and S40network in the skeleton?  For the
moment, I don't think it's a problem to leave them there.  To fix it, you
could include a target-install hook that removes them (which obviously still
leaves the init scripts installed by other packages, but that should be
fixed separately per package).


 Regards,
 Arnout


-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 1/3] Add the systemd package
  2011-11-23 11:30 ` [Buildroot] [PATCH 1/3] Add the systemd package Maxime Ripard
  2011-11-23 11:57   ` Baruch Siach
@ 2011-12-20  7:05   ` Arnout Vandecappelle
  2012-01-02  9:35     ` Maxime Ripard
  1 sibling, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2011-12-20  7:05 UTC (permalink / raw)
  To: buildroot

On Wednesday 23 November 2011 12:30:09 Maxime Ripard wrote:
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

[snip]
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 5c5a1d2..22f50b4 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -149,6 +149,8 @@ define LINUX_CONFIGURE_CMDS
> 
>         $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),
>         
>                 $(call
>                 KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$
>                 (@D)/.config))
>         
>         yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D)
>         oldconfig
> 
> +       $(if $(BR2_INIT_SYSTEMD),
> +               $(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config),)
 I don't see the symbol BR2_INIT_SYSTEMD defined anywhere... (it's only
defined in the next patch).  Shouldn't it anyway be BR2_PACKAGE_SYSTEMD?

> 
>  endef
>  
>  # Compilation. We make sure the kernel gets rebuilt when the
[snip]
> diff --git a/package/systemd/Config.in b/package/systemd/Config.in
> new file mode 100644
> index 0000000..09cedb9
> --- /dev/null
> +++ b/package/systemd/Config.in
> @@ -0,0 +1,16 @@
> +config BR2_PACKAGE_SYSTEMD
> +	bool "systemd"
> +	depends on BR2_PACKAGE_UDEV
> +	depends on BR2_PACKAGE_DBUS
 With depends on, there should also be a comment to explain why systemd is not
available:
comment "systemd not available (depends on udev and dbus)"
	depends on !BR2_PACKAGE_UDEV || !BR2_PACKAGE_DBUS

> +	select BR2_PACKAGE_LIBCAP
> +	help
> +	  systemd is a system and service manager for Linux, compatible with
> +	  SysV and LSB init scripts. systemd provides aggressive parallelization
> +	  capabilities, uses socket and D-Bus activation for starting services,
> +	  offers on-demand starting of daemons, keeps track of processes using
> +	  Linux cgroups, supports snapshotting and restoring of the system
> +	  state, maintains mount and automount points and implements an
> +	  elaborate transactional dependency-based service control logic. It can
> +	  work as a drop-in replacement for sysvinit. 
> +
> +	  http://freedesktop.org/wiki/Software/systemd
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> new file mode 100644
> index 0000000..8733ce0
> --- /dev/null
> +++ b/package/systemd/systemd.mk
> @@ -0,0 +1,45 @@
> +#############################################################
> +#
> +# systemd
> +#
> +#############################################################
> +SYSTEMD_VERSION = 37
> +SYSTEMD_SITE = http://www.freedesktop.org/software/systemd/
> +SYSTEMD_SOURCE = systemd-$(SYSTEMD_VERSION).tar.bz2
> +SYSTEMD_DEPENDENCIES = \
> +	host-intltool \
> +	libcap \
> +	udev \
> +	dbus
> +
> +SYSTEMD_CONF_OPT = \
> +	--with-distro=other \
> +	--disable-selinux \
> +	--disable-acl \
 acl should be selected based on BR2_PACKAGE_ACL

> +	--disable-pam \
> +	--disable-libcryptsetup \
> +	--disable-gtk \
> +	--disable-plymouth \
> +	--with-rootdir=/ \
> +	--with-dbuspolicydir=/etc/dbus-1/system.d \
> +	--with-dbussessionservicedir=/usr/share/dbus-1/services \
> +	--with-dbussystemservicedir=/usr/share/dbus-1/system-services \
> +	--with-dbusinterfacedir=/usr/share/dbus-1/interfaces \
> +	--with-udevrulesdir=/etc/udev/rules.d \
> +
> +define SYSTEMD_INSTALL_INIT_HOOK
> +	ln -fs /bin/systemd $(TARGET_DIR)/sbin/init
> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/halt
> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/poweroff
> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/reboot
 I don't think it's a standard in buildroot, but personally I prefer relative
links here.  That way you can do things like gdb or objdump on the link, without
accidentally referring to the host systemd.

> +endef
> +
> +define SYSTEMD_INSTALL_TTY_HOOK
> +	ln -fs /lib/systemd/system/getty at .service $(TARGET_DIR)/etc/systemd/system/getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service
> +endef
> +
> +SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
> +	SYSTEMD_INSTALL_INIT_HOOK \
> +	SYSTEMD_INSTALL_TTY_HOOK \
> +
> +$(eval $(call AUTOTARGETS))


 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2011-12-20  8:03 UTC (permalink / raw)
  To: buildroot

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)))))

>  	$($(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.)

>  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

>  	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.
> +	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


 Regards,
 Arnout


>  config BR2_ROOTFS_DEVICE_TABLE
>  	string "Path to the permission tables"
>  	default "target/generic/device_table.txt"
> 

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-11-23 21:35   ` Maxime Ripard
@ 2011-12-20 21:14     ` Arnout Vandecappelle
  0 siblings, 0 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2011-12-20 21:14 UTC (permalink / raw)
  To: buildroot

On Wednesday 23 November 2011 22:35:54 Maxime Ripard wrote:
> > thanks for good work. I don't see any patches where adding systemd
> > specific services.
> > Are they in your queue or this was only basic patches?
> 
> It's still a work to be done.
> Once we will have a nice way to add systemd to buildroot, which is not 
> sure yet, I guess we will add the systemd units one unit at a time.

 It would help to accept the systemd changes if you would add a systemd 
definition for at least one package.  That helps us to review the impact
of the changes.

 Regards,
 Arnout


-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 3/3] Migrate the packages to the new infra
  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
  0 siblings, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2011-12-20 21:29 UTC (permalink / raw)
  To: buildroot

On Wednesday 23 November 2011 12:30:11 Maxime Ripard wrote:
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
 I only did a partial review, so no Reviewed-by tag.
[snip]
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index 73c4969..0ff27ca 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -30,11 +30,7 @@ endif
>  
>  # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
>  ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
> -define BUSYBOX_INSTALL_MDEV_SCRIPT
> -	[ -f $(TARGET_DIR)/etc/init.d/S10mdev ] || \
> -		install -D -m 0755 package/busybox/S10mdev \
> -			$(TARGET_DIR)/etc/init.d/S10mdev
> -endef
> +BUSYBOX_INIT_SYSV += package/busybox/S10mdev
 This is not actually equivalent: the original makes sure not to overwrite 
an existing S10mdev (coming from the skeleton).  Perhaps patch 2/3 should
include this test as well.

>  define BUSYBOX_INSTALL_MDEV_CONF
>  	[ -f $(TARGET_DIR)/etc/mdev.conf ] || \
>  		install -D -m 0644 package/busybox/mdev.conf \
> @@ -139,6 +135,7 @@ define BUSYBOX_SET_INIT
>  endef
>  endif
>  
> +ifeq ($(BR2_INIT_BUSYBOX)$(BR2_INIT_SYSV),y)
>  define BUSYBOX_INSTALL_LOGGING_SCRIPT
>  	if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
>  		[ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
> @@ -146,12 +143,15 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
>  				$(TARGET_DIR)/etc/init.d/S01logging; \
>  	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
>  endef
> +else
> +define BUSYBOX_INSTALL_LOGGING_SCRIPT
> +endef
> +endif
 This else part is not necessary: an undefined variable evaluates to nothing.

>  
>  # We do this here to avoid busting a modified .config in configure
>  BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
>  
>  define BUSYBOX_CONFIGURE_CMDS
> -	$(BUSYBOX_SET_SYSKLOGD)
>  	$(BUSYBOX_SET_BB_PWD)
>  	$(BUSYBOX_SET_LARGEFILE)
>  	$(BUSYBOX_SET_IPV6)
> @@ -177,7 +177,6 @@ define BUSYBOX_INSTALL_TARGET_CMDS
>  		$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
>  			$(TARGET_DIR)/usr/share/udhcpc/default.script; \
>  	fi
> -	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
>  	$(BUSYBOX_INSTALL_MDEV_CONF)
>  	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
>  endef
[snip]

 By the way, doesn't systemd support sysv-style init scripts as well?

 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 1/3] Add the systemd package
  2011-12-20  7:05   ` Arnout Vandecappelle
@ 2012-01-02  9:35     ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2012-01-02  9:35 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

Thanks for the review,

On 20/12/2011 08:05, Arnout Vandecappelle wrote:
> On Wednesday 23 November 2011 12:30:09 Maxime Ripard wrote:
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> 
> [snip]
>> diff --git a/linux/linux.mk b/linux/linux.mk
>> index 5c5a1d2..22f50b4 100644
>> --- a/linux/linux.mk
>> +++ b/linux/linux.mk
>> @@ -149,6 +149,8 @@ define LINUX_CONFIGURE_CMDS
>>
>>         $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),
>>         
>>                 $(call
>>                 KCONFIG_SET_OPT,CONFIG_UEVENT_HELPER_PATH,\"/sbin/mdev\",$
>>                 (@D)/.config))
>>         
>>         yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D)
>>         oldconfig
>>
>> +       $(if $(BR2_INIT_SYSTEMD),
>> +               $(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config),)
>  I don't see the symbol BR2_INIT_SYSTEMD defined anywhere... (it's only
> defined in the next patch).  Shouldn't it anyway be BR2_PACKAGE_SYSTEMD?

Oh, right.
I must have reordered the patches without paying attention to that.

>>
>>  endef
>>  
>>  # Compilation. We make sure the kernel gets rebuilt when the
> [snip]
>> diff --git a/package/systemd/Config.in b/package/systemd/Config.in
>> new file mode 100644
>> index 0000000..09cedb9
>> --- /dev/null
>> +++ b/package/systemd/Config.in
>> @@ -0,0 +1,16 @@
>> +config BR2_PACKAGE_SYSTEMD
>> +	bool "systemd"
>> +	depends on BR2_PACKAGE_UDEV
>> +	depends on BR2_PACKAGE_DBUS
>  With depends on, there should also be a comment to explain why systemd is not
> available:
> comment "systemd not available (depends on udev and dbus)"
> 	depends on !BR2_PACKAGE_UDEV || !BR2_PACKAGE_DBUS

Indeed.

>> +	select BR2_PACKAGE_LIBCAP
>> +	help
>> +	  systemd is a system and service manager for Linux, compatible with
>> +	  SysV and LSB init scripts. systemd provides aggressive parallelization
>> +	  capabilities, uses socket and D-Bus activation for starting services,
>> +	  offers on-demand starting of daemons, keeps track of processes using
>> +	  Linux cgroups, supports snapshotting and restoring of the system
>> +	  state, maintains mount and automount points and implements an
>> +	  elaborate transactional dependency-based service control logic. It can
>> +	  work as a drop-in replacement for sysvinit. 
>> +
>> +	  http://freedesktop.org/wiki/Software/systemd
>> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
>> new file mode 100644
>> index 0000000..8733ce0
>> --- /dev/null
>> +++ b/package/systemd/systemd.mk
>> @@ -0,0 +1,45 @@
>> +#############################################################
>> +#
>> +# systemd
>> +#
>> +#############################################################
>> +SYSTEMD_VERSION = 37
>> +SYSTEMD_SITE = http://www.freedesktop.org/software/systemd/
>> +SYSTEMD_SOURCE = systemd-$(SYSTEMD_VERSION).tar.bz2
>> +SYSTEMD_DEPENDENCIES = \
>> +	host-intltool \
>> +	libcap \
>> +	udev \
>> +	dbus
>> +
>> +SYSTEMD_CONF_OPT = \
>> +	--with-distro=other \
>> +	--disable-selinux \
>> +	--disable-acl \
>  acl should be selected based on BR2_PACKAGE_ACL

Ok, I will add that.

>> +	--disable-pam \
>> +	--disable-libcryptsetup \
>> +	--disable-gtk \
>> +	--disable-plymouth \
>> +	--with-rootdir=/ \
>> +	--with-dbuspolicydir=/etc/dbus-1/system.d \
>> +	--with-dbussessionservicedir=/usr/share/dbus-1/services \
>> +	--with-dbussystemservicedir=/usr/share/dbus-1/system-services \
>> +	--with-dbusinterfacedir=/usr/share/dbus-1/interfaces \
>> +	--with-udevrulesdir=/etc/udev/rules.d \
>> +
>> +define SYSTEMD_INSTALL_INIT_HOOK
>> +	ln -fs /bin/systemd $(TARGET_DIR)/sbin/init
>> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/halt
>> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/poweroff
>> +	ln -fs /bin/systemctl $(TARGET_DIR)/sbin/reboot
>  I don't think it's a standard in buildroot, but personally I prefer relative
> links here.  That way you can do things like gdb or objdump on the link, without
> accidentally referring to the host systemd.

Ok

>> +endef
>> +
>> +define SYSTEMD_INSTALL_TTY_HOOK
>> +	ln -fs /lib/systemd/system/getty at .service $(TARGET_DIR)/etc/systemd/system/getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service
>> +endef
>> +
>> +SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
>> +	SYSTEMD_INSTALL_INIT_HOOK \
>> +	SYSTEMD_INSTALL_TTY_HOOK \
>> +
>> +$(eval $(call AUTOTARGETS))
> 
> 
>  Regards,
>  Arnout
> 


-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  2011-12-20  8:03   ` Arnout Vandecappelle
@ 2012-01-02  9:52     ` Maxime Ripard
  2012-01-02 14:52       ` Thomas Petazzoni
  2012-01-06  7:13       ` Arnout Vandecappelle
  0 siblings, 2 replies; 24+ messages in thread
From: Maxime Ripard @ 2012-01-02  9:52 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [RFC] Add systemd to buildroot
  2011-12-20  6:49 ` Arnout Vandecappelle
@ 2012-01-02  9:58   ` Maxime Ripard
  0 siblings, 0 replies; 24+ messages in thread
From: Maxime Ripard @ 2012-01-02  9:58 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

On 20/12/2011 07:49, Arnout Vandecappelle wrote:
> On Wednesday 23 November 2011 12:30:08 Maxime Ripard wrote:
>> I've been working for some time on adding systemd to buildroot in a nice way. It
>> is now in a pretty nice state I guess, at least nice enough to send an RFC and
>> get some review about the basic mechanics.
> 
>  You didn't get much comments, so I'll try to do some review.  No testing though.

Thanks :)

>> While the system should boot with systemd, for a reason unknown to me, udev
>> doesn't take into account its rules, and don't tag the devices for systemd,
>> which, in turn, doesn't expose a getty.
> 
>  This is of course a show-stopper for inclusion.  People expect the git
> HEAD to work.

Of course, and I expect it too, this is one of the reason I flagged the
patchset as an RFC and not an actual patch :)

>> Another problem is that I still have some sysv init scripts added to the
>> filesystem through the skeleton. Since it is completely static, I don't find a
>> good way around this problem. Maybe we don't care. I don't know.
> 
>  I guess you mean the S20urandom and S40network in the skeleton?  For the
> moment, I don't think it's a problem to leave them there.  To fix it, you
> could include a target-install hook that removes them (which obviously still
> leaves the init scripts installed by other packages, but that should be
> fixed separately per package).

I'm not very fond of removing them neither. So let's forget them :)

-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 3/3] Migrate the packages to the new infra
  2011-12-20 21:29   ` Arnout Vandecappelle
@ 2012-01-02 10:02     ` Maxime Ripard
  2012-01-06  6:52       ` Arnout Vandecappelle
  0 siblings, 1 reply; 24+ messages in thread
From: Maxime Ripard @ 2012-01-02 10:02 UTC (permalink / raw)
  To: buildroot

On 20/12/2011 22:29, Arnout Vandecappelle wrote:
> On Wednesday 23 November 2011 12:30:11 Maxime Ripard wrote:
>> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
>  I only did a partial review, so no Reviewed-by tag.
> [snip]
>> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
>> index 73c4969..0ff27ca 100644
>> --- a/package/busybox/busybox.mk
>> +++ b/package/busybox/busybox.mk
>> @@ -30,11 +30,7 @@ endif
>>  
>>  # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
>>  ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
>> -define BUSYBOX_INSTALL_MDEV_SCRIPT
>> -	[ -f $(TARGET_DIR)/etc/init.d/S10mdev ] || \
>> -		install -D -m 0755 package/busybox/S10mdev \
>> -			$(TARGET_DIR)/etc/init.d/S10mdev
>> -endef
>> +BUSYBOX_INIT_SYSV += package/busybox/S10mdev
>  This is not actually equivalent: the original makes sure not to overwrite 
> an existing S10mdev (coming from the skeleton).  Perhaps patch 2/3 should
> include this test as well.

Definitely.

>>  define BUSYBOX_INSTALL_MDEV_CONF
>>  	[ -f $(TARGET_DIR)/etc/mdev.conf ] || \
>>  		install -D -m 0644 package/busybox/mdev.conf \
>> @@ -139,6 +135,7 @@ define BUSYBOX_SET_INIT
>>  endef
>>  endif
>>  
>> +ifeq ($(BR2_INIT_BUSYBOX)$(BR2_INIT_SYSV),y)
>>  define BUSYBOX_INSTALL_LOGGING_SCRIPT
>>  	if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
>>  		[ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
>> @@ -146,12 +143,15 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
>>  				$(TARGET_DIR)/etc/init.d/S01logging; \
>>  	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
>>  endef
>> +else
>> +define BUSYBOX_INSTALL_LOGGING_SCRIPT
>> +endef
>> +endif
>  This else part is not necessary: an undefined variable evaluates to nothing.

Ok, good to know

>>  
>>  # We do this here to avoid busting a modified .config in configure
>>  BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
>>  
>>  define BUSYBOX_CONFIGURE_CMDS
>> -	$(BUSYBOX_SET_SYSKLOGD)
>>  	$(BUSYBOX_SET_BB_PWD)
>>  	$(BUSYBOX_SET_LARGEFILE)
>>  	$(BUSYBOX_SET_IPV6)
>> @@ -177,7 +177,6 @@ define BUSYBOX_INSTALL_TARGET_CMDS
>>  		$(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
>>  			$(TARGET_DIR)/usr/share/udhcpc/default.script; \
>>  	fi
>> -	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
>>  	$(BUSYBOX_INSTALL_MDEV_CONF)
>>  	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
>>  endef
> [snip]
> 
>  By the way, doesn't systemd support sysv-style init scripts as well?

It does, but you lose almost if not all the benefits of using systemd
with sysv scripts.


-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  2012-01-02  9:52     ` Maxime Ripard
@ 2012-01-02 14:52       ` Thomas Petazzoni
  2012-01-06  7:13       ` Arnout Vandecappelle
  1 sibling, 0 replies; 24+ messages in thread
From: Thomas Petazzoni @ 2012-01-02 14:52 UTC (permalink / raw)
  To: buildroot

Le Mon, 02 Jan 2012 10:52:13 +0100,
Maxime Ripard <maxime.ripard@free-electrons.com> a ?crit :

> 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.

I agree that we should only support mutually exclusive init systems.
Doing otherwise would make things much more complicated, with no real
benefit. Buildroot is mostly aimed at small to medium sized embedded
systems, and for those, it would really be strange to have multiple
init systems in place at the same time, even though in theory they
could live together.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 3/3] Migrate the packages to the new infra
  2012-01-02 10:02     ` Maxime Ripard
@ 2012-01-06  6:52       ` Arnout Vandecappelle
  0 siblings, 0 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2012-01-06  6:52 UTC (permalink / raw)
  To: buildroot

On Monday 02 January 2012 11:02:27 Maxime Ripard wrote:
> >  By the way, doesn't systemd support sysv-style init scripts as well?
> 
> It does, but you lose almost if not all the benefits of using systemd
> with sysv scripts.

 Yes, but then we should install a package's sysv init scripts if it 
doesn't define systemd init scripts.

 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  2012-01-02  9:52     ` Maxime Ripard
  2012-01-02 14:52       ` Thomas Petazzoni
@ 2012-01-06  7:13       ` Arnout Vandecappelle
  2012-01-06  9:15         ` Maxime Ripard
  1 sibling, 1 reply; 24+ messages in thread
From: Arnout Vandecappelle @ 2012-01-06  7:13 UTC (permalink / raw)
  To: buildroot

On Monday 02 January 2012 10:52:13 Maxime Ripard wrote:
> On 20/12/2011 09:03, Arnout Vandecappelle wrote:
> > On Wednesday 23 November 2011 12:30:10 Maxime Ripard wrote:
[snip]
> >> 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.

 Just to be clear: I agree that we should only support mutually exclusive
init systems, but NOT mutually exclusive init packages.  In other words,
BR2_INIT_{BUSYBOX,SYSV,SYSTEMD} should be mutually exclusive.  However, 
IMO that doesn't mean that the unused binaries should be forcibly removed 
from the system.  In the current situation, it is also possible to compile 
the init applet of busybox and at the same time install the sysvinit package
(where the sysvinit package will remove busybox's symlink).

 The main reason to allow both packages in parallel is that making them
mutually exclusive adds complexity, while it is difficult to be sure that
it really enforces mutual exclusivity in all situations.  There are many
cases where two packages supply the same functionality (especially with
busybox), and buildroot does little (and should do little) to enforce
that only one of them is used.

 Also enforcing it gives little benefit.  You would normally not select
any init package explicitly, you'd only select a BR2_INIT_ option.  If
you do select an init package explicitly after all, there may be a good
reason for it.  (Of course, this does mean that init should be removed
from the default busybox configs.)

 The second reason is that it could make sense to have both (especially
during development).  So why spend extra effort to disable something
that could be useful?

> 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.

 That's something else: buildroot should install only one set of init 
scripts, either sysv or systemd.  If you really want both, you'll have
to put it in the skeleton.

> >> 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 ?

 Well, actually: if you want them to be mutually exclusive, the systemd
package (and the sysvinit package) have no place in the menuconfig, so
instead it should be:

config BR2_PACKAGE_SYSTEMD
	depends on BR2_INIT_SYSTEMD

This will make sure it gets selected if and only if BR2_INIT_SYSTEMD is
selected, and will hide it from the menuconfig.

> >>  	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

 Same here.

 [snip]

 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  2012-01-06  7:13       ` Arnout Vandecappelle
@ 2012-01-06  9:15         ` Maxime Ripard
  2012-01-09  6:37           ` Arnout Vandecappelle
  0 siblings, 1 reply; 24+ messages in thread
From: Maxime Ripard @ 2012-01-06  9:15 UTC (permalink / raw)
  To: buildroot

Hi,

On 06/01/2012 08:13, Arnout Vandecappelle wrote:
> On Monday 02 January 2012 10:52:13 Maxime Ripard wrote:
>> On 20/12/2011 09:03, Arnout Vandecappelle wrote:
>>> On Wednesday 23 November 2011 12:30:10 Maxime Ripard wrote:
> [snip]
>>>> 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.
> 
>  Just to be clear: I agree that we should only support mutually exclusive
> init systems, but NOT mutually exclusive init packages.  In other words,
> BR2_INIT_{BUSYBOX,SYSV,SYSTEMD} should be mutually exclusive.  However, 
> IMO that doesn't mean that the unused binaries should be forcibly removed 
> from the system.  In the current situation, it is also possible to compile 
> the init applet of busybox and at the same time install the sysvinit package
> (where the sysvinit package will remove busybox's symlink).
> 
>  The main reason to allow both packages in parallel is that making them
> mutually exclusive adds complexity, while it is difficult to be sure that
> it really enforces mutual exclusivity in all situations.  There are many
> cases where two packages supply the same functionality (especially with
> busybox), and buildroot does little (and should do little) to enforce
> that only one of them is used.
> 
>  Also enforcing it gives little benefit.  You would normally not select
> any init package explicitly, you'd only select a BR2_INIT_ option.  If
> you do select an init package explicitly after all, there may be a good
> reason for it.  (Of course, this does mean that init should be removed
> from the default busybox configs.)
> 
>  The second reason is that it could make sense to have both (especially
> during development).  So why spend extra effort to disable something
> that could be useful?

Ok, it makes sense

> 
>> 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.
> 
>  That's something else: buildroot should install only one set of init 
> scripts, either sysv or systemd.  If you really want both, you'll have
> to put it in the skeleton.

I agree, but you seem to say otherwise in your other mail from today. To
me, there is no need for us to add a fallback to sysv scripts. You will
be in one of the three cases :
  - You use sysvinit or busybox and the package has a sysv script: Great
  - You use systemd and the package has no systemd unit file: Send a patch
  - You use systemd and the package has a systemd unit file: Great

As simple as that.

>>>> 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 ?
> 
>  Well, actually: if you want them to be mutually exclusive, the systemd
> package (and the sysvinit package) have no place in the menuconfig, so
> instead it should be:
> 
> config BR2_PACKAGE_SYSTEMD
> 	depends on BR2_INIT_SYSTEMD
> 
> This will make sure it gets selected if and only if BR2_INIT_SYSTEMD is
> selected, and will hide it from the menuconfig.

Right.

Maxime
-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Buildroot] [PATCH 2/3] Rework of the init system
  2012-01-06  9:15         ` Maxime Ripard
@ 2012-01-09  6:37           ` Arnout Vandecappelle
  0 siblings, 0 replies; 24+ messages in thread
From: Arnout Vandecappelle @ 2012-01-09  6:37 UTC (permalink / raw)
  To: buildroot

On Friday 06 January 2012 10:15:46 Maxime Ripard wrote:
> >> 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.
> > 
> >  That's something else: buildroot should install only one set of init 
> > scripts, either sysv or systemd.  If you really want both, you'll have
> > to put it in the skeleton.
> 
> I agree, but you seem to say otherwise in your other mail from today. To
> me, there is no need for us to add a fallback to sysv scripts. You will
> be in one of the three cases :
>   - You use sysvinit or busybox and the package has a sysv script: Great
>   - You use systemd and the package has no systemd unit file: Send a patch
>   - You use systemd and the package has a systemd unit file: Great
> 
> As simple as that.

 OK, fair enough.  No fallback sysv scripts needed, then.

 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120109/3eb8660a/attachment-0001.html>

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-01-09  6:37 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox