From 70cf1cf5e55236394131d4160c18088c869f3b6a Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Sun, 22 Aug 2021 14:51:02 +0200 Subject: rng-tools: upgrade 6.13 -> 6.14 (From OE-Core rev: 28b3d8c01966d16f8ab8d61beaf9527f987f1ec6) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- ...ity-to-detect-non-posix-extensions-for-pt.patch | 41 +++++++++++++++ ...se-of-either-pthread-affinity-set-methods.patch | 47 +++++++++++++++++ meta/recipes-support/rng-tools/rng-tools_6.13.bb | 60 --------------------- meta/recipes-support/rng-tools/rng-tools_6.14.bb | 61 ++++++++++++++++++++++ 4 files changed, 149 insertions(+), 60 deletions(-) create mode 100644 meta/recipes-support/rng-tools/rng-tools/0001-Adding-ability-to-detect-non-posix-extensions-for-pt.patch create mode 100644 meta/recipes-support/rng-tools/rng-tools/0002-Allow-for-use-of-either-pthread-affinity-set-methods.patch delete mode 100644 meta/recipes-support/rng-tools/rng-tools_6.13.bb create mode 100644 meta/recipes-support/rng-tools/rng-tools_6.14.bb diff --git a/meta/recipes-support/rng-tools/rng-tools/0001-Adding-ability-to-detect-non-posix-extensions-for-pt.patch b/meta/recipes-support/rng-tools/rng-tools/0001-Adding-ability-to-detect-non-posix-extensions-for-pt.patch new file mode 100644 index 0000000000..89edc4c403 --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools/0001-Adding-ability-to-detect-non-posix-extensions-for-pt.patch @@ -0,0 +1,41 @@ +From 66e6adc138eef1367d7492fb79ae4da84ed62934 Mon Sep 17 00:00:00 2001 +From: Neil Horman +Date: Thu, 15 Jul 2021 08:43:01 -0400 +Subject: [PATCH] Adding ability to detect non-posix extensions for pthreads + +Theres a desire to build rngd with musl, which doesn't have all the gnu +extensions (but it has some). So test for those. Note, this requires +the addition of the USE_EXTENSIONS macro to enable -d_GNU_SOURCE + +Upstream-Status: Backport +Signed-off-by: Neil Horman +Signed-off-by: Alexander Kanavin +--- + configure.ac | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/configure.ac b/configure.ac +index 9df633d..d0c2179 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -25,6 +25,7 @@ AC_CANONICAL_TARGET dnl required for broken AX_PTHREAD + AM_INIT_AUTOMAKE([foreign]) + AC_CONFIG_HEADERS([rng-tools-config.h]) + AC_CONFIG_MACRO_DIRS([m4]) ++AC_USE_SYSTEM_EXTENSIONS + + dnl Parse options + +@@ -100,6 +101,12 @@ AS_IF( + ], [AC_MSG_NOTICE([Disabling JITTER entropy source])] + ) + ++AC_CHECK_DECL(pthread_attr_setaffinity_np, ++ [AC_DEFINE([HAVE_PTHREAD_ATTR_SETAFFINITY], 1,[Set ATTR_SETAFFINITY])], ++ [ AC_CHECK_DECL(pthread_setaffinity_np, ++ [AC_DEFINE([HAVE_PTHREAD_SETAFFINITY],1, [Set PTHREAD_SETAFFINITY])], [ AC_MSG_ERROR([Neither pthread_setaffinity_np nor pthread_attr_setaffinity_np found])],[[#include ]]) ++ ], [[#include ]]) ++ + AS_IF( + [ test "x$with_nistbeacon" != "xno"], + [ diff --git a/meta/recipes-support/rng-tools/rng-tools/0002-Allow-for-use-of-either-pthread-affinity-set-methods.patch b/meta/recipes-support/rng-tools/rng-tools/0002-Allow-for-use-of-either-pthread-affinity-set-methods.patch new file mode 100644 index 0000000000..f7470d04bf --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools/0002-Allow-for-use-of-either-pthread-affinity-set-methods.patch @@ -0,0 +1,47 @@ +From e4909f329245db52415102e96fc7c99ca1445d05 Mon Sep 17 00:00:00 2001 +From: Neil Horman +Date: Thu, 15 Jul 2021 08:48:10 -0400 +Subject: [PATCH] Allow for use of either pthread affinity set methods + +musl has support for pthread_setaffinity_np, but not +pthread_attr_setaffinity_np. so check for hte existence of either +function in configure, and use the appropriate one. + +Upstream-Status: Backport +Signed-off-by: Neil Horman +Signed-off-by: Alexander Kanavin +--- + rngd_jitter.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/rngd_jitter.c b/rngd_jitter.c +index ea29436..5c7e09e 100644 +--- a/rngd_jitter.c ++++ b/rngd_jitter.c +@@ -67,12 +67,25 @@ static int rngd_notime_start(void *ctx, + for(i=i-1;i>=0;i--) { + CPU_SET(i,cpus); + } +- pthread_attr_setaffinity_np(&thread_ctx->notime_pthread_attr, cpusize, cpus); + ++ /* ++ * Note that only one of: ++ * HAVE_PTHREAD_ATTR_SETAFFINITY ++ * and ++ * HAVE_PTHREAD_SETAFFINITY ++ * Will ever be set, as per the configure.ac logic ++ */ ++#ifdef HAVE_PTHREAD_ATTR_SETAFFINITY ++ pthread_attr_setaffinity_np(&thread_ctx->notime_pthread_attr, cpusize, cpus); ++#endif + ret = -pthread_create(&thread_ctx->notime_thread_id, + &thread_ctx->notime_pthread_attr, + start_routine, arg); + ++#ifdef HAVE_PTHREAD_SETAFFINITY ++ pthread_setaffinity_np(&thread_ctx->notime_thread_id, cpusize, cpus); ++#endif ++ + CPU_FREE(cpus); + return ret; + } diff --git a/meta/recipes-support/rng-tools/rng-tools_6.13.bb b/meta/recipes-support/rng-tools/rng-tools_6.13.bb deleted file mode 100644 index 84dbc76855..0000000000 --- a/meta/recipes-support/rng-tools/rng-tools_6.13.bb +++ /dev/null @@ -1,60 +0,0 @@ -SUMMARY = "Random number generator daemon" -DESCRIPTION = "Check and feed random data from hardware device to kernel" -AUTHOR = "Philipp Rumpf, Jeff Garzik , \ - Henrique de Moraes Holschuh " -HOMEPAGE = "https://github.com/nhorman/rng-tools" -BUGTRACKER = "https://github.com/nhorman/rng-tools/issues" -LICENSE = "GPLv2" -LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" -DEPENDS = "sysfsutils openssl" - -SRC_URI = "\ - git://github.com/nhorman/rng-tools.git \ - file://init \ - file://default \ - file://rngd.service \ -" -SRCREV = "d8dac0e8bede73e42b3d59f3b48c662ad0032e8c" - -S = "${WORKDIR}/git" - -inherit autotools update-rc.d systemd pkgconfig - -EXTRA_OECONF = "--without-rtlsdr" - -PACKAGECONFIG ??= "libjitterentropy" -PACKAGECONFIG:libc-musl = "libargp libjitterentropy" - -PACKAGECONFIG[libargp] = "--with-libargp,--without-libargp,argp-standalone," -PACKAGECONFIG[libjitterentropy] = "--enable-jitterentropy,--disable-jitterentropy,libjitterentropy" -PACKAGECONFIG[libp11] = "--with-pkcs11,--without-pkcs11,libp11 openssl" -PACKAGECONFIG[nistbeacon] = "--with-nistbeacon,--without-nistbeacon,curl libxml2 openssl" - -INITSCRIPT_NAME = "rng-tools" -INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 30 0 6 1 ." - -SYSTEMD_SERVICE:${PN} = "rngd.service" - -# Refer autogen.sh in rng-tools -do_configure:prepend() { - cp ${S}/README.md ${S}/README -} - -do_install:append() { - install -Dm 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools - install -Dm 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools - install -Dm 0644 ${WORKDIR}/rngd.service \ - ${D}${systemd_system_unitdir}/rngd.service - sed -i \ - -e 's,@SYSCONFDIR@,${sysconfdir},g' \ - -e 's,@SBINDIR@,${sbindir},g' \ - ${D}${sysconfdir}/init.d/rng-tools \ - ${D}${systemd_system_unitdir}/rngd.service - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'nistbeacon', 'yes', 'no', d)}" = "yes" ]; then - sed -i \ - -e '/^IPAddressDeny=any/d' \ - -e '/^RestrictAddressFamilies=/ s/$/ AF_INET AF_INET6/' \ - ${D}${systemd_system_unitdir}/rngd.service - fi -} diff --git a/meta/recipes-support/rng-tools/rng-tools_6.14.bb b/meta/recipes-support/rng-tools/rng-tools_6.14.bb new file mode 100644 index 0000000000..6b79a3b040 --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools_6.14.bb @@ -0,0 +1,61 @@ +SUMMARY = "Random number generator daemon" +DESCRIPTION = "Check and feed random data from hardware device to kernel" +AUTHOR = "Philipp Rumpf, Jeff Garzik , \ + Henrique de Moraes Holschuh " +HOMEPAGE = "https://github.com/nhorman/rng-tools" +BUGTRACKER = "https://github.com/nhorman/rng-tools/issues" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" +DEPENDS = "sysfsutils openssl" + +SRC_URI = "git://github.com/nhorman/rng-tools.git \ + file://init \ + file://default \ + file://rngd.service \ + file://0001-Adding-ability-to-detect-non-posix-extensions-for-pt.patch \ + file://0002-Allow-for-use-of-either-pthread-affinity-set-methods.patch \ + " +SRCREV = "c16176d3800b91f4d016b66733b384493b06f294" + +S = "${WORKDIR}/git" + +inherit autotools update-rc.d systemd pkgconfig + +EXTRA_OECONF = "--without-rtlsdr" + +PACKAGECONFIG ??= "libjitterentropy" +PACKAGECONFIG:libc-musl = "libargp libjitterentropy" + +PACKAGECONFIG[libargp] = "--with-libargp,--without-libargp,argp-standalone," +PACKAGECONFIG[libjitterentropy] = "--enable-jitterentropy,--disable-jitterentropy,libjitterentropy" +PACKAGECONFIG[libp11] = "--with-pkcs11,--without-pkcs11,libp11 openssl" +PACKAGECONFIG[nistbeacon] = "--with-nistbeacon,--without-nistbeacon,curl libxml2 openssl" + +INITSCRIPT_NAME = "rng-tools" +INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 30 0 6 1 ." + +SYSTEMD_SERVICE:${PN} = "rngd.service" + +# Refer autogen.sh in rng-tools +do_configure:prepend() { + cp ${S}/README.md ${S}/README +} + +do_install:append() { + install -Dm 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools + install -Dm 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools + install -Dm 0644 ${WORKDIR}/rngd.service \ + ${D}${systemd_system_unitdir}/rngd.service + sed -i \ + -e 's,@SYSCONFDIR@,${sysconfdir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + ${D}${sysconfdir}/init.d/rng-tools \ + ${D}${systemd_system_unitdir}/rngd.service + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'nistbeacon', 'yes', 'no', d)}" = "yes" ]; then + sed -i \ + -e '/^IPAddressDeny=any/d' \ + -e '/^RestrictAddressFamilies=/ s/$/ AF_INET AF_INET6/' \ + ${D}${systemd_system_unitdir}/rngd.service + fi +} -- cgit v1.2.3-54-g00ecf