Skip to contentSkip to conversation

Pull request for branch for-2012.05/systemd

GIT PULL New Maxime Ripard 4 participants 22 messages Mar 19, 2012 – Mar 21, 2012

lore
Share & tools
lore
#0 lore raw

Hi all,

This is an update of my previous RFC for integrating systemd into buildroot I guess we have now reached a pretty good shape and we can begin to think about merging these.

As always, any comments are welcome :)

Maxime

The following changes since commit 03ceab6d1611cf378ac9bec92134354bcdd963d1:

Update for 2012.02 (2012-02-29 23:19:47 +0100)

are available in the git repository at:
git://git.free-electrons.com/users/maxime-ripard/buildroot.git for-2012.05/systemd

Maxime Ripard (6):
Change the /etc/mtab symlink to use an absolute path Add the systemd package
Enable cgroups in Linux if we use systemd Rework of the init system
Fix installation for the lighttpd package Add systemd unit for lighttpd

 fs/skeleton/etc/mtab                  |    2 +-
 linux/linux.mk                        |    2 +
 package/Config.in                     |    1 +
 package/Makefile.package.in           |    8 +
 package/dbus/dbus.mk                  |    4 +
 package/lighttpd/lighttpd.conf        |  445 +++++++++++++++++++++++++++++++++
 package/lighttpd/lighttpd.mk          |   44 ++++
 package/lighttpd/lighttpd.service     |   10 +
 package/systemd/Config.in             |   20 ++
 package/systemd/getty at .service        |   39 +++
 package/systemd/serial-getty at .service |   31 +++
 package/systemd/systemd.mk            |   69 +++++
 package/sysvinit/Config.in            |    1 +
 package/udev/udev.mk                  |    4 +
 target/generic/Config.in              |   22 ++
 15 files changed, 701 insertions(+), 1 deletions(-)
 create mode 100644 package/lighttpd/lighttpd.conf
 create mode 100644 package/lighttpd/lighttpd.service
 create mode 100644 package/systemd/Config.in
 create mode 100644 package/systemd/getty at .service
 create mode 100644 package/systemd/serial-getty at .service
 create mode 100644 package/systemd/systemd.mk

Thanks,

Signature · 1 line
Maxime Ripard
#1 lore raw

PATCH 1/6 Change the /etc/mtab symlink to use an absolute path

As systemd checks if /etc/mtab is a symlink to /proc/mount or /proc/self/mounts, we need to change it so that we can run systemd.

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

---
 fs/skeleton/etc/mtab |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
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
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 2/6 Add the systemd package

In reply to Maxime Ripard
---
 package/Config.in                     |    1 +
 package/dbus/dbus.mk                  |    4 ++
 package/systemd/Config.in             |   19 +++++++++
 package/systemd/getty at .service        |   39 ++++++++++++++++++
 package/systemd/serial-getty at .service |   31 +++++++++++++++
 package/systemd/systemd.mk            |   69 +++++++++++++++++++++++++++++++++
 package/udev/udev.mk                  |    4 ++
 7 files changed, 167 insertions(+), 0 deletions(-)
 create mode 100644 package/systemd/Config.in
 create mode 100644 package/systemd/getty at .service
 create mode 100644 package/systemd/serial-getty at .service
 create mode 100644 package/systemd/systemd.mk
package/Config.in +1 -0
index 8a7c9c4..c392e50 100644
@@ -571,6 +571,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..0942b33 100644
@@ -39,6 +39,10 @@ else
 DBUS_CONF_OPT += --without-x
 endif
 
+ifeq ($(BR2_PACKAGE_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 +19 -0
new file mode 100644
index 0000000..d87054d
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_SYSTEMD
+	bool "systemd"
+	depends on BR2_PACKAGE_UDEV
+	select 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
+
+comment "systemd not available (depends on udev and dbus)"
+	depends on !BR2_PACKAGE_UDEV || !BR2_PACKAGE_DBUS
package/systemd/getty at .service new file +39 -0
new file mode 100644
index 0000000..15b3453
@@ -0,0 +1,39 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Getty on %I
+BindTo=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
+
+# If additional gettys are spawned during boot then we should make
+# sure that this is synchronized before getty.target, even though
+# getty.target didn't actually pull it in.
+Before=getty.target
+
+[Service]
+Environment=TERM=linux
+ExecStart=-/sbin/getty -L %I 115200 vt100
+Restart=always
+RestartSec=0
+UtmpIdentifier=%I
+TTYPath=/dev/%I
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+KillMode=process
+
+# Unset locale for the console getty since the console has problems
+# displaying some internationalized messages.
+Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
+
+# Some login implementations ignore SIGTERM, so we send SIGHUP
+# instead, to ensure that login terminates cleanly.
+KillSignal=SIGHUP
+
+[Install]
+Alias=getty.target.wants/getty at tty1.service
package/systemd/serial-getty at .service new file +31 -0
new file mode 100644
index 0000000..e28ecdf
@@ -0,0 +1,31 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+
+[Unit]
+Description=Serial Getty on %I
+BindTo=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service
+
+# If additional gettys are spawned during boot then we should make
+# sure that this is synchronized before getty.target, even though
+# getty.target didn't actually pull it in.
+Before=getty.target
+
+[Service]
+Environment=TERM=vt100
+ExecStart=-/sbin/getty -L %I 115200 vt100
+Restart=always
+RestartSec=0
+UtmpIdentifier=%I
+TTYPath=/dev/%I
+TTYReset=yes
+TTYVHangup=yes
+KillMode=process
+
+# Some login implementations ignore SIGTERM, so we send SIGHUP
+# instead, to ensure that login terminates cleanly.
+KillSignal=SIGHUP
package/systemd/systemd.mk new file +69 -0

69 lines not on this page · raw message

package/udev/udev.mk +4 -0
index d445a2f..ed41511 100644
@@ -35,6 +35,10 @@ UDEV_CONF_OPT +=		\
 	--disable-gudev
 endif
 
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+	UDEV_CONF_OPT += --with-systemdsystemunitdir=/lib/systemd/system/
+endif
+
 define UDEV_INSTALL_INITSCRIPT
 	$(INSTALL) -m 0755 package/udev/S10udev $(TARGET_DIR)/etc/init.d/S10udev
 endef
Signature · 1 line
1.7.5.4
#9 lore raw

PATCH 3/6 Enable cgroups in Linux if we use systemd

In reply to Maxime Ripard
---
 linux/linux.mk |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
linux/linux.mk +2 -0
index ae236d4..52635fd 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_PACKAGE_SYSTEMD),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_CGROUPS,$(@D)/.config))
 endef
 
 # Compilation. We make sure the kernel gets rebuilt when the
Signature · 1 line
1.7.5.4
#10 lore raw

PATCH 4/6 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 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/Makefile.package.in |    8 ++++++++
 package/systemd/Config.in   |    1 +
 package/sysvinit/Config.in  |    1 +
 target/generic/Config.in    |   22 ++++++++++++++++++++++
 4 files changed, 32 insertions(+), 0 deletions(-)
package/Makefile.package.in +8 -0
index 33461b4..94ed7c6 100644
@@ -419,6 +419,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 $@
@@ -437,6 +441,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/systemd/Config.in +1 -0
index d87054d..dd08d0f 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_SYSTEMD
 	bool "systemd"
+	depends on BR2_INIT_SYSTEMD
 	depends on BR2_PACKAGE_UDEV
 	select 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
 
target/generic/Config.in +22 -0
index 88f0718..ed33e1a 100644
@@ -37,6 +37,28 @@ comment "udev requires a toolchain with LARGEFILE + WCHAR support"
 
 endchoice
 
+choice
+	prompt "Init system"
+	default BR2_INIT_BUSYBOX
+	help
+	  To select systemd, you first need to have dbus and udev enabled
+
+config BR2_INIT_BUSYBOX
+	bool "Busybox init"
+	select BR2_PACKAGE_BUSYBOX
+
+config BR2_INIT_SYSV
+	bool "Use systemV init"
+	select BR2_PACKAGE_SYSVINIT
+
+config BR2_INIT_SYSTEMD
+	bool "Use systemd"
+	select BR2_PACKAGE_DBUS
+	depends on BR2_PACKAGE_UDEV
+	select BR2_PACKAGE_SYSTEMD
+
+endchoice
+
 config BR2_ROOTFS_DEVICE_TABLE
 	string "Path to the permission tables"
 	default "target/generic/device_table.txt"
Signature · 1 line
1.7.5.4
#15 lore raw

PATCH 5/6 Fix installation for the lighttpd package

In reply to Maxime Ripard
---
 package/lighttpd/lighttpd.conf |  445 ++++++++++++++++++++++++++++++++++++++++
 package/lighttpd/lighttpd.mk   |   33 +++
 2 files changed, 478 insertions(+), 0 deletions(-)
 create mode 100644 package/lighttpd/lighttpd.conf
package/lighttpd/lighttpd.conf new file +445 -0
new file mode 100644
index 0000000..89be6f6
@@ -0,0 +1,445 @@
+#######################################################################
+##
+## /etc/lighttpd/lighttpd.conf
+##
+## check /etc/lighttpd/conf.d/*.conf for the configuration of modules.
+##
+#######################################################################
+
+#######################################################################
+##
+## Some Variable definition which will make chrooting easier.
+##
+## if you add a variable here. Add the corresponding variable in the
+## chroot example aswell.
+##
+var.log_root    = "/var/log/lighttpd"
+var.server_root = "/srv/www"
+var.state_dir   = "/var/run"
+var.home_dir    = "/var/lib/lighttpd"
+var.conf_dir    = "/etc/lighttpd"
+
+## 
+## run the server chrooted.
+## 
+## This requires root permissions during startup.
+##
+## If you run Chrooted set the the variables to directories relative to
+## the chroot dir.
+##
+## example chroot configuration:
+## 
+#var.log_root    = "/logs"
+#var.server_root = "/"
+#var.state_dir   = "/run"
+#var.home_dir    = "/lib/lighttpd"
+#var.vhosts_dir  = "/vhosts"
+#var.conf_dir    = "/etc"
+#
+#server.chroot   = "/srv/www"
+
+##
+## Some additional variables to make the configuration easier
+##
+
+##
+## Base directory for all virtual hosts
+##
+## used in:
+## conf.d/evhost.conf
+## conf.d/simple_vhost.conf
+## vhosts.d/vhosts.template
+##
+var.vhosts_dir  = server_root + "/vhosts"
+
+##
+## Cache for mod_compress
+##
+## used in:
+## conf.d/compress.conf
+##
+var.cache_dir   = "/var/cache/lighttpd"
+
+##
+## Base directory for sockets.
+##
+## used in:
+## conf.d/fastcgi.conf
+## conf.d/scgi.conf
+##
+var.socket_dir  = home_dir + "/sockets"
+
+##
+#######################################################################
+
+#######################################################################
+##
+## Load the modules.
+include "modules.conf"
+
+##
+#######################################################################
+
+#######################################################################
+##
+##  Basic Configuration
+## ---------------------
+##
+server.port = 80
+
+##
+## Use IPv6?
+##
+server.use-ipv6 = "disable"
+
+##
+## bind to a specific IP
+##
+#server.bind = "localhost"
+
+##
+## Run as a different username/groupname.
+## This requires root permissions during startup. 
+##
+server.username  = "root"
+server.groupname = "root"
+
+## 
+## enable core files.
+##
+#server.core-files = "disable"
+
+##
+## Document root
+##
+server.document-root = server_root + "/htdocs"
+
+##
+## The value for the "Server:" response field.
+##
+## It would be nice to keep it at "lighttpd".
+##
+#server.tag = "lighttpd"
+
+##
+## store a pid file
+##
+server.pid-file = state_dir + "/lighttpd.pid"
+
+##
+#######################################################################
+
+#######################################################################
+##
+##  Logging Options
+## ------------------
+##
+## all logging options can be overwritten per vhost.
+##
+## Path to the error log file
+##
+server.errorlog             = log_root + "/error.log"
+
+##
+## If you want to log to syslog you have to unset the 
+## server.errorlog setting and uncomment the next line.
+##
+#server.errorlog-use-syslog = "enable"
+
+##
+## Access log config
+## 
+include "conf.d/access_log.conf"
+
+##
+## The debug options are moved into their own file.
+## see conf.d/debug.conf for various options for request debugging.
+##
+include "conf.d/debug.conf"
+
+##
+#######################################################################
+
+#######################################################################
+##
+##  Tuning/Performance
+## --------------------
+##
+## corresponding documentation:
+## http://www.lighttpd.net/documentation/performance.html
+##
+## set the event-handler (read the performance section in the manual)
+##
+## possible options on linux are:
+##
+## select
+## poll
+## linux-sysepoll
+##
+## linux-sysepoll is recommended on kernel 2.6.
+##
+server.event-handler = "linux-sysepoll"
+
+##
+## The basic network interface for all platforms at the syscalls read()
+## and write(). Every modern OS provides its own syscall to help network
+## servers transfer files as fast as possible 
+##
+## linux-sendfile - is recommended for small files.
+## writev         - is recommended for sending many large files
+##
+server.network-backend = "linux-sendfile"
+
+##
+## As lighttpd is a single-threaded server, its main resource limit is
+## the number of file descriptors, which is set to 1024 by default (on
+## most systems).
+##
+## If you are running a high-traffic site you might want to increase this
+## limit by setting server.max-fds.
+##
+## Changing this setting requires root permissions on startup. see
+## server.username/server.groupname.
+##
+## By default lighttpd would not change the operation system default.
+## But setting it to 2048 is a better default for busy servers.
+##
+server.max-fds = 2048
+
+##
+## Stat() call caching.
+##
+## lighttpd can utilize FAM/Gamin to cache stat call.
+##
+## possible values are:
+## disable, simple or fam.
+##
+server.stat-cache-engine = "simple"
+
+##
+## Fine tuning for the request handling
+##
+## max-connections == max-fds/2 (maybe /3)
+## means the other file handles are used for fastcgi/files
+##
+server.max-connections = 1024
+
+##
+## How many seconds to keep a keep-alive connection open,
+## until we consider it idle. 
+##
+## Default: 5
+##
+#server.max-keep-alive-idle = 5
+
+##
+## How many keep-alive requests until closing the connection.
+##
+## Default: 16
+##
+#server.max-keep-alive-requests = 16
+
+##
+## Maximum size of a request in kilobytes.
+## By default it is unlimited (0).
+##
+## Uploads to your server cant be larger than this value.
+##
+#server.max-request-size = 0
+
+##
+## Time to read from a socket before we consider it idle.
+##
+## Default: 60
+##
+#server.max-read-idle = 60
+
+##
+## Time to write to a socket before we consider it idle.
+##
+## Default: 360
+##
+#server.max-write-idle = 360
+
+##
+##  Traffic Shaping 
+## -----------------
+##
+## see /usr/share/doc/lighttpd/traffic-shaping.txt
+##
+## Values are in kilobyte per second.
+##
+## Keep in mind that a limit below 32kB/s might actually limit the
+## traffic to 32kB/s. This is caused by the size of the TCP send
+## buffer. 
+##
+## per server:
+##
+#server.kbytes-per-second = 128
+
+##
+## per connection:
+##
+#connection.kbytes-per-second = 32
+
+##
+#######################################################################
+
+#######################################################################
+##
+##  Filename/File handling
+## ------------------------
+
+##
+## files to check for if .../ is requested
+## index-file.names            = ( "index.php", "index.rb", "index.html",
+##                                 "index.htm", "default.htm" )
+##
+index-file.names += (
+  "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
+)
+
+##
+## deny access the file-extensions
+##
+## ~    is for backupfiles from vi, emacs, joe, ...
+## .inc is often used for code includes which should in general not be part
+##      of the document-root
+url.access-deny             = ( "~", ".inc" )
+
+##
+## disable range requests for pdf files
+## workaround for a bug in the Acrobat Reader plugin.
+##
+#$HTTP["url"] =~ "\.pdf$" {
+#  server.range-requests = "disable"
+#}
+
+##
+## url handling modules (rewrite, redirect)
+##
+#url.rewrite                = ( "^/$"             => "/server-status" )
+#url.redirect               = ( "^/wishlist/(.+)" => "http://www.example.com/$1" )
+
+##
+## both rewrite/redirect support back reference to regex conditional using %n
+##
+#$HTTP["host"] =~ "^www\.(.*)" {
+#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
+#}
+
+##
+## which extensions should not be handle via static-file transfer
+##
+## .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
+##
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" )
+
+##
+## error-handler for status 404
+##
+#server.error-handler-404   = "/error-handler.html"
+#server.error-handler-404   = "/error-handler.php"
+
+##
+## Format: <errorfile-prefix><status-code>.html
+## -> ..../status-404.html for 'File not found'
+##
+#server.errorfile-prefix    = "/srv/www/htdocs/errors/status-"
+
+##
+## mimetype mapping
+##
+include "conf.d/mime.conf"
+
+##
+## directory listing configuration
+##
+include "conf.d/dirlisting.conf"
+
+##
+## Should lighttpd follow symlinks?
+## 
+server.follow-symlink = "enable"
+
+##
+## force all filenames to be lowercase?
+##
+#server.force-lowercase-filenames = "disable"
+
+##
+## defaults to /var/tmp as we assume it is a local harddisk
+##
+server.upload-dirs = ( "/var/tmp" )
+
+##
+#######################################################################
+
+
+#######################################################################
+##
+##  SSL Support
+## ------------- 
+##
+## To enable SSL for the whole server you have to provide a valid
+## certificate and have to enable the SSL engine.::
+##
+##   ssl.engine = "enable"
+##   ssl.pemfile = "/path/to/server.pem"
+##
+## The HTTPS protocol does not allow you to use name-based virtual
+## hosting with SSL. If you want to run multiple SSL servers with
+## one lighttpd instance you must use IP-based virtual hosting: ::
+##
+##   $SERVER["socket"] == "10.0.0.1:443" {
+##     ssl.engine                  = "enable"
+##     ssl.pemfile                 = "/etc/ssl/private/www.example.com.pem"
+##     #
+##     # Mitigate BEAST attack:
+##     #
+##     # A stricter base cipher suite. For details see:
+##     # http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html
+##     #
+##     ssl.cipher-list             = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"
+##     #
+##     # Make the server prefer the order of the server side cipher suite instead of the client suite.
+##     # This is necessary to mitigate the BEAST attack (unless you disable all non RC4 algorithms).
+##     # This option is enabled by default, but only used if ssl.cipher-list is set.
+##     #
+##     # ssl.honor-cipher-order = "enable"
+##     #
+##     # Mitigate CVE-2009-3555 by disabling client triggered renegotation
+##     # This is enabled by default.
+##     #
+##     # ssl.disable-client-renegotiation = "enable"
+##     #
+##     server.name                 = "www.example.com"
+##
+##     server.document-root        = "/srv/www/vhosts/example.com/www/"
+##   }
+##
+
+## If you have a .crt and a .key file, cat them together into a
+## single PEM file:
+## $ cat /etc/ssl/private/lighttpd.key /etc/ssl/certs/lighttpd.crt \
+##   > /etc/ssl/private/lighttpd.pem
+##
+#ssl.pemfile = "/etc/ssl/private/lighttpd.pem"
+
+##
+## optionally pass the CA certificate here.
+##
+##
+#ssl.ca-file = ""
+
+##
+#######################################################################
+
+#######################################################################
+##
+## custom includes like vhosts.
+##
+#include "conf.d/config.conf"
+#include_shell "cat /etc/lighttpd/vhosts.d/*.conf"
+##
+#######################################################################
package/lighttpd/lighttpd.mk +33 -0
index b8aa310..58617a6 100644
@@ -56,6 +56,39 @@ else
 LIGHTTPD_CONF_OPT += --without-lua
 endif
 
+define LIGHTTPD_INSTALL_CONFIG
+mkdir -p $(TARGET_DIR)/etc/lighttpd
+mkdir -p $(TARGET_DIR)/etc/lighttpd/conf.d
+mkdir -p $(TARGET_DIR)/var/log/lighttpd
+mkdir -p $(TARGET_DIR)/srv/www/htdocs
+
+[ -f $(TARGET_DIR)/etc/lighttpd/lighttpd.conf ] || \
+	$(INSTALL) -D -m 755 package/lighttpd/lighttpd.conf \
+		$(TARGET_DIR)/etc/lighttpd/lighttpd.conf
+
+[ -f $(TARGET_DIR)/etc/lighttpd/modules.conf ] || \
+	$(INSTALL) -D -m 755 $(@D)/doc/config/modules.conf \
+		$(TARGET_DIR)/etc/lighttpd/modules.conf
+
+[ -f $(TARGET_DIR)/etc/lighttpd/conf.d/access_log.conf ] || \
+	$(INSTALL) -D -m 755 $(@D)/doc/config/conf.d/access_log.conf \
+		$(TARGET_DIR)/etc/lighttpd/conf.d/access_log.conf
+
+[ -f $(TARGET_DIR)/etc/lighttpd/conf.d/debug.conf ] || \
+	$(INSTALL) -D -m 755 $(@D)/doc/config/conf.d/debug.conf \
+		$(TARGET_DIR)/etc/lighttpd/conf.d/debug.conf
+
+[ -f $(TARGET_DIR)/etc/lighttpd/conf.d/dirlisting.conf ] || \
+	$(INSTALL) -D -m 755 $(@D)/doc/config/conf.d/dirlisting.conf \
+		$(TARGET_DIR)/etc/lighttpd/conf.d/dirlisting.conf
+
+[ -f $(TARGET_DIR)/etc/lighttpd/conf.d/mime.conf ] || \
+	$(INSTALL) -D -m 755 $(@D)/doc/config/conf.d/mime.conf \
+		$(TARGET_DIR)/etc/lighttpd/conf.d/mime.conf
+endef
+
+LIGHTTPD_POST_INSTALL_TARGET_HOOKS += LIGHTTPD_INSTALL_CONFIG
+
 define LIGHTTPD_UNINSTALL_TARGET_CMDS
 	rm -f $(TARGET_DIR)/usr/sbin/lighttpd
 	rm -f $(TARGET_DIR)/usr/sbin/lighttpd-angel
Signature · 1 line
1.7.5.4
#19 lore raw

PATCH 6/6 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(+), 0 deletions(-)
 create mode 100644 package/lighttpd/lighttpd.service
package/lighttpd/lighttpd.mk +11 -0
index 58617a6..966b787 100644
@@ -89,6 +89,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.5.4
#2 lore raw

PATCH 1/6 Change the /etc/mtab symlink to use an absolute path

In reply to Maxime Ripard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxime" == Maxime Ripard <[email protected]> writes:

Maxime> As systemd checks if /etc/mtab is a symlink to /proc/mount or Maxime> /proc/self/mounts, we need to change it so that we can run systemd.

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

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 2/6 Add the systemd package

In reply to Maxime Ripard

On Monday 19 March 2012 16:59:36 Maxime Ripard wrote:
[snip]

Quoted 10 lines
package/systemd/Config.in new file +4 -0
new file mode 100644
index 0000000..d87054d
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_SYSTEMD
+	bool "systemd"
+	depends on BR2_PACKAGE_UDEV
+	select BR2_PACKAGE_DBUS

package/systemd/Config.in line 14

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

Trailing whitespace.

package/systemd/Config.in line 19

Quoted 5 lines
package/systemd/Config.in new file +5 -0
+
+	  http://freedesktop.org/wiki/Software/systemd
+
+comment "systemd not available (depends on udev and dbus)"
+	depends on !BR2_PACKAGE_UDEV || !BR2_PACKAGE_DBUS

DBUS is a 'select' depedency, not a 'depends on', so it shouldn't be in
the depends on of the comment.

Quoted 1 line
package/systemd/getty at .service +0 -0

[snip]

package/systemd/serial-getty at .service

Quoted 1 line
package/systemd/serial-getty at .service +0 -0

AFAICS the only difference between these two files and the upstream
version is that it's getty instead of agetty. Wouldn't it be simpler and more future-safe to patch the upstream files?

Quoted 5 lines
package/systemd/systemd.mk new file +0 -0
new file mode 100644
index 0000000..a20ddf4

[snip]

Quoted 1 line

+# Build after Busybox

Why? (I know why, but it should be in the comment)

Quoted 3 lines
package/systemd/systemd.mk new file +3 -0
+ifeq ($(BR2_PACKAGE_BUSYBOX),y)
+	SYSTEMD_DEPENDENCIES += busybox
+endif

[snip]

package/systemd/systemd.mk line 49

Quoted 7 lines
package/systemd/systemd.mk new file +7 -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
+
+	mkdir -p $(TARGET_DIR)/run

In the current skeleton, /run is a symlink to /tmp. For a
user-defined skeleton, I would say that it's up to the user to make sure a valid /run exists.

package/systemd/systemd.mk line 62

Quoted 13 lines
package/systemd/systemd.mk new file +13 -0
+
+	ln -fs ../../../lib/systemd/system/multi-user.target $(TARGET_DIR)/etc/systemd/system/default.target
+endef
+
+define SYSTEMD_INSTALL_TTY_HOOK
+	rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
+	[ -f $(TARGET_DIR)/etc/systemd/system/getty at .service ] || \
+		$(INSTALL) -D package/systemd/getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
+	[ -f $(TARGET_DIR)/etc/systemd/system/serial-getty at .service ] || \
+		$(INSTALL) -D package/systemd/serial-getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
+	ln -fs ../serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service

This looks strange to me. Admittedly, I've never used systemd and
don't really know how it works. But to me, this looks like the getty at .service is actually not used.

package/systemd/systemd.mk line 69

Quoted 7 lines
package/systemd/systemd.mk new file +7 -0
+endef
+
+SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
+	SYSTEMD_INSTALL_INIT_HOOK \
+	SYSTEMD_INSTALL_TTY_HOOK \
+
+$(eval $(call AUTOTARGETS))

[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 4/6 Rework of the init system

In reply to Maxime Ripard

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

Quoted 5 lines · On Monday 19 March 2012 16:59:38 Maxime Ripard wrote:
target/generic/Config.in +5 -0
+choice
+       prompt "Init system"
+       default BR2_INIT_BUSYBOX
+       help
+         To select systemd, you first need to have dbus and udev enabled

Only udev. Anyway, the help text of a choice is never shown, so
this won't work. I don't know if it's possible to add comments in a choice, but that would be the way to go.

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

Quoted 13 lines
target/generic/Config.in +13 -0
+
+config BR2_INIT_BUSYBOX
+       bool "Busybox init"
+       select BR2_PACKAGE_BUSYBOX
+
+config BR2_INIT_SYSV
+       bool "Use systemV init"
+       select BR2_PACKAGE_SYSVINIT
+
+config BR2_INIT_SYSTEMD
+       bool "Use systemd"
+       select BR2_PACKAGE_DBUS
+       depends on BR2_PACKAGE_UDEV

Would it be an option to make this a select
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV instead? (With a depends on LARGEFILE and WCHAR, of course.) Or is that a bad idea?

Quoted 1 line

+ select BR2_PACKAGE_SYSTEMD

The latter two selects are only possible if
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is selected. The select/depends combination breaks the dependency of BR2_PACKAGE_SYSVINIT and BR2_PACKAGE_SYSTEMD on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS. So the systemd package will be selected, but it's not visible to the user.

Of course, there's nothing strictly wrong with that. It's just
a bit strange.

Clearly, adding a select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS here is
a bad idea. I also don't like much to add a dependency on it either. So instead, I propose to move sysvinit and systemd out of the BR2_PACKAGE_BUSYBOX_SHOW_OTHERS condition (in package/Config.in). They anyway can't be selected or deselected by the user, since their selection is fully determined by the BR2_INIT_* option.

Quoted 2 lines
(quoted diff) +2 -0
+
+endchoice
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
#16 lore raw

PATCH 5/6 Fix installation for the lighttpd package

In reply to Maxime Ripard
Quoted 1 line · On Monday 19 March 2012 16:59:39 Maxime Ripard wrote:
 package/lighttpd/lighttpd.conf |  445 ++++++++++++++++++++++++++++++++++++++++

Same remark as for systemd: wouldn't it be better to patch the upstream
file instead of copying it? Also, why did you revert the disabling of range requests for pdf documents?

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

PATCH 6/6 Add systemd unit for lighttpd

In reply to Maxime Ripard

package/lighttpd/lighttpd.mk endef · line 101

Quoted 10 lines · On Monday 19 March 2012 16:59:40 Maxime Ripard wrote:
package/lighttpd/lighttpd.mk +10 -0
+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

This should be indented, no?

Would it be useful to add this to generic package infrastructure?
I mean, if systemd is selected and pkgdir/pkgname.service exists, install it and enable it in multi-user.

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 2/6 Add the systemd package

In reply to Arnout Vandecappelle

Hello Arnout,

Le 20/03/2012 00:32, Arnout Vandecappelle a ?crit :

Quoted 15 lines · On Monday 19 March 2012 16:59:36 Maxime Ripard wrote:

[snip]

Quoted 13 lines
package/systemd/Config.in new file +7 -0
new file mode 100644
index 0000000..d87054d
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_SYSTEMD
+	bool "systemd"
+	depends on BR2_PACKAGE_UDEV
+	select BR2_PACKAGE_DBUS
+	select BR2_PACKAGE_LIBCAP
+	help
+	  systemd is a system and service manager for Linux, compatible with
Quoted 8 lines

package/systemd/Config.in line 14

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

Trailing whitespace.

Oops...

Quoted 8 lines

package/systemd/Config.in line 19

Quoted 5 lines
package/systemd/Config.in new file +5 -0
+
+	  http://freedesktop.org/wiki/Software/systemd
+
+comment "systemd not available (depends on udev and dbus)"
+	depends on !BR2_PACKAGE_UDEV || !BR2_PACKAGE_DBUS

DBUS is a 'select' depedency, not a 'depends on', so it shouldn't be in
the depends on of the comment.

Right

Quoted 7 lines
Quoted 1 line
package/systemd/getty at .service +0 -0

[snip]

package/systemd/serial-getty at .service

Quoted 1 line
package/systemd/serial-getty at .service +0 -0

AFAICS the only difference between these two files and the upstream
version is that it's getty instead of agetty. Wouldn't it be simpler and more future-safe to patch the upstream files?

Probably. I'll send a patch and see how it turns out.
In the meantime, maybe I can just put a patch here instead of the whole file.

Quoted 8 lines
Quoted 5 lines
package/systemd/systemd.mk new file +0 -0
new file mode 100644
index 0000000..a20ddf4

[snip]

Quoted 1 line

+# Build after Busybox

Why? (I know why, but it should be in the comment)

ACK

Quoted 4 lines
Quoted 3 lines
package/systemd/systemd.mk new file +3 -0
+ifeq ($(BR2_PACKAGE_BUSYBOX),y)
+	SYSTEMD_DEPENDENCIES += busybox
+endif

[snip]

Quoted 10 lines

package/systemd/systemd.mk line 49

Quoted 7 lines
package/systemd/systemd.mk new file +7 -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
+
+	mkdir -p $(TARGET_DIR)/run

In the current skeleton, /run is a symlink to /tmp. For a
user-defined skeleton, I would say that it's up to the user to make sure a valid /run exists.

Yes, of course.

Quoted 9 lines
Quoted 9 lines
package/systemd/systemd.mk new file +9 -0
+
+	ln -fs ../../../lib/systemd/system/multi-user.target $(TARGET_DIR)/etc/systemd/system/default.target
+endef
+
+define SYSTEMD_INSTALL_TTY_HOOK
+	rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
+	[ -f $(TARGET_DIR)/etc/systemd/system/getty at .service ] || \
+		$(INSTALL) -D package/systemd/getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
Quoted 8 lines

package/systemd/systemd.mk line 62

Quoted 4 lines
package/systemd/systemd.mk new file +4 -0
+	[ -f $(TARGET_DIR)/etc/systemd/system/serial-getty at .service ] || \
+		$(INSTALL) -D package/systemd/serial-getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
+	ln -fs ../serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service

This looks strange to me. Admittedly, I've never used systemd and
don't really know how it works. But to me, this looks like the getty at .service is actually not used.

Well, actually, this symlink with weird names is used as the way to pass units some arguments.

If you look into the serial-getty at .service file, you will see at some point some %i or %I. These expands to what is between the @ and the .service in the filename. If we were to have serial-getty at ttyS2.service, it would expand to "ttyS2", and the unit would have the start command "/sbin/getty -L ttyS2 115200 vt100".

The symlinks are here only to avoid copying the same file over and over again.

Quoted 9 lines
Quoted 7 lines
package/systemd/systemd.mk new file +7 -0
+endef
+
+SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
+	SYSTEMD_INSTALL_INIT_HOOK \
+	SYSTEMD_INSTALL_TTY_HOOK \
+
+$(eval $(call AUTOTARGETS))

[snip]

Quoted 3 lines

Regards,
Arnout

Thanks,
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/6 Add the systemd package

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxime" == Maxime Ripard <[email protected]> writes:

Hi,

Maxime> Probably. I'll send a patch and see how it turns out. Maxime> In the meantime, maybe I can just put a patch here instead of Maxime> the whole file.

Or just run sed s/agetty/getty/g when you copy it to TARGET_DIR.

I'm trying to get systemd to build under uClibc, which so far meant I had to bump the default to 0.9.33 (for new CLONE_* flags) and enable utmpx support. Systemd also needs IPv6 support so needs to have a

depends on BR2_INET_IPV6

Line.

I'm still rebuilding my toolchain at the moment, but if you could resend the patch with those fixes in the near future, that would be great.

Signature · 1 line
Bye, Peter Korsgaard
#12 lore raw

PATCH 4/6 Rework of the init system

In reply to Arnout Vandecappelle

Le 20/03/2012 00:45, Arnout Vandecappelle a ?crit :

Quoted 9 lines · On Monday 19 March 2012 16:59:38 Maxime Ripard wrote:

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

Quoted 5 lines
target/generic/Config.in +5 -0
+choice
+       prompt "Init system"
+       default BR2_INIT_BUSYBOX
+       help
+         To select systemd, you first need to have dbus and udev enabled

Only udev. Anyway, the help text of a choice is never shown, so
this won't work. I don't know if it's possible to add comments in a choice, but that would be the way to go.

Ah. I didn't know that.

Quoted 8 lines
Quoted 8 lines
target/generic/Config.in +8 -0
+
+config BR2_INIT_BUSYBOX
+       bool "Busybox init"
+       select BR2_PACKAGE_BUSYBOX
+
+config BR2_INIT_SYSV
+       bool "Use systemV init"
+       select BR2_PACKAGE_SYSVINIT
Quoted 8 lines

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

Quoted 5 lines
target/generic/Config.in +5 -0
+
+config BR2_INIT_SYSTEMD
+       bool "Use systemd"
+       select BR2_PACKAGE_DBUS
+       depends on BR2_PACKAGE_UDEV

Would it be an option to make this a select
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV instead? (With a depends on LARGEFILE and WCHAR, of course.) Or is that a bad idea?

Well, while the select on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV is indeed a good idea, like you said, we are still to depends on WCHAR and LARGEFILE support. So from the user point of view, we are still left without an option, and no way of getting how to select it (and we definitely don't want to select LARGEFILE and WCHAR)

Peter, do you have an idea about that ?

Quoted 12 lines
Quoted 2 lines

+ select BR2_PACKAGE_SYSTEMD

The latter two selects are only possible if
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is selected. The select/depends combination breaks the dependency of BR2_PACKAGE_SYSVINIT and BR2_PACKAGE_SYSTEMD on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS. So the systemd package will be selected, but it's not visible to the user.

Of course, there's nothing strictly wrong with that. It's just
a bit strange.

Quoted 6 lines

Clearly, adding a select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS here is
a bad idea. I also don't like much to add a dependency on it either. So instead, I propose to move sysvinit and systemd out of the BR2_PACKAGE_BUSYBOX_SHOW_OTHERS condition (in package/Config.in). They anyway can't be selected or deselected by the user, since their selection is fully determined by the BR2_INIT_* option.

I agree here.
Peter, are you ok with this change ?

Thanks,
Maxime

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

PATCH 4/6 Rework of the init system

In reply to Arnout Vandecappelle
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 5 lines · Arnout> On Monday 19 March 2012 16:59:38 Maxime Ripard wrote:

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

Quoted 5 lines
target/generic/Config.in +5 -0
+choice
+       prompt "Init system"
+       default BR2_INIT_BUSYBOX
+       help
+         To select systemd, you first need to have dbus and udev enabled

Arnout> Only udev. Anyway, the help text of a choice is never shown, so Arnout> this won't work. I don't know if it's possible to add comments in a Arnout> choice, but that would be the way to go.

It is (it didn't used to be, but I fixed it a while ago). We have an example in the ARM subarch selection for Cortex A8/A9.

Quoted 5 lines
Quoted 5 lines
target/generic/Config.in +5 -0
+
+config BR2_INIT_BUSYBOX
+       bool "Busybox init"
+       select BR2_PACKAGE_BUSYBOX
+
Quoted 8 lines

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

Quoted 8 lines
target/generic/Config.in +8 -0
+config BR2_INIT_SYSV
+       bool "Use systemV init"
+       select BR2_PACKAGE_SYSVINIT
+
+config BR2_INIT_SYSTEMD
+       bool "Use systemd"
+       select BR2_PACKAGE_DBUS
+       depends on BR2_PACKAGE_UDEV

Arnout> Would it be an option to make this a select
Arnout> BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV instead? (With a depends Arnout> on LARGEFILE and WCHAR, of course.) Or is that a bad idea?

The option should depend on LARGEFILE/WCHAR/IPV6 and then indeed select BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV. If those deps are not available a comment should be shown, similar to how we do it for BR2_PACKAGE_XSERVER_xorg.

Arnout> The latter two selects are only possible if
Arnout> BR2_PACKAGE_BUSYBOX_SHOW_OTHERS is selected. The select/depends Arnout> combination breaks the dependency of BR2_PACKAGE_SYSVINIT and Arnout> BR2_PACKAGE_SYSTEMD on BR2_PACKAGE_BUSYBOX_SHOW_OTHERS. So the Arnout> systemd package will be selected, but it's not visible to the user.

Arnout> Of course, there's nothing strictly wrong with that. It's just Arnout> a bit strange.

I think stating that busybox has an alternative for systemd is stretching the BUSYBOX_SHOW_OTHERS notion a bit. Perhaps we should just move systemd outside the conditional?

Arnout> Clearly, adding a select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS here Arnout> is a bad idea. I also don't like much to add a dependency on Arnout> it either. So instead, I propose to move sysvinit and systemd Arnout> out of the BR2_PACKAGE_BUSYBOX_SHOW_OTHERS condition (in Arnout> package/Config.in).

.. Like you suggest here ;)

Signature · 1 line
Bye, Peter Korsgaard
#13 lore raw

PATCH 4/6 Rework of the init system

In reply to Maxime Ripard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxime" == Maxime Ripard <[email protected]> writes:

Hi,

Maxime> Well, while the select on BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV is Maxime> indeed a good idea, like you said, we are still to depends on WCHAR and Maxime> LARGEFILE support. So from the user point of view, we are still left Maxime> without an option, and no way of getting how to select it (and we Maxime> definitely don't want to select LARGEFILE and WCHAR)

Maxime> Peter, do you have an idea about that ?

Just add a comment like we do for BR2_PACKAGE_XSERVER_xorg

Quoted 6 lines
Quoted 6 lines

Clearly, adding a select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS here is a bad idea. I also don't like much to add a dependency on it either. So instead, I propose to move sysvinit and systemd out of the BR2_PACKAGE_BUSYBOX_SHOW_OTHERS condition (in package/Config.in). They anyway can't be selected or deselected by the user, since their selection is fully determined by the BR2_INIT_* option.

Maxime> I agree here.
Maxime> Peter, are you ok with this change ?

Yes.

Signature · 1 line
Bye, Peter Korsgaard
#17 lore raw

PATCH 5/6 Fix installation for the lighttpd package

In reply to Arnout Vandecappelle

Le 20/03/2012 00:51, Arnout Vandecappelle a ?crit :

Quoted 6 lines · On Monday 19 March 2012 16:59:39 Maxime Ripard wrote:
Quoted 1 line
 package/lighttpd/lighttpd.conf |  445 ++++++++++++++++++++++++++++++++++++++++

Same remark as for systemd: wouldn't it be better to patch the upstream
file instead of copying it? Also, why did you revert the disabling of range requests for pdf documents?

Well, here, the default values are sensible.
I mean, for a default configuration file, it is a normal behaviour for a modern webserver to start it with its own UID/GID and to enable ipv6. I don't see why they would accept a patch that disable these.

For PDF ranges option, it relies on a regex, and we don't always compile with pcre, so I turned it down. Moreover, it's to fix a broken behaviour of Adobe Acrobat's plugin that don't display the correct file size from what I can understand, so nothing really critical here.

Here, same thing, maybe a patch against the source would be more convenient and lightweight for us, I don't know.

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

PATCH 5/6 Fix installation for the lighttpd package

Quoted 4 lines · On Tuesday 20 March 2012 10:42:36 Maxime Ripard wrote:

Le 20/03/2012 00:51, Arnout Vandecappelle a ?crit :

Quoted 3 lines · On Monday 19 March 2012 16:59:39 Maxime Ripard wrote:
Quoted 1 line
 package/lighttpd/lighttpd.conf |  445 ++++++++++++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 3 lines

Same remark as for systemd: wouldn't it be better to patch the upstream
file instead of copying it? Also, why did you revert the disabling of range requests for pdf documents?

Well, here, the default values are sensible.
I mean, for a default configuration file, it is a normal behaviour for a modern webserver to start it with its own UID/GID and to enable ipv6. I don't see why they would accept a patch that disable these.

With 'patching the upstream file' I mean adding a patch to buildroot
that modifies the upstream source file. Although I like Peter's suggestion to fixup the files with SED as well. But for this one, that would be difficult.

Quoted 2 lines

For PDF ranges option, it relies on a regex, and we don't always compile with pcre, so I turned it down.

That's a good reason.

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

PATCH 2/6 Add the systemd package

In reply to Maxime Ripard

On Tuesday 20 March 2012 09:35:55 Maxime Ripard wrote:
[snip]

Quoted 11 lines
Quoted 7 lines
Quoted 1 line
package/systemd/getty at .service +0 -0

[snip]

package/systemd/serial-getty at .service

Quoted 1 line
package/systemd/serial-getty at .service +0 -0

AFAICS the only difference between these two files and the upstream
version is that it's getty instead of agetty. Wouldn't it be simpler and more future-safe to patch the upstream files?

Probably. I'll send a patch and see how it turns out.
In the meantime, maybe I can just put a patch here instead of the whole file.

That's what I meant. I doubt that upstream would accept a patch that
removes agetty. Maybe a patch that makes it configurable in the m4 file, but that's a lot more work to cook.

BTW, I just noticed now that the 'normal' service definition files
are installed in /lib/systemd/system rather than /etc/systemd/system.

[snip]

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
package/systemd/serial-getty at .service +5 -0
+define SYSTEMD_INSTALL_TTY_HOOK
+	rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
+	[ -f $(TARGET_DIR)/etc/systemd/system/getty at .service ] || \
+		$(INSTALL) -D package/systemd/getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
Quoted 8 lines

package/systemd/serial-getty at .service

Quoted 4 lines
package/systemd/serial-getty at .service +4 -0
+	[ -f $(TARGET_DIR)/etc/systemd/system/serial-getty at .service ] || \
+		$(INSTALL) -D package/systemd/serial-getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
+	ln -fs ../serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service

This looks strange to me. Admittedly, I've never used systemd and
don't really know how it works. But to me, this looks like the getty at .service is actually not used.

Quoted 2 lines

Well, actually, this symlink with weird names is used as the way to pass units some arguments.

That much I know :-)

My point is: the getty at tty1.service file is removed. Therefore, there
is nobody using the getty at .service generic definition. At least that's my understanding of how systemd works. So why install the getty at .service file?

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

PATCH 6/6 Add systemd unit for lighttpd

In reply to Arnout Vandecappelle

Le 20/03/2012 00:55, Arnout Vandecappelle a ?crit :

Quoted 14 lines · On Monday 19 March 2012 16:59:40 Maxime Ripard wrote:

package/lighttpd/lighttpd.mk endef · line 101

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

This should be indented, no?

Quoted 3 lines

Would it be useful to add this to generic package infrastructure?
I mean, if systemd is selected and pkgdir/pkgname.service exists, install it and enable it in multi-user.

I thought so at first, and in my first proposal, that was indeed the case, but fact is that not every package doesn't want to be in multi-user targets, but some will want to be in the sockets one, other in network, etc.

So that's the reason I only added callbacks and let it up to the package to install its units where they should be.

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

PATCH 2/6 Add the systemd package

In reply to Arnout Vandecappelle

Le 20/03/2012 19:19, Arnout Vandecappelle a ?crit :

Quoted 39 lines · On Tuesday 20 March 2012 09:35:55 Maxime Ripard wrote:

[snip]

Quoted 11 lines
Quoted 7 lines
Quoted 1 line
package/systemd/getty at .service +0 -0

[snip]

package/systemd/serial-getty at .service

Quoted 1 line
package/systemd/serial-getty at .service +0 -0

AFAICS the only difference between these two files and the upstream
version is that it's getty instead of agetty. Wouldn't it be simpler and more future-safe to patch the upstream files?

Probably. I'll send a patch and see how it turns out.
In the meantime, maybe I can just put a patch here instead of the whole file.

That's what I meant. I doubt that upstream would accept a patch that
removes agetty. Maybe a patch that makes it configurable in the m4 file, but that's a lot more work to cook.

BTW, I just noticed now that the 'normal' service definition files
are installed in /lib/systemd/system rather than /etc/systemd/system.

[snip]

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
package/systemd/serial-getty at .service +5 -0
+define SYSTEMD_INSTALL_TTY_HOOK
+	rm -f $(TARGET_DIR)/etc/systemd/system/getty.target.wants/getty at tty1.service
+	[ -f $(TARGET_DIR)/etc/systemd/system/getty at .service ] || \
+		$(INSTALL) -D package/systemd/getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
Quoted 8 lines

package/systemd/serial-getty at .service

Quoted 4 lines
package/systemd/serial-getty at .service +4 -0
+	[ -f $(TARGET_DIR)/etc/systemd/system/serial-getty at .service ] || \
+		$(INSTALL) -D package/systemd/serial-getty at .service \
+			$(TARGET_DIR)/etc/systemd/system/
+	ln -fs ../serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service

This looks strange to me. Admittedly, I've never used systemd and
don't really know how it works. But to me, this looks like the getty at .service is actually not used.

Quoted 2 lines

Well, actually, this symlink with weird names is used as the way to pass units some arguments.

Quoted 6 lines

That much I know :-)

My point is: the getty at tty1.service file is removed. Therefore, there
is nobody using the getty at .service generic definition. At least that's my understanding of how systemd works. So why install the getty at .service file?

Aaah. I see your point now. Sorry I went a bit off-topic :) You're right, of course, I'll remove it.

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