* [PATCH 1/2] rng-tools: Import recipe from meta-openembedded
@ 2016-02-12 18:55 Saul Wold
2016-02-12 18:55 ` [PATCH 2/2] qemu.inc: Add rng-tools to qemu images Saul Wold
2016-02-12 20:20 ` [PATCH 1/2] rng-tools: Import recipe from meta-openembedded Burton, Ross
0 siblings, 2 replies; 3+ messages in thread
From: Saul Wold @ 2016-02-12 18:55 UTC (permalink / raw)
To: openembedded-core, richard.purdie
Adding this recipe to oe-core will allow it to be used by qemu to
provide a way to generate additional entropy needed to fix hangs
with getrandom().
Additional kernel config options have already been added to the
default qemu kernel configs.
[YOCTO #8681]
[YOCOT #8816]
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/recipes-support/rng-tools/rng-tools/default | 3 ++
meta/recipes-support/rng-tools/rng-tools/init | 49 ++++++++++++++++++++++++
meta/recipes-support/rng-tools/rng-tools_5.bb | 38 ++++++++++++++++++
3 files changed, 90 insertions(+)
create mode 100644 meta/recipes-support/rng-tools/rng-tools/default
create mode 100644 meta/recipes-support/rng-tools/rng-tools/init
create mode 100644 meta/recipes-support/rng-tools/rng-tools_5.bb
diff --git a/meta/recipes-support/rng-tools/rng-tools/default b/meta/recipes-support/rng-tools/rng-tools/default
new file mode 100644
index 0000000..7aede9b
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/default
@@ -0,0 +1,3 @@
+# Specify rng device
+#RNG_DEVICE=/dev/hwrng
+RNG_DEVICE=/dev/urandom
diff --git a/meta/recipes-support/rng-tools/rng-tools/init b/meta/recipes-support/rng-tools/rng-tools/init
new file mode 100644
index 0000000..7cf7839
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools/init
@@ -0,0 +1,49 @@
+#! /bin/sh
+#
+# This is an init script for openembedded
+# Copy it to /etc/init.d/rng-tools and type
+# > update-rc.d rng-tools defaults 60
+#
+
+rngd=/usr/sbin/rngd
+test -x "$rngd" || exit 1
+
+if [ -e /etc/default/rng-tools ]; then
+ . /etc/default/rng-tools
+fi
+
+if [ -n "$RNG_DEVICE" ]; then
+ EXTRA_ARGS="-- -r $RNG_DEVICE"
+fi
+
+
+case "$1" in
+ start)
+ echo -n "Starting random number generator daemon"
+ start-stop-daemon -S -q -x $rngd $EXTRA_ARGS
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping random number generator daemon"
+ start-stop-daemon -K -q -n rngd
+ echo "."
+ ;;
+ reload|force-reload)
+ echo -n "Signalling rng daemon restart"
+ start-stop-daemon -K -q -s 1 -x $rngd
+ start-stop-daemon -K -q -s 1 -x $rngd
+ ;;
+ restart)
+ echo -n "Stopping random number generator daemon"
+ start-stop-daemon -K -q -n rngd
+ echo "."
+ echo -n "Starting random number generator daemon"
+ start-stop-daemon -S -q -x $rngd $EXTRA_ARGS
+ echo "."
+ ;;
+ *)
+ echo "Usage: /etc/init.d/rng-tools {start|stop|reload|restart|force-reload}"
+ exit 1
+esac
+
+exit 0
diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb
new file mode 100644
index 0000000..67f53f2
--- /dev/null
+++ b/meta/recipes-support/rng-tools/rng-tools_5.bb
@@ -0,0 +1,38 @@
+SUMMARY = "Random number generator daemon"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0b6f033afe6db235e559456585dc8cdc"
+DEPENDS_append_libc-uclibc = " argp-standalone"
+
+SRC_URI = "http://heanet.dl.sourceforge.net/sourceforge/gkernel/${BP}.tar.gz \
+ file://init \
+ file://default"
+
+SRC_URI[md5sum] = "6726cdc6fae1f5122463f24ae980dd68"
+SRC_URI[sha256sum] = "60a102b6603bbcce2da341470cad42eeaa9564a16b4490e7867026ca11a3078e"
+
+# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
+# manually to avoid unnecessary postinst/preinst generated.
+python () {
+ if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+ d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}
+
+inherit autotools update-rc.d
+
+RDEPENDS_${PN} = "libgcrypt"
+
+do_install_append() {
+ # Only install the init script when 'sysvinit' is in DISTRO_FEATURES.
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
+ install -d "${D}${sysconfdir}/init.d"
+ install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools
+ sed -i -e 's,/etc/,${sysconfdir}/,' -e 's,/usr/sbin/,${sbindir}/,' \
+ ${D}${sysconfdir}/init.d/rng-tools
+
+ install -d "${D}${sysconfdir}/default"
+ install -m 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools
+ fi
+}
+
+INITSCRIPT_NAME = "rng-tools"
+INITSCRIPT_PARAMS = "start 30 S . stop 30 0 6 1 ."
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] qemu.inc: Add rng-tools to qemu images
2016-02-12 18:55 [PATCH 1/2] rng-tools: Import recipe from meta-openembedded Saul Wold
@ 2016-02-12 18:55 ` Saul Wold
2016-02-12 20:20 ` [PATCH 1/2] rng-tools: Import recipe from meta-openembedded Burton, Ross
1 sibling, 0 replies; 3+ messages in thread
From: Saul Wold @ 2016-02-12 18:55 UTC (permalink / raw)
To: openembedded-core, richard.purdie
This patch adds rng-tools to MACHINE_EXTRA_RRECOMMENDS so that can be
used to provide the additional entropy to prevent hangs in getrandom()
for qemu images
[YOCTO #8681]
[YOCTO #8816]
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
meta/conf/machine/include/qemu.inc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/conf/machine/include/qemu.inc b/meta/conf/machine/include/qemu.inc
index 16e9469..f44dbe6 100644
--- a/meta/conf/machine/include/qemu.inc
+++ b/meta/conf/machine/include/qemu.inc
@@ -27,3 +27,5 @@ EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
# Provide the nfs server kernel module for all qemu images
KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc"
+
+MACHINE_EXTRA_RRECOMMENDS += "rng-tools"
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] rng-tools: Import recipe from meta-openembedded
2016-02-12 18:55 [PATCH 1/2] rng-tools: Import recipe from meta-openembedded Saul Wold
2016-02-12 18:55 ` [PATCH 2/2] qemu.inc: Add rng-tools to qemu images Saul Wold
@ 2016-02-12 20:20 ` Burton, Ross
1 sibling, 0 replies; 3+ messages in thread
From: Burton, Ross @ 2016-02-12 20:20 UTC (permalink / raw)
To: Saul Wold; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
On 12 February 2016 at 18:55, Saul Wold <sgw@linux.intel.com> wrote:
> +# As the recipe doesn't inherit systemd.bbclass, we need to set this
> variable
> +# manually to avoid unnecessary postinst/preinst generated.
> +python () {
> + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False,
> d):
> + d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
> +}
>
Can't help but think that stealing a unit from Fedora would clean this and
the do_install_append logic up (conditionals are not required if systemd is
inherited as it removes those for you).
Ross
[-- Attachment #2: Type: text/html, Size: 1039 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-12 20:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12 18:55 [PATCH 1/2] rng-tools: Import recipe from meta-openembedded Saul Wold
2016-02-12 18:55 ` [PATCH 2/2] qemu.inc: Add rng-tools to qemu images Saul Wold
2016-02-12 20:20 ` [PATCH 1/2] rng-tools: Import recipe from meta-openembedded Burton, Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox