From cb471c13a639c143d1eb1558df7b432ad5ca42e0 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Tue, 29 May 2018 02:14:06 +0000 Subject: [PATCH] added extra/haveged --- extra/haveged/PKGBUILD | 44 +++++++++++++++++++ .../fix-cpu-cache-size-detection.patch | 15 +++++++ extra/haveged/haveged.service | 13 ++++++ 3 files changed, 72 insertions(+) create mode 100644 extra/haveged/PKGBUILD create mode 100644 extra/haveged/fix-cpu-cache-size-detection.patch create mode 100644 extra/haveged/haveged.service diff --git a/extra/haveged/PKGBUILD b/extra/haveged/PKGBUILD new file mode 100644 index 000000000..78a2e93db --- /dev/null +++ b/extra/haveged/PKGBUILD @@ -0,0 +1,44 @@ +# $Id$ +# Maintainer: Bartłomiej Piotrowski +# Contributor: kfgz +# Contributor: pootzko + +# ALARM: Kevin Mihelich +# - patch from Alpine Linux to fix cache detection issues on ARM + +pkgname=haveged +pkgver=1.9.1 +pkgrel=4.1 +pkgdesc='Entropy harvesting daemon using CPU timings' +arch=('i686' 'x86_64') +url='http://www.issihosts.com/haveged' +license=('GPL') +depends=('glibc') +validpgpkeys=('4CFBA9F06A360837CE23919DA24EDC651E265688') # Gary Wuertz +source=("$url/$pkgname-$pkgver.tar.gz" + "$pkgname-$pkgver.tar.gz.sig::$url/verify/$pkgname-$pkgver.sig" + 'haveged.service' + 'fix-cpu-cache-size-detection.patch') +sha256sums=('9c2363ed9542a6784ff08e247182137e71f2ddb79e8e6c1ac4ad50d21ced3715' + 'SKIP' + '43540fbff57c5106e4283dd7b331499648e38ba15e84898ef5e0a53cccc0200b' + '5aecfd72a1dbb9cc9b32d5677917d8a59dba7a2e021e31dee95f3f5b9e7ecf28') + +prepare() { + cd $pkgname-$pkgver + patch -p1 -i ../fix-cpu-cache-size-detection.patch +} + +build() { + cd $pkgname-$pkgver + ./configure \ + --prefix=/usr \ + --bindir=/usr/bin \ + --sbindir=/usr/bin + make +} + +package() { + make -C $pkgname-$pkgver DESTDIR="$pkgdir" install + install -Dm644 haveged.service "$pkgdir"/usr/lib/systemd/system/haveged.service +} diff --git a/extra/haveged/fix-cpu-cache-size-detection.patch b/extra/haveged/fix-cpu-cache-size-detection.patch new file mode 100644 index 000000000..07da2b46d --- /dev/null +++ b/extra/haveged/fix-cpu-cache-size-detection.patch @@ -0,0 +1,15 @@ +Some ARM cpus does not report the cache size or say it is -1 + +diff --git a/src/havegetune.c b/src/havegetune.c +index f1a99f2..de39c53 100644 +--- a/src/havegetune.c ++++ b/src/havegetune.c +@@ -795,6 +795,8 @@ static int vfs_configInfoCache( + ctype = vfs_configFile(pAnchor, path, vfs_configType); + strcpy(path+plen, "size"); + size = vfs_configFile(pAnchor, path, vfs_configInt); ++ if (size == -1) ++ size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE; + cfg_cacheAdd(pAnchor, SRC_VFS_INDEX, pArgs[1], level, ctype, size); + } + } diff --git a/extra/haveged/haveged.service b/extra/haveged/haveged.service new file mode 100644 index 000000000..6de4a67ce --- /dev/null +++ b/extra/haveged/haveged.service @@ -0,0 +1,13 @@ +[Unit] +Description=Entropy Harvesting Daemon +Documentation=man:haveged(8) + +[Service] +ExecStart=/usr/bin/haveged -F -w 1024 -v 1 +SuccessExitStatus=143 +ProtectSystem=full +ProtectHome=on +PrivateNetwork=on + +[Install] +WantedBy=multi-user.target