Pull request for branch for-2012.08/systemd
The following changes since commit fd08153b9d677d654add6c580b9ccc5c27d672e2:
Remove unused TARGET_ABI values (2012-07-25 20:27:58 +0200)
are available in the git repository at:
git://git.free-electrons.com/users/maxime-ripard/buildroot.git for-2012.08/systemd
for you to fetch changes up to 6784a19dec70861969e093a123abe92f4ace3e56:
doc: Update the documentation to mention the new PKG_INSTALL_INIT_ variables (2012-07-28 09:17:04 +0200)
----------------------------------------------------------------
Maxime Ripard (3):
Rework of the init system
Add systemd unit for lighttpd
doc: Update the documentation to mention the new PKG_INSTALL_INIT_ variables
docs/manual/adding-packages-generic.txt | 7 +++++++ package/busybox/busybox.mk | 7 +++++++ package/lighttpd/lighttpd.mk | 13 +++++++++++-- package/lighttpd/lighttpd.service | 10 ++++++++++ package/pkg-generic.mk | 8 ++++++++ target/generic/Config.in | 25 +++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 package/lighttpd/lighttpd.service
Thanks,
Signature · 1 line
Maxime Ripard
PATCH 1/3 Rework of the init system
Since we have now two uncompatible init systems, and we want only one of them at the same time in use in the rootfs, we need to select a particular init system. This patch also adds $(PKG)_INSTALL_INIT_SYSTEMD and $(PKG)_INSTALL_INIT_SYSV hooks that are called when the matching init systems are selected to install properly the init scripts of the package.
--- package/busybox/busybox.mk | 7 +++++++ package/pkg-generic.mk | 8 ++++++++ target/generic/Config.in | 25 +++++++++++++++++++++++++ 3 files changed, 40 insertions(+)
package/busybox/busybox.mk +7 -0
@@ -134,6 +134,12 @@ 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 +endif + define BUSYBOX_INSTALL_LOGGING_SCRIPT if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \ [ -f $(TARGET_DIR)/etc/init.d/S01logging ] || \
@@ -168,6 +174,7 @@ define BUSYBOX_CONFIGURE_CMDS $(BUSYBOX_NETKITTELNET) $(BUSYBOX_INTERNAL_SHADOW_PASSWORDS) $(BUSYBOX_DISABLE_MMU_APPLETS) + $(BUSYBOX_SET_INIT) $(BUSYBOX_SET_WATCHDOG) @yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \ -C $(@D) oldconfig
package/pkg-generic.mk +8 -0
@@ -133,6 +133,10 @@ $(BUILD_DIR)/%/.stamp_images_installed: # Install to target dir $(BUILD_DIR)/%/.stamp_target_installed: @$(call MESSAGE,"Installing to target") + $(if $(BR2_INIT_SYSTEMD),\ + $($(PKG)_INSTALL_INIT_SYSTEMD)) + $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\ + $($(PKG)_INSTALL_INIT_SYSV)) $($(PKG)_INSTALL_TARGET_CMDS) $(foreach hook,$($(PKG)_POST_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep)) $(Q)touch $@
@@ -151,6 +155,10 @@ $(BUILD_DIR)/%/.stamp_uninstalled: rm -f $($(PKG)_TARGET_INSTALL_TARGET) $($(PKG)_UNINSTALL_STAGING_CMDS) $($(PKG)_UNINSTALL_TARGET_CMDS) + $(if $(BR2_INIT_SYSTEMD),\ + $($(PKG)_UNINSTALL_INIT_SYSTEMD)) + $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\ + $($(PKG)_UNINSTALL_INIT_SYSV)) # Remove package sources $(BUILD_DIR)/%/.stamp_dircleaned:
target/generic/Config.in +25 -0
@@ -37,6 +37,31 @@ comment "udev requires a toolchain with LARGEFILE + WCHAR support" endchoice +choice + prompt "Init system" + default BR2_INIT_BUSYBOX + +config BR2_INIT_BUSYBOX + bool "Busybox" + select BR2_PACKAGE_BUSYBOX + +config BR2_INIT_SYSV + bool "systemV" + select BR2_PACKAGE_SYSVINIT + +config BR2_INIT_SYSTEMD + bool "systemd" + depends on BR2_LARGEFILE + depends on BR2_USE_WCHAR + depends on BR2_INET_IPV6 + select BR2_PACKAGE_DBUS + select BR2_PACKAGE_SYSTEMD + +comment 'systemd requires largefile, wchar and IPv6 support' + depends on !(BR2_LARGEFILE && BR2_USE_WCHAR && BR2_INET_IPV6) + +endchoice + config BR2_ROOTFS_DEVICE_TABLE string "Path to the permission tables" default "target/generic/device_table.txt"
Signature · 1 line
1.7.9.5
PATCH 2/3 Add systemd unit for lighttpd
In reply to Maxime Ripard--- package/lighttpd/lighttpd.mk | 13 +++++++++++-- package/lighttpd/lighttpd.service | 10 ++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 package/lighttpd/lighttpd.service
package/lighttpd/lighttpd.mk +11 -2
@@ -87,13 +87,22 @@ endef LIGHTTPD_POST_INSTALL_TARGET_HOOKS += LIGHTTPD_INSTALL_CONFIG -define LIGHTTPD_INSTALL_INIT_SCRIPT +define LIGHTTPD_INSTALL_INIT_SYSV [ -f $(TARGET_DIR)/etc/init.d/S50lighttpd ] || \ $(INSTALL) -D -m 755 package/lighttpd/S50lighttpd \ $(TARGET_DIR)/etc/init.d/S50lighttpd endef -LIGHTTPD_POST_INSTALL_TARGET_HOOKS += LIGHTTPD_INSTALL_INIT_SCRIPT +define LIGHTTPD_INSTALL_INIT_SYSTEMD + [ -f $(TARGET_DIR)/etc/systemd/system/lighttpd.service ] || \ + $(INSTALL) -D -m 755 package/lighttpd/lighttpd.service \ + $(TARGET_DIR)/etc/systemd/system/lighttpd.service + + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants + + ln -fs ../lighttpd.service \ + $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/lighttpd.service +endef define LIGHTTPD_UNINSTALL_TARGET_CMDS $(RM) $(TARGET_DIR)/usr/sbin/lighttpd
package/lighttpd/lighttpd.service new file +10 -0
@@ -0,0 +1,10 @@ +[Unit] +Description=Lighttpd Web Server +After=network.target + +[Service] +ExecStart=/usr/sbin/lighttpd-angel -f /etc/lighttpd/lighttpd.conf -D +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target
Signature · 1 line
1.7.9.5
PATCH 3/3 doc: Update the documentation to mention the new PKG_INSTALL_INIT_ variables
In reply to Maxime Ripard--- docs/manual/adding-packages-generic.txt | 7 +++++++ 1 file changed, 7 insertions(+)
docs/manual/adding-packages-generic.txt +7 -0
@@ -311,6 +311,13 @@ different steps of the build process. * +LIBFOO_UNINSTALL_STAGING_CMDS+, used to list the actions to uninstall the package from the staging directory +$(STAGING_DIR)+. +* +LIBFOO_INSTALL_INIT_SYSV+ and +LIBFOO_INSTALL_INIT_SYSTEMD+, used + to install init scripts either for the systemV-like init systems + (busybox, sysvinit, etc.) or for the systemd units. These commands + will be run only when the relevant init system is installed (i.e. if + systemd is selected as the init system in the configuration, only + +LIBFOO_INSTALL_INIT_SYSTEMD+ will be run). + The preferred way to define these variables is: ----------------------
Signature · 1 line
1.7.9.5
Hi,
I sent these patches a bit too quickly...
Basically, here, not much changed since version 3 of this pull request, since I didn't have any comment on it, except a private comment from Thomas to add the new _INSTALL_INIT_ variables to the documentation, which I did.
Maxime
Le 28/07/2012 09:21, Maxime Ripard a ?crit :
Quoted 29 lines
The following changes since commit
fd08153b9d677d654add6c580b9ccc5c27d672e2:Remove unused
TARGET_ABIvalues (2012-07-25 20:27:58 +0200)are available in the git repository at:
git://git.free-electrons.com/users/maxime-ripard/buildroot.gitfor-2012.08/systemdfor you to fetch changes up to
6784a19dec70861969e093a123abe92f4ace3e56:doc: Update the documentation to mention the new
PKG_INSTALL_INIT_variables (2012-07-28 09:17:04 +0200)----------------------------------------------------------------
Maxime Ripard (3):
Rework of the init system
Add systemd unit for lighttpd
doc: Update the documentation to mention the newPKG_INSTALL_INIT_variablesdocs/manual/adding-packages-generic.txt | 7 +++++++ package/busybox/busybox.mk | 7 +++++++ package/lighttpd/lighttpd.mk | 13 +++++++++++-- package/lighttpd/lighttpd.service | 10 ++++++++++ package/pkg-generic.mk | 8 ++++++++ target/generic/Config.in | 25 +++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 package/lighttpd/lighttpd.serviceThanks,
Signature · 4 lines
Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Le Sat, 28 Jul 2012 09:21:19 +0200,
Maxime Ripard <[email protected]> a ?crit :
Quoted 4 lines
Maxime Ripard (3):
Rework of the init system
Add systemd unit for lighttpd
doc: Update the documentation to mention the newPKG_INSTALL_INIT_variables
I have applied your changes. I had to make a change on PATCH 1/3, because the systemd init choice was visible even if the requirements for the systemd package were not met (thread support and udev-based /dev).
Also, it would be good to investigate the newer versions of systemd. If I remember correctly, they integrate udev directly, but is it possible to still have udev separately? This of course will not be for 2012.08, but it would be nice to continue to integrate those technologies into Buildroot.
Also, in the testing I've done with the vexpress Qemu target, I have not been particularly impressed by the boot speed, but I should probably try on a real target.
And final comment: it seems lighttpd is started even before the web server is accessed. Wasn't systemd supposed to start such daemons on-demand? Or maybe lighttpd does not have the necessary code to support such kind of startup where the already opened socket is passed by systemd?
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Hi,
Le 30/07/2012 23:21, Thomas Petazzoni a ?crit :
Quoted 8 lines
Le Sat, 28 Jul 2012 09:21:19 +0200,
Maxime Ripard <[email protected]> a ?crit :Quoted 4 lines
Maxime Ripard (3):
Rework of the init system
Add systemd unit for lighttpd
doc: Update the documentation to mention the newPKG_INSTALL_INIT_variables
Quoted 4 lines
I have applied your changes. I had to make a change on PATCH 1/3, because the systemd init choice was visible even if the requirements for the systemd package were not met (thread support and udev-based /dev).
Thanks!
Quoted 5 lines
Also, it would be good to investigate the newer versions of systemd. If I remember correctly, they integrate udev directly, but is it possible to still have udev separately? This of course will not be for 2012.08, but it would be nice to continue to integrate those technologies into Buildroot.
Yes, this is definitely something I want to try in the future. They told when they merged udev that we could still be able to compile both separately, but from a quick look, I haven't seen a way to do so yet.
Quoted 3 lines
Also, in the testing I've done with the vexpress Qemu target, I have not been particularly impressed by the boot speed, but I should probably try on a real target.
Yes, boot speed for a minimal system didn't impress me much neither. But still, it tends to be the same time as with busybox's init, but it has way much to boot, like udev, dbus, and so on. Also, if I remember correctly the talk at ELCE last year from Koen Kooi, he was saying that now the boot is mostly CPU-bound, which might explain the not-so-fast boot on slow cpus.
Quoted 5 lines
And final comment: it seems lighttpd is started even before the web server is accessed. Wasn't systemd supposed to start such daemons on-demand? Or maybe lighttpd does not have the necessary code to support such kind of startup where the already opened socket is passed by systemd?
This is one of the features of systemd yes, but the daemons have to be started in inet-mode, so that it's actually systemd that handles the socket. Here, we just start lighttpd like a regular daemon, so except for the starting part, it has nothing to do with the daemon.
Maxime
Signature · 4 lines
Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com