diff mbox series

[02/12] tini: new package

Message ID 20171019002257.27646-2-christian@paral.in
State Superseded
Headers show
Series [01/12] dumb-init: new package | expand

Commit Message

Christian Stewart Oct. 19, 2017, 12:22 a.m. UTC
Tini is a minimal init process to act as PID 1 for containers.

Tini can be used to satisfy docker-engine's docker-init binary
requirement.

In many cases docker-init backing processes like Tini must be static, as
they are executed inside a container in an unknown environment. This
patch adds an option to specifically compile Tini statically, even if
the system is compiled dynamically.

Signed-off-by: Christian Stewart <christian@paral.in>
---
 package/Config.in      |  1 +
 package/tini/Config.in | 21 +++++++++++++++++++++
 package/tini/tini.hash |  2 ++
 package/tini/tini.mk   | 42 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 package/tini/Config.in
 create mode 100644 package/tini/tini.hash
 create mode 100644 package/tini/tini.mk

Comments

Thomas Petazzoni Oct. 21, 2017, 1:49 p.m. UTC | #1
Hello,

On Wed, 18 Oct 2017 20:22:47 -0400, Christian Stewart wrote:

> +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)
> +TINI_CFLAGS += -fstack-protector --param=ssp-buffer-size=4
> +endif

I don't think we want this. Buildroot already passes -fstack-protector
globally when BR2_SSP_REGULAR / BR2_SSP_STRONG / BR2_SSP_ALL.

Best regards,

Thomas
Christian Stewart Oct. 24, 2017, 3:06 a.m. UTC | #2
Hi Thomas,

On Sat, Oct 21, 2017 at 9:49 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> I don't think we want this. Buildroot already passes -fstack-protector
> globally when BR2_SSP_REGULAR / BR2_SSP_STRONG / BR2_SSP_ALL.

Feel free to disable it, I was copying the build flags from the
project's Makefile.

Best,
Christian
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index c161634daf..f8f9f39167 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1878,6 +1878,7 @@  comment "Utilities"
 	source "package/sudo/Config.in"
 	source "package/terminology/Config.in"
 	source "package/time/Config.in"
+	source "package/tini/Config.in"
 	source "package/tmux/Config.in"
 	source "package/which/Config.in"
 	source "package/xmlstarlet/Config.in"
diff --git a/package/tini/Config.in b/package/tini/Config.in
new file mode 100644
index 0000000000..323b9d17a1
--- /dev/null
+++ b/package/tini/Config.in
@@ -0,0 +1,21 @@ 
+config BR2_PACKAGE_TINI
+	bool "tini"
+	help
+	  tini is a simple but valid init binary to
+	  act as PID 1 for containers.
+
+	  https://github.com/krallin/tini
+
+if BR2_PACKAGE_TINI
+
+config BR2_PACKAGE_TINI_MINIMAL
+	bool "build minimal variant"
+	help
+	  Disables argument parsing and verbose output.
+
+config BR2_PACKAGE_TINI_STATIC
+	bool "build static"
+	help
+	  Enables static compilation for tini.
+
+endif
diff --git a/package/tini/tini.hash b/package/tini/tini.hash
new file mode 100644
index 0000000000..f8c8c2a3aa
--- /dev/null
+++ b/package/tini/tini.hash
@@ -0,0 +1,2 @@ 
+# Locally computed
+sha256	c2b7fe2fb92e71911d06b7571b53d4e7e8985b34efe2a599670b070b000c8dbe	tini-v0.16.1.tar.gz
diff --git a/package/tini/tini.mk b/package/tini/tini.mk
new file mode 100644
index 0000000000..a43f3f0162
--- /dev/null
+++ b/package/tini/tini.mk
@@ -0,0 +1,42 @@ 
+################################################################################
+#
+# tini
+#
+################################################################################
+
+TINI_VERSION = v0.16.1
+TINI_SITE = $(call github,krallin,tini,$(TINI_VERSION))
+
+TINI_LICENSE = MIT
+TINI_LICENSE_FILES = LICENSE
+
+TINI_CFLAGS = $(TARGET_CFLAGS) -DTINI_VERSION=\"$(TINI_VERSION)\" -DTINI_GIT=\"\"
+
+ifeq ($(BR2_PACKAGE_TINI_MINIMAL),y)
+TINI_CFLAGS += -DTINI_MINIMAL
+endif
+
+ifeq ($(BR2_PACKAGE_TINI_STATIC),y)
+TINI_CFLAGS += -static
+endif
+
+ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)
+TINI_CFLAGS += -fstack-protector --param=ssp-buffer-size=4
+endif
+
+define TINI_CONFIGURE_CMDS
+	printf "#pragma once\n" > $(@D)/src/tiniConfig.h
+endef
+
+define TINI_BUILD_CMDS
+	$(TARGET_CC) \
+		$(TINI_CFLAGS) \
+		-o $(@D)/tini $(@D)/src/tini.c
+endef
+
+define TINI_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/tini $(TARGET_DIR)/usr/bin/tini
+endef
+
+# Tini's CMakeLists.txt is not suitable for Buildroot.
+$(eval $(generic-package))