mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] rng-tools: new package for rng-tools (rngd) version 5
Date: Thu, 13 Nov 2014 17:52:04 +0100	[thread overview]
Message-ID: <20141113165204.GT30196@pengutronix.de> (raw)
In-Reply-To: <1414342924-19265-1-git-send-email-apr@cn-eng.de>

On Sun, Oct 26, 2014 at 06:02:04PM +0100, Andreas Pretzsch wrote:
> random number generator daemon - seed kernel random from hwrng
> 
> This daemon feeds data from a random number generator to the kernel's
> random number entropy pool, after first checking the data to ensure
> that it is properly random.
> 
> By default, a hardware rng at /dev/hwrng is used as entropy source.
> 
> This daemon is part of the rng-tools, which can be found at
>     http://sourceforge.net/projects/gkernel/
>     git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
> 
> Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>

Thanks, applied. I've changed the prefix to /usr. That's what Debian is
using and I didn't see a reason not to use that as well.

Michael

> ---
> 
> Start script is kept as simple as possible, as this one runs rather
> early and does not need much.
> 
> The link default of "S00" in rc.d is intentional. rc-once is S01 by
> default and triggers things like ssh key generation. So while in
> other cases I would have set rngd to something around S10, it has to
> squeeze in before rc-once. As there are no udev depends (the other
> S00), being a kernel provided device, this should be ok.
> 
> Placing the daemon in /sbin also follows this fact, beside its
> very system-near function.
> 
>  generic/etc/init.d/rngd   | 40 +++++++++++++++++++++++++++++++++
>  rules/rng-tools-bbinit.in | 10 +++++++++
>  rules/rng-tools.in        | 23 +++++++++++++++++++
>  rules/rng-tools.make      | 57 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 130 insertions(+)
>  create mode 100644 generic/etc/init.d/rngd
>  create mode 100644 rules/rng-tools-bbinit.in
>  create mode 100644 rules/rng-tools.in
>  create mode 100644 rules/rng-tools.make
> 
> diff --git a/generic/etc/init.d/rngd b/generic/etc/init.d/rngd
> new file mode 100644
> index 0000000..cdae9db
> --- /dev/null
> +++ b/generic/etc/init.d/rngd
> @@ -0,0 +1,40 @@
> +#!/bin/sh
> +#
> +# Start/stop rngd (random number generator daemon) from rng-tools
> +#
> +
> +# defaults are sane, normally no need to override
> +OPTIONS=
> +
> +# pid-file created from rngd by default
> +PIDFILE=/var/run/rngd.pid
> +
> +case $1 in
> +	start)
> +		if [ -e $PIDFILE ]; then
> +			echo "rngd already running (found $PIDFILE)"
> +		else
> +			echo "starting rngd"
> +			/sbin/rngd $OPTIONS
> +		fi
> +		;;
> +
> +	stop)
> +		if [ -e $PIDFILE ]; then
> +			echo "stopping rngd"
> +			kill -s SIGTERM `cat $PIDFILE`
> +		else
> +			echo "rngd not running (no $PIDFILE)"
> +		fi
> +		;;
> +
> +	restart)
> +		$0 stop
> +		$0 start
> +		;;
> +
> +	*)
> +		echo "Usage: ${0} {start|stop|restart}"
> +		exit 1
> +		;;
> +esac
> diff --git a/rules/rng-tools-bbinit.in b/rules/rng-tools-bbinit.in
> new file mode 100644
> index 0000000..7cb74aa
> --- /dev/null
> +++ b/rules/rng-tools-bbinit.in
> @@ -0,0 +1,10 @@
> +## SECTION=initmethod_bbinit
> +
> +config RNG_TOOLS_BBINIT_LINK
> +	string
> +	depends on RNG_TOOLS_STARTSCRIPT
> +	prompt "rng-tools"
> +	default "S00rngd"
> +	help
> +	  Order in start sequence.
> +	  Note: Start before rc-once to seed random before e.g. key creation.
> diff --git a/rules/rng-tools.in b/rules/rng-tools.in
> new file mode 100644
> index 0000000..8282b93
> --- /dev/null
> +++ b/rules/rng-tools.in
> @@ -0,0 +1,23 @@
> +## SECTION=shell_and_console
> +
> +config RNG_TOOLS
> +	tristate
> +	prompt "rng-tools rngd"
> +	help
> +	  random number generator daemon - seed kernel random from hwrng
> +
> +	  This daemon feeds data from a random number generator to the kernel's
> +	  random number entropy pool, after first checking the data to ensure
> +	  that it is properly random.
> +
> +	  By default, a hardware rng at /dev/hwrng is used as entropy source.
> +
> +	  This daemon is part of the rng-tools, which can be found at
> +	      http://sourceforge.net/projects/gkernel/
> +	      git://git.kernel.org/pub/scm/utils/kernel/rng-tools/rng-tools.git
> +
> +config RNG_TOOLS_STARTSCRIPT
> +	bool
> +	default y
> +	depends on RNG_TOOLS
> +	prompt "install /etc/init.d/rngd"
> diff --git a/rules/rng-tools.make b/rules/rng-tools.make
> new file mode 100644
> index 0000000..22f26fd
> --- /dev/null
> +++ b/rules/rng-tools.make
> @@ -0,0 +1,57 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2014 by Andreas Pretzsch <apr@cn-eng.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.
> +#
> +
> +PACKAGES-$(PTXCONF_RNG_TOOLS) += rng-tools
> +
> +RNG_TOOLS_VERSION	:= 5
> +RNG_TOOLS_MD5		:= 6726cdc6fae1f5122463f24ae980dd68
> +RNG_TOOLS		:= rng-tools-$(RNG_TOOLS_VERSION)
> +RNG_TOOLS_SUFFIX	:= tar.gz
> +RNG_TOOLS_URL		:= $(call ptx/mirror, SF, gkernel/$(RNG_TOOLS).$(RNG_TOOLS_SUFFIX))
> +RNG_TOOLS_SOURCE	:= $(SRCDIR)/$(RNG_TOOLS).$(RNG_TOOLS_SUFFIX)
> +RNG_TOOLS_DIR		:= $(BUILDDIR)/$(RNG_TOOLS)
> +RNG_TOOLS_LICENSE	:= GPLv2
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +RNG_TOOLS_CONF_TOOL	:= autoconf
> +RNG_TOOLS_CONF_OPT	:= $(CROSS_AUTOCONF_ROOT)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/rng-tools.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, rng-tools)
> +	@$(call install_fixup, rng-tools,PRIORITY,optional)
> +	@$(call install_fixup, rng-tools,SECTION,base)
> +	@$(call install_fixup, rng-tools,AUTHOR,"Andreas Pretzsch <apr@cn-eng.de>")
> +	@$(call install_fixup, rng-tools,DESCRIPTION,"random number generator daemon - seed kernel random from hwrng")
> +
> +	@$(call install_copy, rng-tools, 0, 0, 0755, -, /sbin/rngd)
> +ifdef PTXCONF_INITMETHOD_BBINIT
> +ifdef PTXCONF_RNG_TOOLS_STARTSCRIPT
> +	@$(call install_alternative, rng-tools, 0, 0, 0755, /etc/init.d/rngd)
> +ifneq ($(call remove_quotes,$(PTXCONF_RNG_TOOLS_BBINIT_LINK)),)
> +	@$(call install_link, rng-tools, \
> +		../init.d/rngd, \
> +		/etc/rc.d/$(PTXCONF_RNG_TOOLS_BBINIT_LINK))
> +endif
> +endif
> +endif
> +	@$(call install_finish, rng-tools)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make
> -- 
> 2.1.1
> 
> 
> -- 
> 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

  reply	other threads:[~2014-11-13 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26 17:02 Andreas Pretzsch
2014-11-13 16:52 ` Michael Olbrich [this message]
2014-11-16 15:47   ` Andreas Pretzsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141113165204.GT30196@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox