mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] haveged: add entropy daemon
@ 2017-06-29 21:49 Robert Schwebel
  2017-06-30  7:19 ` Alexander Dahl
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Robert Schwebel @ 2017-06-29 21:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Robert Schwebel

Add the haveged package.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---
 ....ac-fix-handling-for-enable-clock_gettime.patch | 26 ++++++++
 .../0002-init-fix-path-for-systemd-unit-dir.patch  | 24 +++++++
 ...nstallation-of-systemd-unit-file-DESTDIR-.patch | 28 ++++++++
 ...akefile.am-create-nonexisting-directories.patch | 31 +++++++++
 ...file.am-do-not-call-systemd-during-compil.patch | 29 +++++++++
 patches/haveged-1.9.1/autogen.sh                   |  1 +
 patches/haveged-1.9.1/series                       |  8 +++
 rules/haveged.in                                   |  7 ++
 rules/haveged.make                                 | 76 ++++++++++++++++++++++
 9 files changed, 230 insertions(+)
 create mode 100644 patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
 create mode 100644 patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
 create mode 100644 patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
 create mode 100644 patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
 create mode 100644 patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
 create mode 120000 patches/haveged-1.9.1/autogen.sh
 create mode 100644 patches/haveged-1.9.1/series
 create mode 100644 rules/haveged.in
 create mode 100644 rules/haveged.make

diff --git a/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
new file mode 100644
index 000000000..20a34b466
--- /dev/null
+++ b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
@@ -0,0 +1,26 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:30:34 +0200
+Subject: [PATCH] configure.ac: fix handling for --enable-clock_gettime
+
+The logic for this configure option is broken; on ARM, we fall into the
+*) path and the logic decides that this option is not set, no matter if
+we set it or not.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index f8d76c106014..e4f17a80d876 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -175,6 +175,8 @@ case "$host" in
+  *)
+     if test "x$enable_clock_gettime" = "xx"; then
+       enable_clock_gettime="yes"
++    elif test "x$enable_clock_gettime" = "xyes"; then
++      enable_clock_gettime="yes"
+     else
+       AC_MSG_ERROR([no timer source for host :"$host".])
+     fi
diff --git a/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
new file mode 100644
index 000000000..6ae95fbb5
--- /dev/null
+++ b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
@@ -0,0 +1,24 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:53:16 +0200
+Subject: [PATCH] init: fix path for systemd unit dir
+
+This branch was obviously not tested.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index ca3ad1c1e854..bf86773176a6 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -37,7 +37,7 @@ install-data-hook:
+ if ENABLE_SYSTEMD_LOOKUP
+ 	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
+ else
+-	install -p -m644 haveged.service ($unit_dir)/haveged.service;
++	install -p -m644 haveged.service $(unit_dir)/haveged.service;
+ endif
+ 	systemctl enable haveged.service;
+ 
diff --git a/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
new file mode 100644
index 000000000..5a536871a
--- /dev/null
+++ b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
@@ -0,0 +1,28 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:54:11 +0200
+Subject: [PATCH] init: make installation of systemd unit file DESTDIR aware
+
+The installation currently does not care about a DESTDIR, which is
+imporant when cross compiling.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index bf86773176a6..2f92cb7fdde4 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -35,9 +35,9 @@ install-exec-hook:
+ 
+ install-data-hook:
+ if ENABLE_SYSTEMD_LOOKUP
+-	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
++	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
+ else
+-	install -p -m644 haveged.service $(unit_dir)/haveged.service;
++	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
+ endif
+ 	systemctl enable haveged.service;
+ 
diff --git a/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
new file mode 100644
index 000000000..6f693b000
--- /dev/null
+++ b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
@@ -0,0 +1,31 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:59:46 +0200
+Subject: [PATCH] init.d/Makefile.am: create nonexisting directories
+
+install can't assume that all leading directories do already exist.
+While this will in most cases be true on normal desktop/server
+distributions, cross build systems or systems that build single packages
+will build into a fresh hierarchy. Add -D to install, in order to create
+the leading directories.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index 2f92cb7fdde4..4a6e551f0b51 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -35,9 +35,9 @@ install-exec-hook:
+ 
+ install-data-hook:
+ if ENABLE_SYSTEMD_LOOKUP
+-	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
++	install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
+ else
+-	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
++	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
+ endif
+ 	systemctl enable haveged.service;
+ 
diff --git a/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
new file mode 100644
index 000000000..359708a18
--- /dev/null
+++ b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
@@ -0,0 +1,29 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 23:03:06 +0200
+Subject: [PATCH] init.d/Makefile.am: do not call systemd during compilation
+
+Remove systemd call: we can not assume that the user is allowed to do
+so: he might not if he compiles the software as non-root.
+
+When cross-compiling, the intended systemd might not even run on the
+same hardware.
+
+We better leave the decision whether or not to call systemd to the
+administrator.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index 4a6e551f0b51..efb01e3c8aab 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -39,6 +39,4 @@ if ENABLE_SYSTEMD_LOOKUP
+ else
+ 	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
+ endif
+-	systemctl enable haveged.service;
+-
+ endif
diff --git a/patches/haveged-1.9.1/autogen.sh b/patches/haveged-1.9.1/autogen.sh
new file mode 120000
index 000000000..9f8a4cb7d
--- /dev/null
+++ b/patches/haveged-1.9.1/autogen.sh
@@ -0,0 +1 @@
+../autogen.sh
\ No newline at end of file
diff --git a/patches/haveged-1.9.1/series b/patches/haveged-1.9.1/series
new file mode 100644
index 000000000..0e24f4d6b
--- /dev/null
+++ b/patches/haveged-1.9.1/series
@@ -0,0 +1,8 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
+0002-init-fix-path-for-systemd-unit-dir.patch
+0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
+0004-init.d-Makefile.am-create-nonexisting-directories.patch
+0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
+# d6dc334689ded00c3e697eb3fe83b57a  - git-ptx-patches magic
diff --git a/rules/haveged.in b/rules/haveged.in
new file mode 100644
index 000000000..9a8a59702
--- /dev/null
+++ b/rules/haveged.in
@@ -0,0 +1,7 @@
+## SECTION=networking
+
+config HAVEGED
+	tristate
+	prompt "haveged"
+	help
+	  haveged is a simple entropy daemon
diff --git a/rules/haveged.make b/rules/haveged.make
new file mode 100644
index 000000000..0ef3559e6
--- /dev/null
+++ b/rules/haveged.make
@@ -0,0 +1,76 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2017 by Robert Schwebel <r.schwebel@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_HAVEGED) += haveged
+
+#
+# Paths and names
+#
+HAVEGED_VERSION	:= 1.9.1
+HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
+HAVEGED		:= haveged-$(HAVEGED_VERSION)
+HAVEGED_SUFFIX	:= tar.gz
+HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
+HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
+HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
+HAVEGED_LICENSE	:= GPL-3.0 
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+#
+# autoconf
+#
+HAVEGED_CONF_TOOL	:= autoconf
+HAVEGED_CONF_OPT	:= \
+	$(CROSS_AUTOCONF_USR) \
+	--enable-clock_gettime \
+	--enable-daemon=yes \
+	--enable-diagnostic=no \
+	--enable-init=service.fedora \
+	--enable-initdir=? \
+	--enable-nistest=no \
+	--enable-olt=no \
+	--enable-threads=no \
+	--enable-tune=yes
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/haveged.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, haveged)
+	@$(call install_fixup, haveged,PRIORITY,optional)
+	@$(call install_fixup, haveged,SECTION,base)
+	@$(call install_fixup, haveged,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
+	@$(call install_fixup, haveged,DESCRIPTION,missing)
+
+	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
+	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
+
+ifdef PTXCONF_INITMETHOD_SYSTEMD
+	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)
+	@$(call install_link, haveged, \
+		../haveged.service, \
+		/usr/lib/systemd/system/multi-user.target.wants/haveged.service \
+	)
+endif
+
+	@$(call install_finish, haveged)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.13.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-29 21:49 [ptxdist] [PATCH] haveged: add entropy daemon Robert Schwebel
@ 2017-06-30  7:19 ` Alexander Dahl
  2017-06-30 12:16   ` Michael Olbrich
  2017-07-02 15:36   ` Robert Schwebel
  2017-06-30  8:19 ` [ptxdist] [PATCH] haveged: add entropy daemon Michael Olbrich
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 16+ messages in thread
From: Alexander Dahl @ 2017-06-30  7:19 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 13438 bytes --]

Hei hei,

tested this without systemd on top of a recent ptxdist 2017.06.0 based
BSP with the sysv init script from buildroot. The usual 'random: crng
init done' message on the serial konsole comes a lot earlier now, so I
guess it works. ;-)

Besides: is there any way to have this random generator stuff
certainly ready before generating dropbear keys (rc-once)?

Greets
Alex

Tested-by: Alexander Dahl <post@lespocky.de>

On Thu, Jun 29, 2017 at 11:49:26PM +0200, Robert Schwebel wrote:
> Add the haveged package.
> 
> Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> ---
>  ....ac-fix-handling-for-enable-clock_gettime.patch | 26 ++++++++
>  .../0002-init-fix-path-for-systemd-unit-dir.patch  | 24 +++++++
>  ...nstallation-of-systemd-unit-file-DESTDIR-.patch | 28 ++++++++
>  ...akefile.am-create-nonexisting-directories.patch | 31 +++++++++
>  ...file.am-do-not-call-systemd-during-compil.patch | 29 +++++++++
>  patches/haveged-1.9.1/autogen.sh                   |  1 +
>  patches/haveged-1.9.1/series                       |  8 +++
>  rules/haveged.in                                   |  7 ++
>  rules/haveged.make                                 | 76 ++++++++++++++++++++++
>  9 files changed, 230 insertions(+)
>  create mode 100644 patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
>  create mode 100644 patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
>  create mode 100644 patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
>  create mode 100644 patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
>  create mode 100644 patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
>  create mode 120000 patches/haveged-1.9.1/autogen.sh
>  create mode 100644 patches/haveged-1.9.1/series
>  create mode 100644 rules/haveged.in
>  create mode 100644 rules/haveged.make
> 
> diff --git a/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> new file mode 100644
> index 000000000..20a34b466
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> @@ -0,0 +1,26 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:30:34 +0200
> +Subject: [PATCH] configure.ac: fix handling for --enable-clock_gettime
> +
> +The logic for this configure option is broken; on ARM, we fall into the
> +*) path and the logic decides that this option is not set, no matter if
> +we set it or not.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + configure.ac | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/configure.ac b/configure.ac
> +index f8d76c106014..e4f17a80d876 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -175,6 +175,8 @@ case "$host" in
> +  *)
> +     if test "x$enable_clock_gettime" = "xx"; then
> +       enable_clock_gettime="yes"
> ++    elif test "x$enable_clock_gettime" = "xyes"; then
> ++      enable_clock_gettime="yes"
> +     else
> +       AC_MSG_ERROR([no timer source for host :"$host".])
> +     fi
> diff --git a/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> new file mode 100644
> index 000000000..6ae95fbb5
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> @@ -0,0 +1,24 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:53:16 +0200
> +Subject: [PATCH] init: fix path for systemd unit dir
> +
> +This branch was obviously not tested.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index ca3ad1c1e854..bf86773176a6 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -37,7 +37,7 @@ install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> + 	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service ($unit_dir)/haveged.service;
> ++	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> new file mode 100644
> index 000000000..5a536871a
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> @@ -0,0 +1,28 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:54:11 +0200
> +Subject: [PATCH] init: make installation of systemd unit file DESTDIR aware
> +
> +The installation currently does not care about a DESTDIR, which is
> +imporant when cross compiling.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index bf86773176a6..2f92cb7fdde4 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -35,9 +35,9 @@ install-exec-hook:
> + 
> + install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> +-	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> ++	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> ++	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> new file mode 100644
> index 000000000..6f693b000
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> @@ -0,0 +1,31 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:59:46 +0200
> +Subject: [PATCH] init.d/Makefile.am: create nonexisting directories
> +
> +install can't assume that all leading directories do already exist.
> +While this will in most cases be true on normal desktop/server
> +distributions, cross build systems or systems that build single packages
> +will build into a fresh hierarchy. Add -D to install, in order to create
> +the leading directories.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index 2f92cb7fdde4..4a6e551f0b51 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -35,9 +35,9 @@ install-exec-hook:
> + 
> + install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> +-	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> ++	install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> ++	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> new file mode 100644
> index 000000000..359708a18
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> @@ -0,0 +1,29 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 23:03:06 +0200
> +Subject: [PATCH] init.d/Makefile.am: do not call systemd during compilation
> +
> +Remove systemd call: we can not assume that the user is allowed to do
> +so: he might not if he compiles the software as non-root.
> +
> +When cross-compiling, the intended systemd might not even run on the
> +same hardware.
> +
> +We better leave the decision whether or not to call systemd to the
> +administrator.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 2 --
> + 1 file changed, 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index 4a6e551f0b51..efb01e3c8aab 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -39,6 +39,4 @@ if ENABLE_SYSTEMD_LOOKUP
> + else
> + 	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> +-	systemctl enable haveged.service;
> +-
> + endif
> diff --git a/patches/haveged-1.9.1/autogen.sh b/patches/haveged-1.9.1/autogen.sh
> new file mode 120000
> index 000000000..9f8a4cb7d
> --- /dev/null
> +++ b/patches/haveged-1.9.1/autogen.sh
> @@ -0,0 +1 @@
> +../autogen.sh
> \ No newline at end of file
> diff --git a/patches/haveged-1.9.1/series b/patches/haveged-1.9.1/series
> new file mode 100644
> index 000000000..0e24f4d6b
> --- /dev/null
> +++ b/patches/haveged-1.9.1/series
> @@ -0,0 +1,8 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> +0002-init-fix-path-for-systemd-unit-dir.patch
> +0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> +0004-init.d-Makefile.am-create-nonexisting-directories.patch
> +0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> +# d6dc334689ded00c3e697eb3fe83b57a  - git-ptx-patches magic
> diff --git a/rules/haveged.in b/rules/haveged.in
> new file mode 100644
> index 000000000..9a8a59702
> --- /dev/null
> +++ b/rules/haveged.in
> @@ -0,0 +1,7 @@
> +## SECTION=networking
> +
> +config HAVEGED
> +	tristate
> +	prompt "haveged"
> +	help
> +	  haveged is a simple entropy daemon
> diff --git a/rules/haveged.make b/rules/haveged.make
> new file mode 100644
> index 000000000..0ef3559e6
> --- /dev/null
> +++ b/rules/haveged.make
> @@ -0,0 +1,76 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2017 by Robert Schwebel <r.schwebel@pengutronix.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_HAVEGED) += haveged
> +
> +#
> +# Paths and names
> +#
> +HAVEGED_VERSION	:= 1.9.1
> +HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
> +HAVEGED		:= haveged-$(HAVEGED_VERSION)
> +HAVEGED_SUFFIX	:= tar.gz
> +HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
> +HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
> +HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
> +HAVEGED_LICENSE	:= GPL-3.0 
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +#
> +# autoconf
> +#
> +HAVEGED_CONF_TOOL	:= autoconf
> +HAVEGED_CONF_OPT	:= \
> +	$(CROSS_AUTOCONF_USR) \
> +	--enable-clock_gettime \
> +	--enable-daemon=yes \
> +	--enable-diagnostic=no \
> +	--enable-init=service.fedora \
> +	--enable-initdir=? \
> +	--enable-nistest=no \
> +	--enable-olt=no \
> +	--enable-threads=no \
> +	--enable-tune=yes
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/haveged.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, haveged)
> +	@$(call install_fixup, haveged,PRIORITY,optional)
> +	@$(call install_fixup, haveged,SECTION,base)
> +	@$(call install_fixup, haveged,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
> +	@$(call install_fixup, haveged,DESCRIPTION,missing)
> +
> +	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
> +	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
> +
> +ifdef PTXCONF_INITMETHOD_SYSTEMD
> +	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)
> +	@$(call install_link, haveged, \
> +		../haveged.service, \
> +		/usr/lib/systemd/system/multi-user.target.wants/haveged.service \
> +	)
> +endif
> +
> +	@$(call install_finish, haveged)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.13.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
»With the first link, the chain is forged. The first speech censured, 
the first thought forbidden, the first freedom denied, chains us all 
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: C28E E6B9 0263 95CF 8FAF  08FA 34AD CD00 7221 5CC6 ***

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-29 21:49 [ptxdist] [PATCH] haveged: add entropy daemon Robert Schwebel
  2017-06-30  7:19 ` Alexander Dahl
@ 2017-06-30  8:19 ` Michael Olbrich
  2017-06-30  8:32   ` Robert Schwebel
  2017-07-02 15:26   ` Robert Schwebel
  2017-06-30 12:12 ` Michael Olbrich
  2017-07-02 15:35 ` [ptxdist] [PATCHv2] " Robert Schwebel
  3 siblings, 2 replies; 16+ messages in thread
From: Michael Olbrich @ 2017-06-30  8:19 UTC (permalink / raw)
  To: ptxdist

On Thu, Jun 29, 2017 at 11:49:26PM +0200, Robert Schwebel wrote:
> Add the haveged package.
> 
> Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> ---
>  ....ac-fix-handling-for-enable-clock_gettime.patch | 26 ++++++++
>  .../0002-init-fix-path-for-systemd-unit-dir.patch  | 24 +++++++
>  ...nstallation-of-systemd-unit-file-DESTDIR-.patch | 28 ++++++++
>  ...akefile.am-create-nonexisting-directories.patch | 31 +++++++++
>  ...file.am-do-not-call-systemd-during-compil.patch | 29 +++++++++
>  patches/haveged-1.9.1/autogen.sh                   |  1 +
>  patches/haveged-1.9.1/series                       |  8 +++
>  rules/haveged.in                                   |  7 ++
>  rules/haveged.make                                 | 76 ++++++++++++++++++++++
>  9 files changed, 230 insertions(+)
>  create mode 100644 patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
>  create mode 100644 patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
>  create mode 100644 patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
>  create mode 100644 patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
>  create mode 100644 patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
>  create mode 120000 patches/haveged-1.9.1/autogen.sh
>  create mode 100644 patches/haveged-1.9.1/series
>  create mode 100644 rules/haveged.in
>  create mode 100644 rules/haveged.make
> 
> diff --git a/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> new file mode 100644
> index 000000000..20a34b466
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> @@ -0,0 +1,26 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:30:34 +0200
> +Subject: [PATCH] configure.ac: fix handling for --enable-clock_gettime
> +
> +The logic for this configure option is broken; on ARM, we fall into the
> +*) path and the logic decides that this option is not set, no matter if
> +we set it or not.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + configure.ac | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/configure.ac b/configure.ac
> +index f8d76c106014..e4f17a80d876 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -175,6 +175,8 @@ case "$host" in
> +  *)
> +     if test "x$enable_clock_gettime" = "xx"; then
> +       enable_clock_gettime="yes"
> ++    elif test "x$enable_clock_gettime" = "xyes"; then
> ++      enable_clock_gettime="yes"
> +     else
> +       AC_MSG_ERROR([no timer source for host :"$host".])
> +     fi
> diff --git a/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> new file mode 100644
> index 000000000..6ae95fbb5
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> @@ -0,0 +1,24 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:53:16 +0200
> +Subject: [PATCH] init: fix path for systemd unit dir
> +
> +This branch was obviously not tested.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index ca3ad1c1e854..bf86773176a6 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -37,7 +37,7 @@ install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> + 	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service ($unit_dir)/haveged.service;
> ++	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> new file mode 100644
> index 000000000..5a536871a
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> @@ -0,0 +1,28 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:54:11 +0200
> +Subject: [PATCH] init: make installation of systemd unit file DESTDIR aware
> +
> +The installation currently does not care about a DESTDIR, which is
> +imporant when cross compiling.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index bf86773176a6..2f92cb7fdde4 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -35,9 +35,9 @@ install-exec-hook:
> + 
> + install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> +-	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> ++	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> ++	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> new file mode 100644
> index 000000000..6f693b000
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> @@ -0,0 +1,31 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:59:46 +0200
> +Subject: [PATCH] init.d/Makefile.am: create nonexisting directories
> +
> +install can't assume that all leading directories do already exist.
> +While this will in most cases be true on normal desktop/server
> +distributions, cross build systems or systems that build single packages
> +will build into a fresh hierarchy. Add -D to install, in order to create
> +the leading directories.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index 2f92cb7fdde4..4a6e551f0b51 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -35,9 +35,9 @@ install-exec-hook:
> + 
> + install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> +-	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> ++	install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> ++	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> new file mode 100644
> index 000000000..359708a18
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> @@ -0,0 +1,29 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 23:03:06 +0200
> +Subject: [PATCH] init.d/Makefile.am: do not call systemd during compilation
> +
> +Remove systemd call: we can not assume that the user is allowed to do
> +so: he might not if he compiles the software as non-root.
> +
> +When cross-compiling, the intended systemd might not even run on the
> +same hardware.
> +
> +We better leave the decision whether or not to call systemd to the
> +administrator.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 2 --
> + 1 file changed, 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index 4a6e551f0b51..efb01e3c8aab 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -39,6 +39,4 @@ if ENABLE_SYSTEMD_LOOKUP
> + else
> + 	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> +-	systemctl enable haveged.service;
> +-
> + endif
> diff --git a/patches/haveged-1.9.1/autogen.sh b/patches/haveged-1.9.1/autogen.sh
> new file mode 120000
> index 000000000..9f8a4cb7d
> --- /dev/null
> +++ b/patches/haveged-1.9.1/autogen.sh
> @@ -0,0 +1 @@
> +../autogen.sh
> \ No newline at end of file
> diff --git a/patches/haveged-1.9.1/series b/patches/haveged-1.9.1/series
> new file mode 100644
> index 000000000..0e24f4d6b
> --- /dev/null
> +++ b/patches/haveged-1.9.1/series
> @@ -0,0 +1,8 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> +0002-init-fix-path-for-systemd-unit-dir.patch
> +0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> +0004-init.d-Makefile.am-create-nonexisting-directories.patch
> +0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> +# d6dc334689ded00c3e697eb3fe83b57a  - git-ptx-patches magic
> diff --git a/rules/haveged.in b/rules/haveged.in
> new file mode 100644
> index 000000000..9a8a59702
> --- /dev/null
> +++ b/rules/haveged.in
> @@ -0,0 +1,7 @@
> +## SECTION=networking
> +
> +config HAVEGED
> +	tristate
> +	prompt "haveged"
> +	help
> +	  haveged is a simple entropy daemon
> diff --git a/rules/haveged.make b/rules/haveged.make
> new file mode 100644
> index 000000000..0ef3559e6
> --- /dev/null
> +++ b/rules/haveged.make
> @@ -0,0 +1,76 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2017 by Robert Schwebel <r.schwebel@pengutronix.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_HAVEGED) += haveged
> +
> +#
> +# Paths and names
> +#
> +HAVEGED_VERSION	:= 1.9.1
> +HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
> +HAVEGED		:= haveged-$(HAVEGED_VERSION)
> +HAVEGED_SUFFIX	:= tar.gz
> +HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
> +HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
> +HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
> +HAVEGED_LICENSE	:= GPL-3.0 
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +#
> +# autoconf
> +#
> +HAVEGED_CONF_TOOL	:= autoconf
> +HAVEGED_CONF_OPT	:= \
> +	$(CROSS_AUTOCONF_USR) \
> +	--enable-clock_gettime \
> +	--enable-daemon=yes \
> +	--enable-diagnostic=no \
> +	--enable-init=service.fedora \
> +	--enable-initdir=? \

--enable-initdir=/usr/lib/systemd/system

otherwise pkg-config is queried and that requires a dependency on systemd.

Michael

> +	--enable-nistest=no \
> +	--enable-olt=no \
> +	--enable-threads=no \
> +	--enable-tune=yes
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/haveged.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, haveged)
> +	@$(call install_fixup, haveged,PRIORITY,optional)
> +	@$(call install_fixup, haveged,SECTION,base)
> +	@$(call install_fixup, haveged,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
> +	@$(call install_fixup, haveged,DESCRIPTION,missing)
> +
> +	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
> +	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
> +
> +ifdef PTXCONF_INITMETHOD_SYSTEMD
> +	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)
> +	@$(call install_link, haveged, \
> +		../haveged.service, \
> +		/usr/lib/systemd/system/multi-user.target.wants/haveged.service \
> +	)
> +endif
> +
> +	@$(call install_finish, haveged)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.13.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30  8:19 ` [ptxdist] [PATCH] haveged: add entropy daemon Michael Olbrich
@ 2017-06-30  8:32   ` Robert Schwebel
  2017-07-02 15:26   ` Robert Schwebel
  1 sibling, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2017-06-30  8:32 UTC (permalink / raw)
  To: ptxdist

On Fri, Jun 30, 2017 at 10:19:55AM +0200, Michael Olbrich wrote:
> > +	--enable-initdir=? \
> 
> --enable-initdir=/usr/lib/systemd/system
> 
> otherwise pkg-config is queried and that requires a dependency on systemd.

We open code this in several places now. Time for a variable?

rsc@leda:~/git/ptxdist$ git grep /usr/lib/systemd/system | wc -l
170

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-29 21:49 [ptxdist] [PATCH] haveged: add entropy daemon Robert Schwebel
  2017-06-30  7:19 ` Alexander Dahl
  2017-06-30  8:19 ` [ptxdist] [PATCH] haveged: add entropy daemon Michael Olbrich
@ 2017-06-30 12:12 ` Michael Olbrich
  2017-07-02 15:27   ` Robert Schwebel
  2017-07-02 15:35 ` [ptxdist] [PATCHv2] " Robert Schwebel
  3 siblings, 1 reply; 16+ messages in thread
From: Michael Olbrich @ 2017-06-30 12:12 UTC (permalink / raw)
  To: ptxdist

On Thu, Jun 29, 2017 at 11:49:26PM +0200, Robert Schwebel wrote:
> Add the haveged package.
> 
> Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> ---
>  ....ac-fix-handling-for-enable-clock_gettime.patch | 26 ++++++++
>  .../0002-init-fix-path-for-systemd-unit-dir.patch  | 24 +++++++
>  ...nstallation-of-systemd-unit-file-DESTDIR-.patch | 28 ++++++++
>  ...akefile.am-create-nonexisting-directories.patch | 31 +++++++++
>  ...file.am-do-not-call-systemd-during-compil.patch | 29 +++++++++
>  patches/haveged-1.9.1/autogen.sh                   |  1 +
>  patches/haveged-1.9.1/series                       |  8 +++
>  rules/haveged.in                                   |  7 ++
>  rules/haveged.make                                 | 76 ++++++++++++++++++++++
>  9 files changed, 230 insertions(+)
>  create mode 100644 patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
>  create mode 100644 patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
>  create mode 100644 patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
>  create mode 100644 patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
>  create mode 100644 patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
>  create mode 120000 patches/haveged-1.9.1/autogen.sh
>  create mode 100644 patches/haveged-1.9.1/series
>  create mode 100644 rules/haveged.in
>  create mode 100644 rules/haveged.make
> 
> diff --git a/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> new file mode 100644
> index 000000000..20a34b466
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> @@ -0,0 +1,26 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:30:34 +0200
> +Subject: [PATCH] configure.ac: fix handling for --enable-clock_gettime
> +
> +The logic for this configure option is broken; on ARM, we fall into the
> +*) path and the logic decides that this option is not set, no matter if
> +we set it or not.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + configure.ac | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/configure.ac b/configure.ac
> +index f8d76c106014..e4f17a80d876 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -175,6 +175,8 @@ case "$host" in
> +  *)
> +     if test "x$enable_clock_gettime" = "xx"; then
> +       enable_clock_gettime="yes"
> ++    elif test "x$enable_clock_gettime" = "xyes"; then
> ++      enable_clock_gettime="yes"
> +     else
> +       AC_MSG_ERROR([no timer source for host :"$host".])
> +     fi
> diff --git a/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> new file mode 100644
> index 000000000..6ae95fbb5
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> @@ -0,0 +1,24 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:53:16 +0200
> +Subject: [PATCH] init: fix path for systemd unit dir
> +
> +This branch was obviously not tested.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index ca3ad1c1e854..bf86773176a6 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -37,7 +37,7 @@ install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> + 	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service ($unit_dir)/haveged.service;
> ++	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> new file mode 100644
> index 000000000..5a536871a
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> @@ -0,0 +1,28 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:54:11 +0200
> +Subject: [PATCH] init: make installation of systemd unit file DESTDIR aware
> +
> +The installation currently does not care about a DESTDIR, which is
> +imporant when cross compiling.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index bf86773176a6..2f92cb7fdde4 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -35,9 +35,9 @@ install-exec-hook:
> + 
> + install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> +-	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> ++	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> ++	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> new file mode 100644
> index 000000000..6f693b000
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> @@ -0,0 +1,31 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 22:59:46 +0200
> +Subject: [PATCH] init.d/Makefile.am: create nonexisting directories
> +
> +install can't assume that all leading directories do already exist.
> +While this will in most cases be true on normal desktop/server
> +distributions, cross build systems or systems that build single packages
> +will build into a fresh hierarchy. Add -D to install, in order to create
> +the leading directories.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index 2f92cb7fdde4..4a6e551f0b51 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -35,9 +35,9 @@ install-exec-hook:
> + 
> + install-data-hook:
> + if ENABLE_SYSTEMD_LOOKUP
> +-	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> ++	install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> + else
> +-	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> ++	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> + 	systemctl enable haveged.service;
> + 
> diff --git a/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> new file mode 100644
> index 000000000..359708a18
> --- /dev/null
> +++ b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> @@ -0,0 +1,29 @@
> +From: Robert Schwebel <r.schwebel@pengutronix.de>
> +Date: Thu, 29 Jun 2017 23:03:06 +0200
> +Subject: [PATCH] init.d/Makefile.am: do not call systemd during compilation
> +
> +Remove systemd call: we can not assume that the user is allowed to do
> +so: he might not if he compiles the software as non-root.
> +
> +When cross-compiling, the intended systemd might not even run on the
> +same hardware.
> +
> +We better leave the decision whether or not to call systemd to the
> +administrator.
> +
> +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> +---
> + init.d/Makefile.am | 2 --
> + 1 file changed, 2 deletions(-)
> +
> +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> +index 4a6e551f0b51..efb01e3c8aab 100644
> +--- a/init.d/Makefile.am
> ++++ b/init.d/Makefile.am
> +@@ -39,6 +39,4 @@ if ENABLE_SYSTEMD_LOOKUP
> + else
> + 	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> + endif
> +-	systemctl enable haveged.service;
> +-
> + endif
> diff --git a/patches/haveged-1.9.1/autogen.sh b/patches/haveged-1.9.1/autogen.sh
> new file mode 120000
> index 000000000..9f8a4cb7d
> --- /dev/null
> +++ b/patches/haveged-1.9.1/autogen.sh
> @@ -0,0 +1 @@
> +../autogen.sh
> \ No newline at end of file
> diff --git a/patches/haveged-1.9.1/series b/patches/haveged-1.9.1/series
> new file mode 100644
> index 000000000..0e24f4d6b
> --- /dev/null
> +++ b/patches/haveged-1.9.1/series
> @@ -0,0 +1,8 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> +0002-init-fix-path-for-systemd-unit-dir.patch
> +0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> +0004-init.d-Makefile.am-create-nonexisting-directories.patch
> +0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> +# d6dc334689ded00c3e697eb3fe83b57a  - git-ptx-patches magic
> diff --git a/rules/haveged.in b/rules/haveged.in
> new file mode 100644
> index 000000000..9a8a59702
> --- /dev/null
> +++ b/rules/haveged.in
> @@ -0,0 +1,7 @@
> +## SECTION=networking
> +
> +config HAVEGED
> +	tristate
> +	prompt "haveged"
> +	help
> +	  haveged is a simple entropy daemon
> diff --git a/rules/haveged.make b/rules/haveged.make
> new file mode 100644
> index 000000000..0ef3559e6
> --- /dev/null
> +++ b/rules/haveged.make
> @@ -0,0 +1,76 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2017 by Robert Schwebel <r.schwebel@pengutronix.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_HAVEGED) += haveged
> +
> +#
> +# Paths and names
> +#
> +HAVEGED_VERSION	:= 1.9.1
> +HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
> +HAVEGED		:= haveged-$(HAVEGED_VERSION)
> +HAVEGED_SUFFIX	:= tar.gz
> +HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
> +HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
> +HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
> +HAVEGED_LICENSE	:= GPL-3.0 

Trailing whitespace.

> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +#
> +# autoconf
> +#
> +HAVEGED_CONF_TOOL	:= autoconf
> +HAVEGED_CONF_OPT	:= \
> +	$(CROSS_AUTOCONF_USR) \
> +	--enable-clock_gettime \
> +	--enable-daemon=yes \
> +	--enable-diagnostic=no \
> +	--enable-init=service.fedora \
> +	--enable-initdir=? \
> +	--enable-nistest=no \
> +	--enable-olt=no \
> +	--enable-threads=no \
> +	--enable-tune=yes

Please use --enable-XXX and --disable-XXX, not arguments necessary.

Michael

> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/haveged.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, haveged)
> +	@$(call install_fixup, haveged,PRIORITY,optional)
> +	@$(call install_fixup, haveged,SECTION,base)
> +	@$(call install_fixup, haveged,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
> +	@$(call install_fixup, haveged,DESCRIPTION,missing)
> +
> +	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
> +	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
> +
> +ifdef PTXCONF_INITMETHOD_SYSTEMD
> +	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)

Use install_alternative to allow overwriting it.

> +	@$(call install_link, haveged, \

no break here...

> +		../haveged.service, \
> +		/usr/lib/systemd/system/multi-user.target.wants/haveged.service \

... and here

> +	)

Maybe this should start earlier? Does it have any requirements? This might
require patching the service file to add DefaultDependencies=no.

Michael

> +endif
> +
> +	@$(call install_finish, haveged)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.13.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30  7:19 ` Alexander Dahl
@ 2017-06-30 12:16   ` Michael Olbrich
  2017-07-02 15:37     ` Robert Schwebel
  2017-07-06  9:13     ` Alexander Dahl
  2017-07-02 15:36   ` Robert Schwebel
  1 sibling, 2 replies; 16+ messages in thread
From: Michael Olbrich @ 2017-06-30 12:16 UTC (permalink / raw)
  To: ptxdist

On Fri, Jun 30, 2017 at 09:19:18AM +0200, Alexander Dahl wrote:
> Hei hei,
> 
> tested this without systemd on top of a recent ptxdist 2017.06.0 based
> BSP with the sysv init script from buildroot. The usual 'random: crng
> init done' message on the serial konsole comes a lot earlier now, so I
> guess it works. ;-)
> 
> Besides: is there any way to have this random generator stuff
> certainly ready before generating dropbear keys (rc-once)?

I think /dev/random and getrandom() can block until then. Something could
be built on top of that. However you need to be careful: This may block a
very long time on an idle embedded system.

Michael

> Greets
> Alex
> 
> Tested-by: Alexander Dahl <post@lespocky.de>
> 
> On Thu, Jun 29, 2017 at 11:49:26PM +0200, Robert Schwebel wrote:
> > Add the haveged package.
> > 
> > Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> > ---
> >  ....ac-fix-handling-for-enable-clock_gettime.patch | 26 ++++++++
> >  .../0002-init-fix-path-for-systemd-unit-dir.patch  | 24 +++++++
> >  ...nstallation-of-systemd-unit-file-DESTDIR-.patch | 28 ++++++++
> >  ...akefile.am-create-nonexisting-directories.patch | 31 +++++++++
> >  ...file.am-do-not-call-systemd-during-compil.patch | 29 +++++++++
> >  patches/haveged-1.9.1/autogen.sh                   |  1 +
> >  patches/haveged-1.9.1/series                       |  8 +++
> >  rules/haveged.in                                   |  7 ++
> >  rules/haveged.make                                 | 76 ++++++++++++++++++++++
> >  9 files changed, 230 insertions(+)
> >  create mode 100644 patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> >  create mode 100644 patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> >  create mode 100644 patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> >  create mode 100644 patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> >  create mode 100644 patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> >  create mode 120000 patches/haveged-1.9.1/autogen.sh
> >  create mode 100644 patches/haveged-1.9.1/series
> >  create mode 100644 rules/haveged.in
> >  create mode 100644 rules/haveged.make
> > 
> > diff --git a/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> > new file mode 100644
> > index 000000000..20a34b466
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> > @@ -0,0 +1,26 @@
> > +From: Robert Schwebel <r.schwebel@pengutronix.de>
> > +Date: Thu, 29 Jun 2017 22:30:34 +0200
> > +Subject: [PATCH] configure.ac: fix handling for --enable-clock_gettime
> > +
> > +The logic for this configure option is broken; on ARM, we fall into the
> > +*) path and the logic decides that this option is not set, no matter if
> > +we set it or not.
> > +
> > +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> > +---
> > + configure.ac | 2 ++
> > + 1 file changed, 2 insertions(+)
> > +
> > +diff --git a/configure.ac b/configure.ac
> > +index f8d76c106014..e4f17a80d876 100644
> > +--- a/configure.ac
> > ++++ b/configure.ac
> > +@@ -175,6 +175,8 @@ case "$host" in
> > +  *)
> > +     if test "x$enable_clock_gettime" = "xx"; then
> > +       enable_clock_gettime="yes"
> > ++    elif test "x$enable_clock_gettime" = "xyes"; then
> > ++      enable_clock_gettime="yes"
> > +     else
> > +       AC_MSG_ERROR([no timer source for host :"$host".])
> > +     fi
> > diff --git a/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> > new file mode 100644
> > index 000000000..6ae95fbb5
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
> > @@ -0,0 +1,24 @@
> > +From: Robert Schwebel <r.schwebel@pengutronix.de>
> > +Date: Thu, 29 Jun 2017 22:53:16 +0200
> > +Subject: [PATCH] init: fix path for systemd unit dir
> > +
> > +This branch was obviously not tested.
> > +
> > +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> > +---
> > + init.d/Makefile.am | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> > +index ca3ad1c1e854..bf86773176a6 100644
> > +--- a/init.d/Makefile.am
> > ++++ b/init.d/Makefile.am
> > +@@ -37,7 +37,7 @@ install-data-hook:
> > + if ENABLE_SYSTEMD_LOOKUP
> > + 	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> > + else
> > +-	install -p -m644 haveged.service ($unit_dir)/haveged.service;
> > ++	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> > + endif
> > + 	systemctl enable haveged.service;
> > + 
> > diff --git a/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> > new file mode 100644
> > index 000000000..5a536871a
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> > @@ -0,0 +1,28 @@
> > +From: Robert Schwebel <r.schwebel@pengutronix.de>
> > +Date: Thu, 29 Jun 2017 22:54:11 +0200
> > +Subject: [PATCH] init: make installation of systemd unit file DESTDIR aware
> > +
> > +The installation currently does not care about a DESTDIR, which is
> > +imporant when cross compiling.
> > +
> > +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> > +---
> > + init.d/Makefile.am | 4 ++--
> > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> > +index bf86773176a6..2f92cb7fdde4 100644
> > +--- a/init.d/Makefile.am
> > ++++ b/init.d/Makefile.am
> > +@@ -35,9 +35,9 @@ install-exec-hook:
> > + 
> > + install-data-hook:
> > + if ENABLE_SYSTEMD_LOOKUP
> > +-	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> > ++	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> > + else
> > +-	install -p -m644 haveged.service $(unit_dir)/haveged.service;
> > ++	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> > + endif
> > + 	systemctl enable haveged.service;
> > + 
> > diff --git a/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> > new file mode 100644
> > index 000000000..6f693b000
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
> > @@ -0,0 +1,31 @@
> > +From: Robert Schwebel <r.schwebel@pengutronix.de>
> > +Date: Thu, 29 Jun 2017 22:59:46 +0200
> > +Subject: [PATCH] init.d/Makefile.am: create nonexisting directories
> > +
> > +install can't assume that all leading directories do already exist.
> > +While this will in most cases be true on normal desktop/server
> > +distributions, cross build systems or systems that build single packages
> > +will build into a fresh hierarchy. Add -D to install, in order to create
> > +the leading directories.
> > +
> > +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> > +---
> > + init.d/Makefile.am | 4 ++--
> > + 1 file changed, 2 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> > +index 2f92cb7fdde4..4a6e551f0b51 100644
> > +--- a/init.d/Makefile.am
> > ++++ b/init.d/Makefile.am
> > +@@ -35,9 +35,9 @@ install-exec-hook:
> > + 
> > + install-data-hook:
> > + if ENABLE_SYSTEMD_LOOKUP
> > +-	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> > ++	install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
> > + else
> > +-	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> > ++	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> > + endif
> > + 	systemctl enable haveged.service;
> > + 
> > diff --git a/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> > new file mode 100644
> > index 000000000..359708a18
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> > @@ -0,0 +1,29 @@
> > +From: Robert Schwebel <r.schwebel@pengutronix.de>
> > +Date: Thu, 29 Jun 2017 23:03:06 +0200
> > +Subject: [PATCH] init.d/Makefile.am: do not call systemd during compilation
> > +
> > +Remove systemd call: we can not assume that the user is allowed to do
> > +so: he might not if he compiles the software as non-root.
> > +
> > +When cross-compiling, the intended systemd might not even run on the
> > +same hardware.
> > +
> > +We better leave the decision whether or not to call systemd to the
> > +administrator.
> > +
> > +Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> > +---
> > + init.d/Makefile.am | 2 --
> > + 1 file changed, 2 deletions(-)
> > +
> > +diff --git a/init.d/Makefile.am b/init.d/Makefile.am
> > +index 4a6e551f0b51..efb01e3c8aab 100644
> > +--- a/init.d/Makefile.am
> > ++++ b/init.d/Makefile.am
> > +@@ -39,6 +39,4 @@ if ENABLE_SYSTEMD_LOOKUP
> > + else
> > + 	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
> > + endif
> > +-	systemctl enable haveged.service;
> > +-
> > + endif
> > diff --git a/patches/haveged-1.9.1/autogen.sh b/patches/haveged-1.9.1/autogen.sh
> > new file mode 120000
> > index 000000000..9f8a4cb7d
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/autogen.sh
> > @@ -0,0 +1 @@
> > +../autogen.sh
> > \ No newline at end of file
> > diff --git a/patches/haveged-1.9.1/series b/patches/haveged-1.9.1/series
> > new file mode 100644
> > index 000000000..0e24f4d6b
> > --- /dev/null
> > +++ b/patches/haveged-1.9.1/series
> > @@ -0,0 +1,8 @@
> > +# generated by git-ptx-patches
> > +#tag:base --start-number 1
> > +0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
> > +0002-init-fix-path-for-systemd-unit-dir.patch
> > +0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
> > +0004-init.d-Makefile.am-create-nonexisting-directories.patch
> > +0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
> > +# d6dc334689ded00c3e697eb3fe83b57a  - git-ptx-patches magic
> > diff --git a/rules/haveged.in b/rules/haveged.in
> > new file mode 100644
> > index 000000000..9a8a59702
> > --- /dev/null
> > +++ b/rules/haveged.in
> > @@ -0,0 +1,7 @@
> > +## SECTION=networking
> > +
> > +config HAVEGED
> > +	tristate
> > +	prompt "haveged"
> > +	help
> > +	  haveged is a simple entropy daemon
> > diff --git a/rules/haveged.make b/rules/haveged.make
> > new file mode 100644
> > index 000000000..0ef3559e6
> > --- /dev/null
> > +++ b/rules/haveged.make
> > @@ -0,0 +1,76 @@
> > +# -*-makefile-*-
> > +#
> > +# Copyright (C) 2017 by Robert Schwebel <r.schwebel@pengutronix.de>
> > +#
> > +# See CREDITS for details about who has contributed to this project.
> > +#
> > +# For further information about the PTXdist project and license conditions
> > +# see the README file.
> > +#
> > +
> > +#
> > +# We provide this package
> > +#
> > +PACKAGES-$(PTXCONF_HAVEGED) += haveged
> > +
> > +#
> > +# Paths and names
> > +#
> > +HAVEGED_VERSION	:= 1.9.1
> > +HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
> > +HAVEGED		:= haveged-$(HAVEGED_VERSION)
> > +HAVEGED_SUFFIX	:= tar.gz
> > +HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
> > +HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
> > +HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
> > +HAVEGED_LICENSE	:= GPL-3.0 
> > +
> > +# ----------------------------------------------------------------------------
> > +# Prepare
> > +# ----------------------------------------------------------------------------
> > +
> > +#
> > +# autoconf
> > +#
> > +HAVEGED_CONF_TOOL	:= autoconf
> > +HAVEGED_CONF_OPT	:= \
> > +	$(CROSS_AUTOCONF_USR) \
> > +	--enable-clock_gettime \
> > +	--enable-daemon=yes \
> > +	--enable-diagnostic=no \
> > +	--enable-init=service.fedora \
> > +	--enable-initdir=? \
> > +	--enable-nistest=no \
> > +	--enable-olt=no \
> > +	--enable-threads=no \
> > +	--enable-tune=yes
> > +
> > +# ----------------------------------------------------------------------------
> > +# Target-Install
> > +# ----------------------------------------------------------------------------
> > +
> > +$(STATEDIR)/haveged.targetinstall:
> > +	@$(call targetinfo)
> > +
> > +	@$(call install_init, haveged)
> > +	@$(call install_fixup, haveged,PRIORITY,optional)
> > +	@$(call install_fixup, haveged,SECTION,base)
> > +	@$(call install_fixup, haveged,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
> > +	@$(call install_fixup, haveged,DESCRIPTION,missing)
> > +
> > +	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
> > +	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
> > +
> > +ifdef PTXCONF_INITMETHOD_SYSTEMD
> > +	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)
> > +	@$(call install_link, haveged, \
> > +		../haveged.service, \
> > +		/usr/lib/systemd/system/multi-user.target.wants/haveged.service \
> > +	)
> > +endif
> > +
> > +	@$(call install_finish, haveged)
> > +
> > +	@$(call touch)
> > +
> > +# vim: syntax=make
> > -- 
> > 2.13.2
> > 
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> 
> -- 
> »With the first link, the chain is forged. The first speech censured, 
> the first thought forbidden, the first freedom denied, chains us all 
> irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
> *** GnuPG-FP: C28E E6B9 0263 95CF 8FAF  08FA 34AD CD00 7221 5CC6 ***



> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30  8:19 ` [ptxdist] [PATCH] haveged: add entropy daemon Michael Olbrich
  2017-06-30  8:32   ` Robert Schwebel
@ 2017-07-02 15:26   ` Robert Schwebel
  1 sibling, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2017-07-02 15:26 UTC (permalink / raw)
  To: ptxdist

On Fri, Jun 30, 2017 at 10:19:55AM +0200, Michael Olbrich wrote:
> > +# ----------------------------------------------------------------------------
> > +# Prepare
> > +# ----------------------------------------------------------------------------
> > +
> > +#
> > +# autoconf
> > +#
> > +HAVEGED_CONF_TOOL	:= autoconf
> > +HAVEGED_CONF_OPT	:= \
> > +	$(CROSS_AUTOCONF_USR) \
> > +	--enable-clock_gettime \
> > +	--enable-daemon=yes \
> > +	--enable-diagnostic=no \
> > +	--enable-init=service.fedora \
> > +	--enable-initdir=? \
> 
> --enable-initdir=/usr/lib/systemd/system
> 
> otherwise pkg-config is queried and that requires a dependency on systemd.

Will change in v2.

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30 12:12 ` Michael Olbrich
@ 2017-07-02 15:27   ` Robert Schwebel
  0 siblings, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2017-07-02 15:27 UTC (permalink / raw)
  To: ptxdist

On Fri, Jun 30, 2017 at 02:12:05PM +0200, Michael Olbrich wrote:
> > +HAVEGED_LICENSE	:= GPL-3.0 
> 
> Trailing whitespace.

Will fix in v2.
 
> > +# ----------------------------------------------------------------------------
> > +# Prepare
> > +# ----------------------------------------------------------------------------
> > +
> > +#
> > +# autoconf
> > +#
> > +HAVEGED_CONF_TOOL	:= autoconf
> > +HAVEGED_CONF_OPT	:= \
> > +	$(CROSS_AUTOCONF_USR) \
> > +	--enable-clock_gettime \
> > +	--enable-daemon=yes \
> > +	--enable-diagnostic=no \
> > +	--enable-init=service.fedora \
> > +	--enable-initdir=? \
> > +	--enable-nistest=no \
> > +	--enable-olt=no \
> > +	--enable-threads=no \
> > +	--enable-tune=yes
> 
> Please use --enable-XXX and --disable-XXX, not arguments necessary.

Will fix in v2.

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ptxdist] [PATCHv2] haveged: add entropy daemon
  2017-06-29 21:49 [ptxdist] [PATCH] haveged: add entropy daemon Robert Schwebel
                   ` (2 preceding siblings ...)
  2017-06-30 12:12 ` Michael Olbrich
@ 2017-07-02 15:35 ` Robert Schwebel
  3 siblings, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2017-07-02 15:35 UTC (permalink / raw)
  To: ptxdist; +Cc: Robert Schwebel

Add the haveged package.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---

Changes since v1:
- use "--enable-initdir=/usr/lib/systemd/system" instead of ?,
  otherwise we get a dependency on systemd
- removed trailing whitespace
- removed values from --enable/disable options

 ....ac-fix-handling-for-enable-clock_gettime.patch | 26 ++++++++
 .../0002-init-fix-path-for-systemd-unit-dir.patch  | 24 +++++++
 ...nstallation-of-systemd-unit-file-DESTDIR-.patch | 28 ++++++++
 ...akefile.am-create-nonexisting-directories.patch | 31 +++++++++
 ...file.am-do-not-call-systemd-during-compil.patch | 29 +++++++++
 patches/haveged-1.9.1/autogen.sh                   |  1 +
 patches/haveged-1.9.1/series                       |  8 +++
 rules/haveged.in                                   |  7 ++
 rules/haveged.make                                 | 76 ++++++++++++++++++++++
 9 files changed, 230 insertions(+)
 create mode 100644 patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
 create mode 100644 patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
 create mode 100644 patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
 create mode 100644 patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
 create mode 100644 patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
 create mode 120000 patches/haveged-1.9.1/autogen.sh
 create mode 100644 patches/haveged-1.9.1/series
 create mode 100644 rules/haveged.in
 create mode 100644 rules/haveged.make

diff --git a/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
new file mode 100644
index 000000000..20a34b466
--- /dev/null
+++ b/patches/haveged-1.9.1/0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
@@ -0,0 +1,26 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:30:34 +0200
+Subject: [PATCH] configure.ac: fix handling for --enable-clock_gettime
+
+The logic for this configure option is broken; on ARM, we fall into the
+*) path and the logic decides that this option is not set, no matter if
+we set it or not.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index f8d76c106014..e4f17a80d876 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -175,6 +175,8 @@ case "$host" in
+  *)
+     if test "x$enable_clock_gettime" = "xx"; then
+       enable_clock_gettime="yes"
++    elif test "x$enable_clock_gettime" = "xyes"; then
++      enable_clock_gettime="yes"
+     else
+       AC_MSG_ERROR([no timer source for host :"$host".])
+     fi
diff --git a/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
new file mode 100644
index 000000000..6ae95fbb5
--- /dev/null
+++ b/patches/haveged-1.9.1/0002-init-fix-path-for-systemd-unit-dir.patch
@@ -0,0 +1,24 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:53:16 +0200
+Subject: [PATCH] init: fix path for systemd unit dir
+
+This branch was obviously not tested.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index ca3ad1c1e854..bf86773176a6 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -37,7 +37,7 @@ install-data-hook:
+ if ENABLE_SYSTEMD_LOOKUP
+ 	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
+ else
+-	install -p -m644 haveged.service ($unit_dir)/haveged.service;
++	install -p -m644 haveged.service $(unit_dir)/haveged.service;
+ endif
+ 	systemctl enable haveged.service;
+ 
diff --git a/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
new file mode 100644
index 000000000..5a536871a
--- /dev/null
+++ b/patches/haveged-1.9.1/0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
@@ -0,0 +1,28 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:54:11 +0200
+Subject: [PATCH] init: make installation of systemd unit file DESTDIR aware
+
+The installation currently does not care about a DESTDIR, which is
+imporant when cross compiling.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index bf86773176a6..2f92cb7fdde4 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -35,9 +35,9 @@ install-exec-hook:
+ 
+ install-data-hook:
+ if ENABLE_SYSTEMD_LOOKUP
+-	install -p -m644 haveged.service `pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
++	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
+ else
+-	install -p -m644 haveged.service $(unit_dir)/haveged.service;
++	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
+ endif
+ 	systemctl enable haveged.service;
+ 
diff --git a/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
new file mode 100644
index 000000000..6f693b000
--- /dev/null
+++ b/patches/haveged-1.9.1/0004-init.d-Makefile.am-create-nonexisting-directories.patch
@@ -0,0 +1,31 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 22:59:46 +0200
+Subject: [PATCH] init.d/Makefile.am: create nonexisting directories
+
+install can't assume that all leading directories do already exist.
+While this will in most cases be true on normal desktop/server
+distributions, cross build systems or systems that build single packages
+will build into a fresh hierarchy. Add -D to install, in order to create
+the leading directories.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index 2f92cb7fdde4..4a6e551f0b51 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -35,9 +35,9 @@ install-exec-hook:
+ 
+ install-data-hook:
+ if ENABLE_SYSTEMD_LOOKUP
+-	install -p -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
++	install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
+ else
+-	install -p -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
++	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
+ endif
+ 	systemctl enable haveged.service;
+ 
diff --git a/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
new file mode 100644
index 000000000..359708a18
--- /dev/null
+++ b/patches/haveged-1.9.1/0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
@@ -0,0 +1,29 @@
+From: Robert Schwebel <r.schwebel@pengutronix.de>
+Date: Thu, 29 Jun 2017 23:03:06 +0200
+Subject: [PATCH] init.d/Makefile.am: do not call systemd during compilation
+
+Remove systemd call: we can not assume that the user is allowed to do
+so: he might not if he compiles the software as non-root.
+
+When cross-compiling, the intended systemd might not even run on the
+same hardware.
+
+We better leave the decision whether or not to call systemd to the
+administrator.
+
+Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
+---
+ init.d/Makefile.am | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/init.d/Makefile.am b/init.d/Makefile.am
+index 4a6e551f0b51..efb01e3c8aab 100644
+--- a/init.d/Makefile.am
++++ b/init.d/Makefile.am
+@@ -39,6 +39,4 @@ if ENABLE_SYSTEMD_LOOKUP
+ else
+ 	install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
+ endif
+-	systemctl enable haveged.service;
+-
+ endif
diff --git a/patches/haveged-1.9.1/autogen.sh b/patches/haveged-1.9.1/autogen.sh
new file mode 120000
index 000000000..9f8a4cb7d
--- /dev/null
+++ b/patches/haveged-1.9.1/autogen.sh
@@ -0,0 +1 @@
+../autogen.sh
\ No newline at end of file
diff --git a/patches/haveged-1.9.1/series b/patches/haveged-1.9.1/series
new file mode 100644
index 000000000..0e24f4d6b
--- /dev/null
+++ b/patches/haveged-1.9.1/series
@@ -0,0 +1,8 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-configure.ac-fix-handling-for-enable-clock_gettime.patch
+0002-init-fix-path-for-systemd-unit-dir.patch
+0003-init-make-installation-of-systemd-unit-file-DESTDIR-.patch
+0004-init.d-Makefile.am-create-nonexisting-directories.patch
+0005-init.d-Makefile.am-do-not-call-systemd-during-compil.patch
+# d6dc334689ded00c3e697eb3fe83b57a  - git-ptx-patches magic
diff --git a/rules/haveged.in b/rules/haveged.in
new file mode 100644
index 000000000..9a8a59702
--- /dev/null
+++ b/rules/haveged.in
@@ -0,0 +1,7 @@
+## SECTION=networking
+
+config HAVEGED
+	tristate
+	prompt "haveged"
+	help
+	  haveged is a simple entropy daemon
diff --git a/rules/haveged.make b/rules/haveged.make
new file mode 100644
index 000000000..c2c240aa8
--- /dev/null
+++ b/rules/haveged.make
@@ -0,0 +1,76 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2017 by Robert Schwebel <r.schwebel@pengutronix.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_HAVEGED) += haveged
+
+#
+# Paths and names
+#
+HAVEGED_VERSION	:= 1.9.1
+HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
+HAVEGED		:= haveged-$(HAVEGED_VERSION)
+HAVEGED_SUFFIX	:= tar.gz
+HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
+HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
+HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
+HAVEGED_LICENSE	:= GPL-3.0
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+#
+# autoconf
+#
+HAVEGED_CONF_TOOL	:= autoconf
+HAVEGED_CONF_OPT	:= \
+	$(CROSS_AUTOCONF_USR) \
+	--enable-clock_gettime \
+	--enable-daemon \
+	--disable-diagnostic \
+	--enable-init=service.fedora \
+	--enable-initdir=/usr/lib/systemd/system \
+	--disable-nistest \
+	--disable-olt \
+	--disable-threads \
+	--enable-tune
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/haveged.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, haveged)
+	@$(call install_fixup, haveged,PRIORITY,optional)
+	@$(call install_fixup, haveged,SECTION,base)
+	@$(call install_fixup, haveged,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
+	@$(call install_fixup, haveged,DESCRIPTION,missing)
+
+	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
+	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
+
+ifdef PTXCONF_INITMETHOD_SYSTEMD
+	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)
+	@$(call install_link, haveged, \
+		../haveged.service, \
+		/usr/lib/systemd/system/multi-user.target.wants/haveged.service \
+	)
+endif
+
+	@$(call install_finish, haveged)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
2.13.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30  7:19 ` Alexander Dahl
  2017-06-30 12:16   ` Michael Olbrich
@ 2017-07-02 15:36   ` Robert Schwebel
  2017-07-04 10:48     ` Alexander Dahl
  1 sibling, 1 reply; 16+ messages in thread
From: Robert Schwebel @ 2017-07-02 15:36 UTC (permalink / raw)
  To: ptxdist

Hi Alexander,

On Fri, Jun 30, 2017 at 09:19:18AM +0200, Alexander Dahl wrote:
> tested this without systemd on top of a recent ptxdist 2017.06.0 based
> BSP with the sysv init script from buildroot.

Would you share your patch, on top of my v2 patch?

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30 12:16   ` Michael Olbrich
@ 2017-07-02 15:37     ` Robert Schwebel
  2017-07-06  9:13     ` Alexander Dahl
  1 sibling, 0 replies; 16+ messages in thread
From: Robert Schwebel @ 2017-07-02 15:37 UTC (permalink / raw)
  To: ptxdist

On Fri, Jun 30, 2017 at 02:16:07PM +0200, Michael Olbrich wrote:
> > Besides: is there any way to have this random generator stuff
> > certainly ready before generating dropbear keys (rc-once)?
> 
> I think /dev/random and getrandom() can block until then. Something could
> be built on top of that. However you need to be careful: This may block a
> very long time on an idle embedded system.

So what should we do?

rsc
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-07-02 15:36   ` Robert Schwebel
@ 2017-07-04 10:48     ` Alexander Dahl
  2017-07-06 11:54       ` [ptxdist] [PATCH 0/2] haveged: bbinit startup and more download URLs Alexander Dahl
  0 siblings, 1 reply; 16+ messages in thread
From: Alexander Dahl @ 2017-07-04 10:48 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 818 bytes --]

Hei hei,

On Sun, Jul 02, 2017 at 05:36:55PM +0200, Robert Schwebel wrote:
> On Fri, Jun 30, 2017 at 09:19:18AM +0200, Alexander Dahl wrote:
> > tested this without systemd on top of a recent ptxdist 2017.06.0 based
> > BSP with the sysv init script from buildroot.
> 
> Would you share your patch, on top of my v2 patch?

I put the bbinit stuff for haveged on my ToDo list, 'cause I want to
use it with a non systemd BSP. Michael already applied your v2 to
master, so I will just base a patch on master then.

Greets
Alex

-- 
»With the first link, the chain is forged. The first speech censured, 
the first thought forbidden, the first freedom denied, chains us all 
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: C28E E6B9 0263 95CF 8FAF  08FA 34AD CD00 7221 5CC6 ***

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] [PATCH] haveged: add entropy daemon
  2017-06-30 12:16   ` Michael Olbrich
  2017-07-02 15:37     ` Robert Schwebel
@ 2017-07-06  9:13     ` Alexander Dahl
  1 sibling, 0 replies; 16+ messages in thread
From: Alexander Dahl @ 2017-07-06  9:13 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 1517 bytes --]

Hello,

On Fri, Jun 30, 2017 at 02:16:07PM +0200, Michael Olbrich wrote:
> On Fri, Jun 30, 2017 at 09:19:18AM +0200, Alexander Dahl wrote:
> > Besides: is there any way to have this random generator stuff
> > certainly ready before generating dropbear keys (rc-once)?
> 
> I think /dev/random and getrandom() can block until then. Something could
> be built on top of that. However you need to be careful: This may block a
> very long time on an idle embedded system.

I had a look into dropbearkey now. As far as I understand the code,
dropbear just uses /dev/urandom, but tries to feed some entropy into
it before doing anything with randomness. The "documentation" in
default_options.h suggests /dev/random is used for keygen, but I think
it's wrong (our outdated) and only non blocking randomness is used.

dropbear can use prngd or egd, but no hint in the code on haveged. The
only thing I found on dropbear profiting from haveged is an old ticket
in the OpenWRT bugtracker, but they just do the "hopefully wait long
enough" thing. [1]

So I guess to improve this situation someone may have to talk to
upstream dropbear to discuss some possibilies?

Greets
Alex

[1] https://dev.openwrt.org/ticket/9631

-- 
»With the first link, the chain is forged. The first speech censured, 
the first thought forbidden, the first freedom denied, chains us all 
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: C28E E6B9 0263 95CF 8FAF  08FA 34AD CD00 7221 5CC6 ***

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ptxdist] [PATCH 0/2] haveged: bbinit startup and more download URLs
  2017-07-04 10:48     ` Alexander Dahl
@ 2017-07-06 11:54       ` Alexander Dahl
  2017-07-06 11:54         ` [ptxdist] [PATCH 1/2] haveged: Add URL for upstream tarball archive Alexander Dahl
  2017-07-06 11:54         ` [ptxdist] [PATCH 2/2] haveged: Introduce bbinit startup Alexander Dahl
  0 siblings, 2 replies; 16+ messages in thread
From: Alexander Dahl @ 2017-07-06 11:54 UTC (permalink / raw)
  To: ptxdist

Hei hei,

I made the bbinit startup script for haveged as stated in the
discussion before. This mini series also contains the remainings from
my last year tries on this daemon, everything else was already covered
by Robert.

Greets
Alex


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ptxdist] [PATCH 1/2] haveged: Add URL for upstream tarball archive
  2017-07-06 11:54       ` [ptxdist] [PATCH 0/2] haveged: bbinit startup and more download URLs Alexander Dahl
@ 2017-07-06 11:54         ` Alexander Dahl
  2017-07-06 11:54         ` [ptxdist] [PATCH 2/2] haveged: Introduce bbinit startup Alexander Dahl
  1 sibling, 0 replies; 16+ messages in thread
From: Alexander Dahl @ 2017-07-06 11:54 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Dahl

Signed-off-by: Alexander Dahl <post@lespocky.de>
---
 rules/haveged.make | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rules/haveged.make b/rules/haveged.make
index 6530126..b05b0f6 100644
--- a/rules/haveged.make
+++ b/rules/haveged.make
@@ -20,7 +20,9 @@ HAVEGED_VERSION	:= 1.9.1
 HAVEGED_MD5	:= 015ff58cd10607db0e0de60aeca2f5f8
 HAVEGED		:= haveged-$(HAVEGED_VERSION)
 HAVEGED_SUFFIX	:= tar.gz
-HAVEGED_URL	:= http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX)
+HAVEGED_URL	:= \
+	http://www.issihosts.com/haveged/$(HAVEGED).$(HAVEGED_SUFFIX) \
+	http://www.issihosts.com/haveged/archive/$(HAVEGED).$(HAVEGED_SUFFIX)
 HAVEGED_SOURCE	:= $(SRCDIR)/$(HAVEGED).$(HAVEGED_SUFFIX)
 HAVEGED_DIR	:= $(BUILDDIR)/$(HAVEGED)
 HAVEGED_LICENSE	:= GPL-3.0
-- 
2.1.4


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ptxdist] [PATCH 2/2] haveged: Introduce bbinit startup
  2017-07-06 11:54       ` [ptxdist] [PATCH 0/2] haveged: bbinit startup and more download URLs Alexander Dahl
  2017-07-06 11:54         ` [ptxdist] [PATCH 1/2] haveged: Add URL for upstream tarball archive Alexander Dahl
@ 2017-07-06 11:54         ` Alexander Dahl
  1 sibling, 0 replies; 16+ messages in thread
From: Alexander Dahl @ 2017-07-06 11:54 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Dahl

Added a startup script inspired by upstream, debian, buildroot and the
lldpd startup script already present in ptxdist. Also added the usual
ptxdist menu stuff for daemons started with bbinit method.

Signed-off-by: Alexander Dahl <post@lespocky.de>
---
 projectroot/etc/init.d/haveged | 114 +++++++++++++++++++++++++++++++++++++++++
 rules/haveged-bbinit.in        |   9 ++++
 rules/haveged.in               |  14 ++++-
 rules/haveged.make             |  11 ++++
 4 files changed, 146 insertions(+), 2 deletions(-)
 create mode 100755 projectroot/etc/init.d/haveged
 create mode 100644 rules/haveged-bbinit.in

diff --git a/projectroot/etc/init.d/haveged b/projectroot/etc/init.d/haveged
new file mode 100755
index 0000000..1a4fc62
--- /dev/null
+++ b/projectroot/etc/init.d/haveged
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+PATH='/sbin:/usr/sbin:/bin:/usr/bin'
+DESC='haveged entropy daemon'
+NAME='haveged'
+DAEMON="/usr/sbin/$NAME"
+DAEMON_ARGS='-w 1024 -r 0 -v 1'
+PIDFILE="/var/run/${NAME}.pid"
+SCRIPTNAME="/etc/init.d/$NAME"
+
+# exit if binary is missing
+[ -x "$DAEMON" ] || exit 0
+
+is_running() {
+    start-stop-daemon -K --quiet --test --exec $DAEMON --pidfile $PIDFILE
+}
+
+do_start() {
+    is_running && return 1
+    start-stop-daemon -S --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+        $DAEMON_ARGS \
+        || return 2
+}
+
+do_stop() {
+    is_running || return 0
+    start-stop-daemon -K --quiet --pidfile $PIDFILE --name $NAME
+    RETVAL="$?"
+
+    # wait up to 30 seconds until daemon stopped
+    for i in $(seq 30)
+    do
+        sleep 1
+        echo -n '.'
+        if ! is_running
+        then
+            break
+        fi
+    done
+
+    # see if it's still running
+    if is_running
+    then
+        start-stop-daemon -K --quiet --signal KILL --pidfile $PIDFILE --name $NAME
+
+        for i in $(seq 5)
+        do
+            sleep 1
+            echo -n '.'
+            if ! is_running
+            then
+                break
+            fi
+        done
+
+        if is_running
+        then
+            return 2
+        fi
+    fi
+
+    rm -f $PIDFILE
+    return "$RETVAL"
+}
+
+case "$1" in
+    start)
+        echo -n "Starting $DESC ..."
+        do_start
+        case "$?" in
+            0|1)    echo " Done." ;;
+            2)      echo " Failed." ;;
+        esac
+        ;;
+    stop)
+        echo -n "Stopping $DESC ."
+        do_stop
+        case "$?" in
+            0|1)    echo " Done." ;;
+            2)      echo " Failed." ;;
+        esac
+        ;;
+    restart)
+        echo -n "Restarting $DESC .."
+        do_stop
+        case "$?" in
+            0|1)
+                do_start
+                case "$?" in
+                    0)  echo " Done." ;;
+                    1)  echo " Failed." ;; # Old process still running
+                    *)  echo " Failed." ;; # Failed to start
+                esac
+                ;;
+            *)
+                echo " Failed." # Failed to stop
+                ;;
+        esac
+        ;;
+    status)
+        if is_running
+        then
+            echo "$NAME is running with PID $(cat $PIDFILE) ..."
+        else
+            echo "$NAME is not running"
+        fi
+        ;;
+    *)
+        echo "Usage: $SCRIPTNAME {start|stop|restart|status}" >&2
+        exit 3
+        ;;
+esac
+
+:
diff --git a/rules/haveged-bbinit.in b/rules/haveged-bbinit.in
new file mode 100644
index 0000000..b6aee22
--- /dev/null
+++ b/rules/haveged-bbinit.in
@@ -0,0 +1,9 @@
+## SECTION=initmethod_bbinit
+
+config HAVEGED_BBINIT_LINK
+	string
+	depends on HAVEGED_STARTSCRIPT
+	prompt "haveged"
+	default "S21haveged"
+
+# vim: ft=kconfig noet tw=72
diff --git a/rules/haveged.in b/rules/haveged.in
index 9a8a597..f048327 100644
--- a/rules/haveged.in
+++ b/rules/haveged.in
@@ -1,7 +1,17 @@
 ## SECTION=networking
 
-config HAVEGED
+menuconfig HAVEGED
 	tristate
-	prompt "haveged"
+	prompt "haveged                       "
+	select BUSYBOX_START_STOP_DAEMON if HAVEGED_STARTSCRIPT
+	select BUSYBOX_FEATURE_START_STOP_DAEMON_LONG_OPTIONS if HAVEGED_STARTSCRIPT
 	help
 	  haveged is a simple entropy daemon
+
+if HAVEGED
+
+config HAVEGED_STARTSCRIPT
+	bool
+	prompt "install /etc/init.d/haveged"
+
+endif
diff --git a/rules/haveged.make b/rules/haveged.make
index b05b0f6..af5fa0b 100644
--- a/rules/haveged.make
+++ b/rules/haveged.make
@@ -63,6 +63,17 @@ $(STATEDIR)/haveged.targetinstall:
 	@$(call install_lib, haveged, 0, 0, 0644, libhavege)
 	@$(call install_copy, haveged, 0, 0, 0755, -, /usr/sbin/haveged)
 
+ifdef PTXCONF_INITMETHOD_BBINIT
+ifdef PTXCONF_HAVEGED_STARTSCRIPT
+	@$(call install_alternative, haveged, 0, 0, 0755, /etc/init.d/haveged)
+
+ifneq ($(call remove_quotes,$(PTXCONF_HAVEGED_BBINIT_LINK)),)
+	@$(call install_link, haveged, ../init.d/haveged, \
+		/etc/rc.d/$(PTXCONF_HAVEGED_BBINIT_LINK))
+endif
+endif
+endif
+
 ifdef PTXCONF_INITMETHOD_SYSTEMD
 	@$(call install_copy, haveged, 0, 0, 0644, -, /usr/lib/systemd/system/haveged.service)
 	@$(call install_link, haveged, ../haveged.service, \
-- 
2.1.4


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2017-07-06 11:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 21:49 [ptxdist] [PATCH] haveged: add entropy daemon Robert Schwebel
2017-06-30  7:19 ` Alexander Dahl
2017-06-30 12:16   ` Michael Olbrich
2017-07-02 15:37     ` Robert Schwebel
2017-07-06  9:13     ` Alexander Dahl
2017-07-02 15:36   ` Robert Schwebel
2017-07-04 10:48     ` Alexander Dahl
2017-07-06 11:54       ` [ptxdist] [PATCH 0/2] haveged: bbinit startup and more download URLs Alexander Dahl
2017-07-06 11:54         ` [ptxdist] [PATCH 1/2] haveged: Add URL for upstream tarball archive Alexander Dahl
2017-07-06 11:54         ` [ptxdist] [PATCH 2/2] haveged: Introduce bbinit startup Alexander Dahl
2017-06-30  8:19 ` [ptxdist] [PATCH] haveged: add entropy daemon Michael Olbrich
2017-06-30  8:32   ` Robert Schwebel
2017-07-02 15:26   ` Robert Schwebel
2017-06-30 12:12 ` Michael Olbrich
2017-07-02 15:27   ` Robert Schwebel
2017-07-02 15:35 ` [ptxdist] [PATCHv2] " Robert Schwebel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox