* [Buildroot] [PATCH 1/3] Rework of the init system
2012-07-28 7:21 [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
@ 2012-07-28 7:21 ` Maxime Ripard
2012-07-28 7:21 ` [Buildroot] [PATCH 2/3] Add systemd unit for lighttpd Maxime Ripard
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2012-07-28 7:21 UTC (permalink / raw)
To: buildroot
Since we have now two uncompatible init systems, and we want only one of
them at the same time in 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.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
package/busybox/busybox.mk | 7 +++++++
package/pkg-generic.mk | 8 ++++++++
target/generic/Config.in | 25 +++++++++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index 394a1ae..17ee50a 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -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
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index d1f4f2a..68d23ba 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -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:
diff --git a/target/generic/Config.in b/target/generic/Config.in
index 88f0718..309ef55 100644
--- a/target/generic/Config.in
+++ b/target/generic/Config.in
@@ -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"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 2/3] Add systemd unit for lighttpd
2012-07-28 7:21 [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
2012-07-28 7:21 ` [Buildroot] [PATCH 1/3] Rework of the init system Maxime Ripard
@ 2012-07-28 7:21 ` Maxime Ripard
2012-07-28 7:21 ` [Buildroot] [PATCH 3/3] doc: Update the documentation to mention the new PKG_INSTALL_INIT_ variables Maxime Ripard
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2012-07-28 7:21 UTC (permalink / raw)
To: buildroot
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
package/lighttpd/lighttpd.mk | 13 +++++++++++--
package/lighttpd/lighttpd.service | 10 ++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
create mode 100644 package/lighttpd/lighttpd.service
diff --git a/package/lighttpd/lighttpd.mk b/package/lighttpd/lighttpd.mk
index 9f554cb..c9decb1 100644
--- a/package/lighttpd/lighttpd.mk
+++ b/package/lighttpd/lighttpd.mk
@@ -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
diff --git a/package/lighttpd/lighttpd.service b/package/lighttpd/lighttpd.service
new file mode 100644
index 0000000..0ca5357
--- /dev/null
+++ b/package/lighttpd/lighttpd.service
@@ -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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 11+ messages in thread* [Buildroot] [PATCH 3/3] doc: Update the documentation to mention the new PKG_INSTALL_INIT_ variables
2012-07-28 7:21 [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
2012-07-28 7:21 ` [Buildroot] [PATCH 1/3] Rework of the init system Maxime Ripard
2012-07-28 7:21 ` [Buildroot] [PATCH 2/3] Add systemd unit for lighttpd Maxime Ripard
@ 2012-07-28 7:21 ` Maxime Ripard
2012-07-28 7:30 ` [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
2012-07-30 21:21 ` Thomas Petazzoni
4 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2012-07-28 7:21 UTC (permalink / raw)
To: buildroot
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
docs/manual/adding-packages-generic.txt | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/docs/manual/adding-packages-generic.txt b/docs/manual/adding-packages-generic.txt
index d264f40..d3a4abb 100644
--- a/docs/manual/adding-packages-generic.txt
+++ b/docs/manual/adding-packages-generic.txt
@@ -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:
----------------------
--
1.7.9.5
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [pull request] Pull request for branch for-2012.08/systemd
2012-07-28 7:21 [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
` (2 preceding siblings ...)
2012-07-28 7:21 ` [Buildroot] [PATCH 3/3] doc: Update the documentation to mention the new PKG_INSTALL_INIT_ variables Maxime Ripard
@ 2012-07-28 7:30 ` Maxime Ripard
2012-07-30 21:21 ` Thomas Petazzoni
4 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2012-07-28 7:30 UTC (permalink / raw)
To: buildroot
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 :
> 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,
>
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread* [Buildroot] [pull request] Pull request for branch for-2012.08/systemd
2012-07-28 7:21 [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
` (3 preceding siblings ...)
2012-07-28 7:30 ` [Buildroot] [pull request] Pull request for branch for-2012.08/systemd Maxime Ripard
@ 2012-07-30 21:21 ` Thomas Petazzoni
2012-08-01 9:18 ` Maxime Ripard
4 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2012-07-30 21:21 UTC (permalink / raw)
To: buildroot
Le Sat, 28 Jul 2012 09:21:19 +0200,
Maxime Ripard <maxime.ripard@free-electrons.com> a ?crit :
> 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
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
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread* [Buildroot] [pull request] Pull request for branch for-2012.08/systemd
2012-07-30 21:21 ` Thomas Petazzoni
@ 2012-08-01 9:18 ` Maxime Ripard
0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2012-08-01 9:18 UTC (permalink / raw)
To: buildroot
Hi,
Le 30/07/2012 23:21, Thomas Petazzoni a ?crit :
> Le Sat, 28 Jul 2012 09:21:19 +0200,
> Maxime Ripard <maxime.ripard@free-electrons.com> a ?crit :
>
>> 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
>
> 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!
> 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.
> 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.
> 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
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [pull request] Pull request for branch for-2012.08/systemd
2012-08-06 15:14 Dmitry Golubovsky
@ 2012-08-09 9:45 ` Thomas Petazzoni
2012-08-09 14:29 ` Dmitry Golubovsky
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni @ 2012-08-09 9:45 UTC (permalink / raw)
To: buildroot
Hello Dmitry,
Le Mon, 6 Aug 2012 11:14:50 -0400,
Dmitry Golubovsky <golubovsky@gmail.com> a ?crit :
> While still a bit away from this project (and will resume work on
> patches for linux-pam as soon as I can), I think I can also contribute
> into the systemd discussion:
>
> Thomas Petazzoni wrote:
>
> > 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.
>
> My latest systemd patches are for version 186 (don't worry about 185
> in patches themselves: this part of the path is discarded anyway - and
> now there is 187). See here:
>
> https://gitorious.org/lfa/myroot/trees/master/systemd-pam
>
> Code layout changed considerably in this new version series (185 and
> up).
This repository is unfortunately a bit unusable: it isn't a fork from
the original Buildroot repository. Why did you create a new repository
that contains just the source code of a package? You should instead
clone the original Buildroot repository, create a branch, and push it
on Gitorious.
Also, your work on PAM+systemd should not be a new systemd-pam package:
it should be integrated (probably with configuration options) into the
existing systemd package.
> Yes, they integrated udev together with systemd, and I do not see any
> option to build udev separately from their source tree: there isn't
> even such repo as udev at freedesktop.
>
> Now I see that Buildroot gets udev from different source. Could these
> be just two mutually exclusive config options: either to build udev
> with systemd, or udev standalone (and disable building of systemd)?
Now that udev is part of the systemd sources, do they publish new
udev-only release tarballs? I guess not. If I'm correct, then we should
simply remove the 'udev' package, and implement a mechanism to allow
the systemd package to install only udev, or udev+systemd.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [pull request] Pull request for branch for-2012.08/systemd
2012-08-09 9:45 ` Thomas Petazzoni
@ 2012-08-09 14:29 ` Dmitry Golubovsky
0 siblings, 0 replies; 11+ messages in thread
From: Dmitry Golubovsky @ 2012-08-09 14:29 UTC (permalink / raw)
To: buildroot
Thomas,
On Thu, Aug 9, 2012 at 5:45 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello Dmitry,
>
> This repository is unfortunately a bit unusable: it isn't a fork from
> the original Buildroot repository. Why did you create a new repository
> that contains just the source code of a package? You should instead
> clone the original Buildroot repository, create a branch, and push it
> on Gitorious.
Well I'm afraid I did not explain it clearer: this is my overlay
project which does approximately what someone suggested earlier on the
list to support local packages, yet without disturbing sources of
buildroot itself. This is where I keep patches being created. I do
have a clone of buildroot of course where I test final integration,
but it is only on my computer ;)
What I wanted the readers to see are patches in myroot/systemd-pam,
not anything else - just to illustrate how much the code structure in
v18x departed from v4x.
>
> Also, your work on PAM+systemd should not be a new systemd-pam package:
> it should be integrated (probably with configuration options) into the
> existing systemd package.
This is just a temporary name since I had to overlay it over the
untouched buildroot w/o conflict with existing systemd. Surely once I
get to submitting actual patches to buildroot it will be properly
named.
>> Now I see that Buildroot gets udev from different source. Could these
>> be just two mutually exclusive config options: either to build udev
>> with systemd, or udev standalone (and disable building of systemd)?
>
> Now that udev is part of the systemd sources, do they publish new
> udev-only release tarballs? I guess not. If I'm correct, then we should
> simply remove the 'udev' package, and implement a mechanism to allow
> the systemd package to install only udev, or udev+systemd.
Yes, I see that the repo at kernel.org/hotplug stopped at v182. Quoting this:
http://cgit.freedesktop.org/systemd/systemd/tree/NEWS
CHANGES WITH 183:
* Note that we skipped 139 releases here in order to set the
new version to something that is greater than both udev's
and systemd's most recent version number.
* udev: all udev sources are merged into the systemd source tree now.
All future udev development will happen in the systemd tree. It
is still fully supported to use the udev daemon and tools without
systemd running, like in initramfs or other init systems. Building
udev though, will require the *build* of the systemd tree, but
udev can be properly *run* without systemd.
which means that it might be an option in buildroot, roughly speaking;
[X] install udev
[X] install systemd (only available if install udev is checked)
I'll take a look how this can be done once I get back to systemd
patches (currently working on linux-pam patches).
Thanks.
--
Dmitry Golubovsky
Anywhere on the Web
^ permalink raw reply [flat|nested] 11+ messages in thread