[OE-core] [PATCH] [v2] watchdog: enable systemd support

Huang, Jie (Jackie) Jackie.Huang at windriver.com
Fri Jul 15 03:11:12 UTC 2016


Hi,

I’m taking care this of, I will change to use systemd_system_unitdir instead
and remove ControlGroup in the service files since it has been deprecated.

Thanks,
Jackie

From: openembedded-core-bounces at lists.openembedded.org<mailto:openembedded-core-bounces at lists.openembedded.org> [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of Pau Espin Pedrol
Sent: Wednesday, February 03, 2016 6:26 AM
To: Li, Rongqing
Cc: OE-core
Subject: Re: [OE-core] [PATCH] [v2] watchdog: enable systemd support

Hi,
Please could you use ${systemd_system_unitdir} instead of ${systemd_unitdir}/system ?

Pau Espin Pedrol
mail/jabber: pespin.shar at gmail.com<mailto:pespin.shar at gmail.com>
http://blog.espeweb.net

2016-01-25 3:48 GMT+01:00 <rongqing.li at windriver.com<mailto:rongqing.li at windriver.com>>:
From: Roy Li <rongqing.li at windriver.com<mailto:rongqing.li at windriver.com>>

1. inherit systemd, and add two unit files which are from Fedora 23
2. auto load soft dog kernel module

Signed-off-by: Roy Li <rongqing.li at windriver.com<mailto:rongqing.li at windriver.com>>
---
 .../watchdog/watchdog/watchdog-ping.service             | 12 ++++++++++++
 .../recipes-extended/watchdog/watchdog/watchdog.service | 12 ++++++++++++
 meta/recipes-extended/watchdog/watchdog_5.14.bb<http://watchdog_5.14.bb>         | 17 ++++++++++++++++-
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/watchdog/watchdog/watchdog-ping.service
 create mode 100644 meta/recipes-extended/watchdog/watchdog/watchdog.service

diff --git a/meta/recipes-extended/watchdog/watchdog/watchdog-ping.service b/meta/recipes-extended/watchdog/watchdog/watchdog-ping.service
new file mode 100644
index 0000000..fce6e12
--- /dev/null
+++ b/meta/recipes-extended/watchdog/watchdog/watchdog-ping.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=watchdog daemon for use with ping test / network dependency
+After=network.target
+Conflicts=watchdog.service
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/watchdog
+ControlGroup=cpu:/
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-extended/watchdog/watchdog/watchdog.service b/meta/recipes-extended/watchdog/watchdog/watchdog.service
new file mode 100644
index 0000000..f945bc9
--- /dev/null
+++ b/meta/recipes-extended/watchdog/watchdog/watchdog.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=watchdog daemon
+# man systemd.special
+# auto added After=basic.target
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/watchdog
+ControlGroup=cpu:/
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-extended/watchdog/watchdog_5.14.bb<http://watchdog_5.14.bb> b/meta/recipes-extended/watchdog/watchdog_5.14.bb<http://watchdog_5.14.bb>
index fc717bc..9e21075 100644
--- a/meta/recipes-extended/watchdog/watchdog_5.14.bb<http://watchdog_5.14.bb>
+++ b/meta/recipes-extended/watchdog/watchdog_5.14.bb<http://watchdog_5.14.bb>
@@ -14,6 +14,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
           file://watchdog-init.patch<file:///\\watchdog-init.patch> \
           file://watchdog-conf.patch<file:///\\watchdog-conf.patch> \
           file://0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch<file:///\\0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch> \
+          file://watchdog-ping.service<file:///\\watchdog-ping.service> \
+          file://watchdog.service<file:///\\watchdog.service> \
 "

 SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4"
@@ -23,7 +25,7 @@ UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/watchdog/files/watchdog/"
 UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/"

 inherit autotools
-inherit update-rc.d
+inherit update-rc.d systemd

 DEPENDS_append_libc-musl = " libtirpc "
 CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc "
@@ -34,6 +36,19 @@ INITSCRIPT_PARAMS = "start 15 1 2 3 4 5 . stop 85 0 6 ."

 RRECOMMENDS_${PN} = "kernel-module-softdog"

+
+SYSTEMD_SERVICE_${PN} = "watchdog.service"
+
 do_install_append() {
        install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh
+       install -d ${D}${systemd_unitdir}/system
+       install -m 0644 ${WORKDIR}/watchdog*.service ${D}${systemd_unitdir}/system
+
+       if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}<mailto:$%7b at bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)%7d>; then
+               install -d ${D}${sysconfdir}/modules-load.d
+               echo "softdog" > ${D}${sysconfdir}/modules-load.d/softdog.conf
+               sed -i -e 's, at SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/*.service
+       fi
 }
+
+FILES_${PN} += "${systemd_unitdir}/system/*"
--
1.9.1

--
_______________________________________________
Openembedded-core mailing list
Openembedded-core at lists.openembedded.org<mailto:Openembedded-core at lists.openembedded.org>
http://lists.openembedded.org/mailman/listinfo/openembedded-core

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160715/cc30acb2/attachment-0002.html>


More information about the Openembedded-core mailing list