Skip to contentSkip to conversation

Pull request for branch for-2012.08/systemd

GIT PULL New Maxime Ripard 2 participants 6 messages May 29, 2012 – Jun 20, 2012 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

The following changes since commit 3ae7d814075095b43e25c8ef11be6a14234241cc:

pkg-download.mk: Add missing argument when downloading from primary mirror (scp) (2012-05-23 21:49:40 +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 23dac19640ec6f2095e128c8b641ca2d5a0be8a1:

Add systemd unit for lighttpd (2012-05-29 11:59:34 +0200)

----------------------------------------------------------------
Maxime Ripard (2):
Rework of the init system
Add systemd unit for lighttpd

 package/lighttpd/lighttpd.mk      |   11 +++++++++++
 package/lighttpd/lighttpd.service |   10 ++++++++++
 package/pkg-gentargets.mk         |    8 ++++++++
 package/sysvinit/Config.in        |    1 +
 target/generic/Config.in          |   25 +++++++++++++++++++++++++
 5 files changed, 55 insertions(+)
 create mode 100644 package/lighttpd/lighttpd.service

Thanks,

Signature · 1 line
Maxime Ripard
#1 lore raw

PATCH 1/2 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/pkg-gentargets.mk  |    8 ++++++++
 package/sysvinit/Config.in |    1 +
 target/generic/Config.in   |   25 +++++++++++++++++++++++++
 3 files changed, 34 insertions(+)
package/pkg-gentargets.mk +8 -0
index 1c9b458..645f53b 100644
@@ -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:
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
 
target/generic/Config.in +25 -0
index 88f0718..309ef55 100644
@@ -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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

PATCH 1/2 Rework of the init system

Hi Arnout,

Thanks for the review.

Le 05/06/2012 01:28, Arnout Vandecappelle a ?crit :

Quoted 15 lines · Maxime Ripard
Quoted 8 lines

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.

Two remarks, but they don't need to stop this patch.

[snip]

Quoted 11 lines

package/sysvinit/Config.in line 3

Quoted 8 lines
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

I don't think this is needed. If you do keep it, there should also be one
for systemd.

Ok, I'll remove it.

Quoted 12 lines
Quoted 12 lines
package/sysvinit/Config.in +0 -0
      help
        /sbin/init - parent of all processes
 
target/generic/Config.in +0 -0
index 88f0718..309ef55 100644
@@ -37,6 +37,31 @@ comment "udev requires a toolchain with LARGEFILE +

WCHAR support"

endchoice

Quoted 11 lines

target/generic/Config.in comment "udev requires a toolchain with LARGEFILE + WCHAR support" · line 46

Quoted 7 lines
target/generic/Config.in +7 -0
+choice
+    prompt "Init system"
+    default BR2_INIT_BUSYBOX
+
+config BR2_INIT_BUSYBOX
+    bool "Busybox"
+    select BR2_PACKAGE_BUSYBOX

Ideally, the busybox.mk should make sure init is selected in the
busybox config
if this option is chosen.

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

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

Quoted 22 lines
Quoted 21 lines
target/generic/Config.in +18 -0
+
+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 · 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/2 Rework of the init system

Quoted 8 lines · Maxime Ripard
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

+choice
+ prompt "Init system"
+ default BR2_INIT_BUSYBOX
+
+config BR2_INIT_BUSYBOX
+ bool "Busybox"
+ select BR2_PACKAGE_BUSYBOX

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Ideally, the busybox.mk should make sure init is selected in the
busybox config
if this option is chosen.

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

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

Regards,
Arnout

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
#5 lore raw

PATCH 1/2 Rework of the init system

Hi Arnout,

Le 20/06/2012 08:59, Arnout Vandecappelle a ?crit :

Quoted 13 lines · Maxime Ripard
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines

+choice
+ prompt "Init system"
+ default BR2_INIT_BUSYBOX
+
+config BR2_INIT_BUSYBOX
+ bool "Busybox"
+ select BR2_PACKAGE_BUSYBOX

Ideally, the busybox.mk should make sure init is selected in the
busybox config
if this option is chosen.

Quoted 5 lines
Quoted 2 lines

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

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

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

Maxime

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/2 Add systemd unit for lighttpd

In reply to Maxime Ripard
---
 package/lighttpd/lighttpd.mk      |   11 +++++++++++
 package/lighttpd/lighttpd.service |   10 ++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 package/lighttpd/lighttpd.service
package/lighttpd/lighttpd.mk +11 -0
index 8d1f212..1f2f283 100644
@@ -88,6 +88,17 @@ endef
 
 LIGHTTPD_POST_INSTALL_TARGET_HOOKS += LIGHTTPD_INSTALL_CONFIG
 
+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 -f $(TARGET_DIR)/usr/sbin/lighttpd
 	rm -f $(TARGET_DIR)/usr/sbin/lighttpd-angel
package/lighttpd/lighttpd.service new file +10 -0
new file mode 100644
index 0000000..0ca5357
@@ -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