rng-tools: Import recipe from meta-openembedded
PATCH 1/2 rng-tools: Import recipe from meta-openembedded
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]
--- 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
meta/recipes-support/rng-tools/rng-tools/default new file +3 -0
@@ -0,0 +1,3 @@ +# Specify rng device +#RNG_DEVICE=/dev/hwrng +RNG_DEVICE=/dev/urandom
meta/recipes-support/rng-tools/rng-tools/init new file +49 -0
49 lines not on this page · raw message
meta/recipes-support/rng-tools/rng-tools_5.bb new file +38 -0
@@ -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 ."
Signature · 1 line
2.5.0
PATCH 2/2 qemu.inc: Add rng-tools to qemu images
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]
--- meta/conf/machine/include/qemu.inc | 2 ++ 1 file changed, 2 insertions(+)
meta/conf/machine/include/qemu.inc +2 -0
@@ -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"
Signature · 1 line
2.5.0
Review
Quoted 9 lines · Saul Wold
+# As the recipe doesn't inherit systemd.bbclass, we need to set this variable
meta/recipes-support/rng-tools/rng-tools_5.bb new file +3
-0+# manually to avoid unnecessary postinst/preinst generated. +python () { + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False,d):
(quoted diff) +2
-0+ 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