rng-tools: Add systemd service file and package config

Change-Id: If011dc8bfdd52cc16b489d840a0d3a718352bd77
Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-support/rng-tools/rng-tools/rngd.service b/meta-phosphor/common/recipes-support/rng-tools/rng-tools/rngd.service
new file mode 100644
index 0000000..7b0e9a7
--- /dev/null
+++ b/meta-phosphor/common/recipes-support/rng-tools/rng-tools/rngd.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Hardware RNG Entropy Gatherer Daemon
+
+[Service]
+ExecStart=@SBINDIR@/rngd -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-phosphor/common/recipes-support/rng-tools/rng-tools_%.bbappend b/meta-phosphor/common/recipes-support/rng-tools/rng-tools_%.bbappend
new file mode 100644
index 0000000..cda8e0b
--- /dev/null
+++ b/meta-phosphor/common/recipes-support/rng-tools/rng-tools_%.bbappend
@@ -0,0 +1,17 @@
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://rngd.service"
+
+inherit systemd
+
+SYSTEMD_SERVICE_${PN} = "rngd.service"
+
+do_install_append() {
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${systemd_unitdir}/system
+        install -m 644 ${WORKDIR}/rngd.service ${D}${systemd_unitdir}/system
+        sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/rngd.service
+    fi
+}
+