Skip to contentSkip to conversation

Add systemd to buildroot

RFC New Maxime Ripard 5 participants 24 messages Nov 23, 2011 – Jan 9, 2012

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

PATCH 1/3 Add the systemd package

---
 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
fs/skeleton/etc/mtab +1 -1
index e1c2045..4c0a094 120000
@@ -1 +1 @@
-../proc/mounts
\ No newline at end of file
+/proc/mounts
\ No newline at end of file
linux/linux.mk +2 -0
index 5c5a1d2..22f50b4 100644
@@ -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
package/Config.in +1 -0
index 4b5e5d8..42ec82a 100644
@@ -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"
package/dbus/dbus.mk +4 -0
index e18e291..f18d84a 100644
@@ -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
package/systemd/Config.in new file +16 -0
new file mode 100644
index 0000000..09cedb9
@@ -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
package/systemd/systemd.mk new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 1/3 Add the systemd package

Hi Maxime,

Quoted 17 lines · Maxime Ripard
---
 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
fs/skeleton/etc/mtab +0 -0
index e1c2045..4c0a094 120000

fs/skeleton/etc/mtab line 1

Quoted 4 lines
fs/skeleton/etc/mtab +1 -1
@@ -1 +1 @@
-../proc/mounts
\ No newline at end of file
+/proc/mounts
\ No newline at end of file

Why is this change needed?

[snip]

fs/skeleton/etc/mtab

Quoted 6 lines
fs/skeleton/etc/mtab +6 -0
+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

Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#3 lore raw

PATCH 1/3 Add the systemd package

Hi,

Quoted 13 lines · Baruch Siach
Quoted 12 lines · Maxime Ripard
---
 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
Quoted 11 lines

fs/skeleton/etc/mtab line 1

Quoted 9 lines
fs/skeleton/etc/mtab +1 -1
index e1c2045..4c0a094 120000
@@ -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

Quoted 9 lines

fs/skeleton/etc/mtab

Quoted 6 lines
fs/skeleton/etc/mtab +6 -0
+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

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/3 Add the systemd package

In reply to Maxime Ripard
Quoted 1 line · On Wednesday 23 November 2011 12:30:09 Maxime Ripard wrote:

[snip]

Quoted 7 lines
linux/linux.mk +0 -0
index 5c5a1d2..22f50b4 100644
@@ -149,6 +149,8 @@ define LINUX_CONFIGURE_CMDS
 
        $(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),

linux/linux.mk define LINUX_CONFIGURE_CMDS

Quoted 10 lines
linux/linux.mk +2 -0
 
                $(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?

Quoted 4 lines

endef

# Compilation. We make sure the kernel gets rebuilt when the

[snip]

package/systemd/Config.in line 4

Quoted 10 lines
package/systemd/Config.in new file +4 -0
new file mode 100644
index 0000000..09cedb9
@@ -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
Quoted 26 lines
package/systemd/Config.in new file +12 -0
+	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
package/systemd/systemd.mk new file +8 -0
new file mode 100644
index 0000000..8733ce0
@@ -0,0 +1,45 @@
+#############################################################
+#
+# systemd
+#
+#############################################################
+SYSTEMD_VERSION = 37
+SYSTEMD_SITE = http://www.freedesktop.org/software/systemd/
+SYSTEMD_SOURCE = systemd-$(SYSTEMD_VERSION).tar.bz2

package/systemd/systemd.mk line 18

Quoted 10 lines
package/systemd/systemd.mk new file +10 -0
+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

Quoted 6 lines
package/systemd/systemd.mk new file +6 -0
+	--disable-pam \
+	--disable-libcryptsetup \
+	--disable-gtk \
+	--disable-plymouth \
+	--with-rootdir=/ \
+	--with-dbuspolicydir=/etc/dbus-1/system.d \

package/systemd/systemd.mk line 34

Quoted 10 lines
package/systemd/systemd.mk new file +10 -0
+	--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.

package/systemd/systemd.mk line 45

Quoted 11 lines
package/systemd/systemd.mk new file +11 -0
+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

Signature · 6 lines
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
#5 lore raw

PATCH 1/3 Add the systemd package

Hi Arnout,

Thanks for the review,

Quoted 17 lines · Arnout Vandecappelle
Quoted 1 line · On Wednesday 23 November 2011 12:30:09 Maxime Ripard wrote:

[snip]

Quoted 12 lines
linux/linux.mk +0 -0
index 5c5a1d2..22f50b4 100644
@@ -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))
Quoted 7 lines

linux/linux.mk define LINUX_CONFIGURE_CMDS

Quoted 5 lines
linux/linux.mk +2 -0
        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.

Quoted 18 lines
Quoted 4 lines

endef

# Compilation. We make sure the kernel gets rebuilt when the

[snip]

package/systemd/Config.in line 4

Quoted 10 lines
package/systemd/Config.in new file +4 -0
new file mode 100644
index 0000000..09cedb9
@@ -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)"

Quoted 1 line
	depends on !BR2_PACKAGE_UDEV || !BR2_PACKAGE_DBUS

Indeed.

Quoted 29 lines
Quoted 29 lines
package/systemd/Config.in new file +12 -0
+	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
package/systemd/systemd.mk new file +11 -0
new file mode 100644
index 0000000..8733ce0
@@ -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 \
Quoted 8 lines

package/systemd/systemd.mk line 18

Quoted 7 lines
package/systemd/systemd.mk new file +7 -0
+	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.

Quoted 11 lines
Quoted 11 lines
package/systemd/systemd.mk new file +11 -0
+	--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 \
+
Quoted 8 lines

package/systemd/systemd.mk line 34

Quoted 5 lines
package/systemd/systemd.mk new file +5 -0
+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

Quoted 16 lines

package/systemd/systemd.mk line 45

Quoted 11 lines
package/systemd/systemd.mk new file +11 -0
+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

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 2/3 Rework of the init system

In reply to Maxime Ripard

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.

---
 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(-)
package/Makefile.package.in +8 -0
index bd9ceb5..c0684d0 100644
@@ -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
package/busybox/busybox.mk +11 -0
index 9e91136..73c4969 100644
@@ -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)
package/systemd/Config.in +1 -0
index 09cedb9..33d5ccf 100644
@@ -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
package/sysvinit/Config.in +1 -0
index 34ec391..d91c643 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_SYSVINIT
 	bool "sysvinit"
+	depends on BR2_INIT_SYSV
 	help
 	  /sbin/init - parent of all processes
 
package/sysvinit/sysvinit.mk +0 -5
index 0d65c43..163ba9b 100644
@@ -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; \
target/generic/Config.in +19 -0
index a91de32..d9b93af 100644
@@ -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"
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 2/3 Rework of the init system

Quoted 7 lines · 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.

Quoted 14 lines
---
 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(-)
package/Makefile.package.in +0 -0
index bd9ceb5..c0684d0 100644

package/Makefile.package.in $(BUILD_DIR)/%/.stamp_images_installed: · line 373

Quoted 7 lines
package/Makefile.package.in +4 -0
@@ -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)))))
Quoted 29 lines
package/Makefile.package.in +4 -0
 	$($(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
package/busybox/busybox.mk +0 -0
index 9e91136..73c4969 100644
@@ -129,6 +129,16 @@ define BUSYBOX_DISABLE_MMU_APPLETS
 endef
 endif
 

package/busybox/busybox.mk define BUSYBOX_DISABLE_MMU_APPLETS · line 141

Quoted 10 lines
package/busybox/busybox.mk +10 -0
+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.)

Quoted 16 lines
package/busybox/busybox.mk +1 -0
 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)
package/systemd/Config.in +0 -0
index 09cedb9..33d5ccf 100644

package/systemd/Config.in line 3

Quoted 3 lines
package/systemd/Config.in +1 -0
@@ -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

Quoted 39 lines
package/systemd/Config.in +0 -0
 	depends on BR2_PACKAGE_UDEV
 	depends on BR2_PACKAGE_DBUS
 	select BR2_PACKAGE_LIBCAP
package/sysvinit/Config.in +1 -0
index 34ec391..d91c643 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_SYSVINIT
 	bool "sysvinit"
+	depends on BR2_INIT_SYSV
 	help
 	  /sbin/init - parent of all processes
 
package/sysvinit/sysvinit.mk +0 -5
index 0d65c43..163ba9b 100644
@@ -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; \
target/generic/Config.in +1 -0
index a91de32..d9b93af 100644
@@ -32,6 +32,25 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
 
 endchoice
 
+choice

target/generic/Config.in config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV · line 45

Quoted 10 lines
target/generic/Config.in +10 -0
+	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.

target/generic/Config.in config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV · line 53

Quoted 8 lines
target/generic/Config.in +8 -0
+	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

Quoted 4 lines
target/generic/Config.in +0 -0
 config BR2_ROOTFS_DEVICE_TABLE
 	string "Path to the permission tables"
 	default "target/generic/device_table.txt"
Signature · 6 lines
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
#8 lore raw

PATCH 2/3 Rework of the init system

Quoted 36 lines · Arnout Vandecappelle
Quoted 7 lines · 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.

Quoted 14 lines
---
 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(-)
package/Makefile.package.in +0 -0
index bd9ceb5..c0684d0 100644

package/Makefile.package.in $(BUILD_DIR)/%/.stamp_images_installed: · line 373

Quoted 7 lines
package/Makefile.package.in +4 -0
@@ -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!):

Quoted 4 lines
	$(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 :)

Quoted 29 lines
Quoted 29 lines
package/Makefile.package.in +4 -0
 	$($(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
package/busybox/busybox.mk +0 -0
index 9e91136..73c4969 100644
@@ -129,6 +129,16 @@ define BUSYBOX_DISABLE_MMU_APPLETS
 endef
 endif
 
Quoted 14 lines

package/busybox/busybox.mk define BUSYBOX_DISABLE_MMU_APPLETS · line 141

Quoted 10 lines
package/busybox/busybox.mk +10 -0
+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.

Quoted 15 lines
Quoted 15 lines
package/busybox/busybox.mk +1 -0
 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)
package/systemd/Config.in +0 -0
index 09cedb9..33d5ccf 100644
Quoted 8 lines

package/systemd/Config.in line 3

Quoted 4 lines
package/systemd/Config.in +1 -0
@@ -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 ?

Quoted 38 lines
Quoted 38 lines
package/systemd/Config.in +0 -0
 	depends on BR2_PACKAGE_UDEV
 	depends on BR2_PACKAGE_DBUS
 	select BR2_PACKAGE_LIBCAP
package/sysvinit/Config.in +1 -0
index 34ec391..d91c643 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_SYSVINIT
 	bool "sysvinit"
+	depends on BR2_INIT_SYSV
 	help
 	  /sbin/init - parent of all processes
 
package/sysvinit/sysvinit.mk +0 -5
index 0d65c43..163ba9b 100644
@@ -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; \
target/generic/Config.in +0 -0
index a91de32..d9b93af 100644
@@ -32,6 +32,25 @@ config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV
 
 endchoice
 
Quoted 14 lines

target/generic/Config.in config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV · line 45

Quoted 11 lines
target/generic/Config.in +11 -0
+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

Quoted 11 lines

target/generic/Config.in config BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV · line 53

Quoted 8 lines
target/generic/Config.in +8 -0
+	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

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#9 lore raw

PATCH 2/3 Rework of the init system

Le Mon, 02 Jan 2012 10:52:13 +0100,
Maxime Ripard <[email protected]> a ?crit :

Quoted 4 lines

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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#10 lore raw

PATCH 2/3 Rework of the init system

In reply to Maxime Ripard
Quoted 2 lines · On Monday 02 January 2012 10:52:13 Maxime Ripard wrote:
Quoted 1 line · Arnout Vandecappelle

On Wednesday 23 November 2011 12:30:10 Maxime Ripard wrote:

[snip]

Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
package/busybox/busybox.mk +0 -0
index 9e91136..73c4969 100644
@@ -129,6 +129,16 @@ define BUSYBOX_DISABLE_MMU_APPLETS
 endef
 endif
 
Quoted 14 lines

package/busybox/busybox.mk define BUSYBOX_DISABLE_MMU_APPLETS · line 141

Quoted 10 lines
package/busybox/busybox.mk +10 -0
+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.)

Quoted 4 lines

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?

Quoted 4 lines

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.

Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
package/systemd/Config.in +0 -0
index 09cedb9..33d5ccf 100644
Quoted 8 lines

package/systemd/Config.in line 3

Quoted 4 lines
package/systemd/Config.in +1 -0
@@ -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

Quoted 1 line

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.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
package/systemd/Config.in +0 -0
 	depends on BR2_PACKAGE_UDEV
 	depends on BR2_PACKAGE_DBUS
 	select BR2_PACKAGE_LIBCAP
package/sysvinit/Config.in +0 -0
index 34ec391..d91c643 100644
Quoted 8 lines
Quoted 8 lines

package/sysvinit/Config.in line 5

Quoted 8 lines
package/sysvinit/Config.in +1 -0
@@ -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

Signature · 6 lines
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
#11 lore raw

PATCH 2/3 Rework of the init system

Hi,

Quoted 53 lines · Arnout Vandecappelle
Quoted 2 lines · On Monday 02 January 2012 10:52:13 Maxime Ripard wrote:
Quoted 1 line · Arnout Vandecappelle

On Wednesday 23 November 2011 12:30:10 Maxime Ripard wrote:

[snip]

Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
package/busybox/busybox.mk +0 -0
index 9e91136..73c4969 100644
@@ -129,6 +129,16 @@ define BUSYBOX_DISABLE_MMU_APPLETS
 endef
 endif
 
Quoted 14 lines

package/busybox/busybox.mk define BUSYBOX_DISABLE_MMU_APPLETS · line 141

Quoted 10 lines
package/busybox/busybox.mk +10 -0
+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.)

Quoted 4 lines

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

Quoted 3 lines

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

Quoted 9 lines
Quoted 5 lines

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.

Quoted 19 lines
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
package/systemd/Config.in +0 -0
index 09cedb9..33d5ccf 100644
Quoted 8 lines

package/systemd/Config.in line 3

Quoted 4 lines
package/systemd/Config.in +1 -0
@@ -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

Quoted 1 line

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:

Quoted 5 lines

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

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#12 lore raw

PATCH 2/3 Rework of the init system

Quoted 9 lines · On Friday 06 January 2012 10:15:46 Maxime Ripard wrote:
Quoted 8 lines
Quoted 4 lines

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.

Quoted 8 lines

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

Signature · 9 lines
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>
#13 lore raw

PATCH 3/3 Migrate the packages to the new infra

In reply to Maxime Ripard
---
 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(-)
package/at/at.mk +1 -6
index 4270c83..c88e207 100644
@@ -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 \
package/avahi/avahi.mk +2 -6
index 739c5f2..b495c96 100644
@@ -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))
package/busybox/busybox.mk +6 -7
index 73c4969..0ff27ca 100644
@@ -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
package/dbus/dbus.mk +2 -1
index f18d84a..9d2255d 100644
@@ -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
package/dhcp/dhcp.mk +2 -4
index 7548f41..db4b5e1 100644
@@ -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
 
package/dropbear/dropbear.mk +2 -4
index bced0ef..348a5cb 100644
@@ -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))
package/gdk-pixbuf/gdk-pixbuf.mk +1 -5
index 65b3dbd..e885649 100644
@@ -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))
package/gpsd/gpsd.mk +1 -1
index be6daeb..d9b5cc2 100644
@@ -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
package/input-event-daemon/input-event-daemon.mk +1 -3
index a938ae7..523e764 100644
@@ -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
package/multimedia/mpd/mpd.mk +1 -2
index b29b9f7..0cc5a0b 100644
@@ -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
package/netplug/netplug.mk +1 -1
index db76021..f0052d8 100644
@@ -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
package/netsnmp/netsnmp.mk +3 -3
index 5d789b9..1716ba0 100644
@@ -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
 
package/nfs-utils/nfs-utils.mk +2 -2
index bbe25fe..d3a26db 100644
@@ -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
 
package/ntp/ntp.mk +4 -2
index f17193f..b3144ca 100644
@@ -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
 
package/olsr/olsr.mk +1 -2
index 9ed4d5b..5c3a87c 100644
@@ -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*
package/openssh/openssh.mk +1 -6
index 08bb499..e49547e 100644
@@ -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))
package/pango/pango.mk +2 -7
index 2691b88..228a9fd 100644
@@ -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))
package/portmap/portmap.mk +1 -2
index cb7c0e3..25fb65e 100644
@@ -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
package/proftpd/proftpd.mk +2 -2
index 2523dd2..bc91f25 100644
@@ -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
 
package/radvd/radvd.mk +1 -6
index d4b9a73..6155236 100644
@@ -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))
package/rsyslog/rsyslog.mk +1 -2
index 6582812..e9dc8ac 100644
@@ -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
package/samba/samba.mk +3 -6
index de2c13b..0c563d7 100644
@@ -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))
package/stunnel/stunnel.mk +1 -1
index 6088e58..c718525 100644
@@ -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
package/tftpd/tftpd.mk +1 -1
index 728319b..45eb8b3 100644
@@ -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))
package/tinyhttpd/tinyhttpd.mk +1 -1
index 739849f..c86c056 100644
@@ -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)
package/udev/udev.mk +2 -6
index 1825396..2dac4e8 100644
@@ -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))
Signature · 1 line
1.7.4.1
#14 lore raw

PATCH 3/3 Migrate the packages to the new infra

Quoted 1 line · On Wednesday 23 November 2011 12:30:11 Maxime Ripard wrote:

I only did a partial review, so no Reviewed-by tag.
[snip]

Quoted 5 lines
package/busybox/busybox.mk +0 -0
index 73c4969..0ff27ca 100644

package/busybox/busybox.mk endif · line 33

Quoted 9 lines
package/busybox/busybox.mk +1 -5
@@ -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.

Quoted 12 lines
package/busybox/busybox.mk +1 -0
 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 ] || \

package/busybox/busybox.mk define BUSYBOX_INSTALL_LOGGING_SCRIPT · line 149

Quoted 7 lines
package/busybox/busybox.mk +4 -0
@@ -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.

Quoted 10 lines
package/busybox/busybox.mk +0 -1
 # 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)

package/busybox/busybox.mk define BUSYBOX_INSTALL_TARGET_CMDS · line 182

Quoted 7 lines
package/busybox/busybox.mk +0 -1
@@ -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

Signature · 6 lines
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
#15 lore raw

PATCH 3/3 Migrate the packages to the new infra

Quoted 10 lines · Arnout Vandecappelle
Quoted 1 line · On Wednesday 23 November 2011 12:30:11 Maxime Ripard wrote:

I only did a partial review, so no Reviewed-by tag.
[snip]

Quoted 6 lines
package/busybox/busybox.mk +0 -0
index 73c4969..0ff27ca 100644
@@ -30,11 +30,7 @@ endif
 
Quoted 11 lines

package/busybox/busybox.mk endif · line 33

Quoted 8 lines
package/busybox/busybox.mk +1 -5
 # 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.

Quoted 7 lines
Quoted 7 lines
package/busybox/busybox.mk +0 -0
 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
 
Quoted 13 lines

package/busybox/busybox.mk define BUSYBOX_INSTALL_LOGGING_SCRIPT · line 149

Quoted 12 lines
package/busybox/busybox.mk +5 -0
+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

Quoted 19 lines
Quoted 17 lines
package/busybox/busybox.mk +0 -2
 # 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]

Quoted 1 line

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.

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#16 lore raw

PATCH 3/3 Migrate the packages to the new infra

Quoted 4 lines · On Monday 02 January 2012 11:02:27 Maxime Ripard wrote:
Quoted 1 line

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

Signature · 6 lines
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
#17 lore raw
In reply to Maxime Ripard

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

Quoted 22 lines · Maxime Ripard

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

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#18 lore raw
In reply to Maxime Ripard

Hi Maxime,

Quoted 10 lines · Maxime Ripard

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.

Quoted 5 lines

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?

Quoted 8 lines

Maxime

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

Thanks,

Marek

Signature · 10 lines
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
#19 lore raw

Hi Marek,

Le 23/11/2011 22:14, Belisko Marek a ?crit :

Quoted 10 lines
Quoted 8 lines · Maxime Ripard

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.

Quoted 8 lines
Quoted 5 lines

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

#20 lore raw
Quoted 7 lines · On Wednesday 23 November 2011 22:35:54 Maxime Ripard wrote:
Quoted 3 lines

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

Signature · 6 lines
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
#21 lore raw
In reply to Maxime Ripard

Hi,

Do you all agree on that ?

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

Maxime

Quoted 22 lines · Maxime Ripard

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

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#22 lore raw
In reply to Maxime Ripard
Quoted 5 lines · 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.

Quoted 3 lines

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.

Quoted 3 lines

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

Signature · 6 lines
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
#23 lore raw

Hi Arnout,

Quoted 6 lines · Arnout Vandecappelle
Quoted 3 lines · 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 :)

Quoted 6 lines
Quoted 3 lines

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

Quoted 9 lines
Quoted 3 lines

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

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