Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] watchdog: enable systemd support
@ 2015-11-27  6:27 rongqing.li
  2015-11-27 11:20 ` Otavio Salvador
  0 siblings, 1 reply; 6+ messages in thread
From: rongqing.li @ 2015-11-27  6:27 UTC (permalink / raw)
  To: openembedded-core

From: Roy Li <rongqing.li@windriver.com>

1. inherit systemd, and add two unit files
2. auto load soft dog kernel module

Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
 .../watchdog/watchdog/watchdog-ping.service            | 12 ++++++++++++
 .../watchdog/watchdog/watchdog.service                 | 12 ++++++++++++
 meta/recipes-extended/watchdog/watchdog_5.14.bb        | 18 ++++++++++++++++--
 3 files changed, 40 insertions(+), 2 deletions(-)
 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..da403c9
--- /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=/usr/sbin/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..3c36a08
--- /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=/usr/sbin/watchdog
+ControlGroup=cpu:/
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-extended/watchdog/watchdog_5.14.bb b/meta/recipes-extended/watchdog/watchdog_5.14.bb
index 9ec0a8e..743a36a 100644
--- a/meta/recipes-extended/watchdog/watchdog_5.14.bb
+++ b/meta/recipes-extended/watchdog/watchdog_5.14.bb
@@ -12,19 +12,33 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://fixsepbuild.patch \
 	   file://fix-ping-failure.patch \
 	   file://watchdog-init.patch \
-	   file://watchdog-conf.patch"
+	   file://watchdog-conf.patch \
+	   file://watchdog-ping.service \
+	   file://watchdog.service \
+"
 
 SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4"
 SRC_URI[sha256sum] = "620b2f49e9879f2e85c73d4c1f422f9101e6b38e824fea2414befd8bb6866ad1"
 
 inherit autotools
-inherit update-rc.d
+inherit update-rc.d systemd
 
 INITSCRIPT_NAME = "watchdog.sh"
 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)}; then
+		install -d ${D}${sysconfdir}/modules-load.d
+		echo "softdog" > ${D}${sysconfdir}/modules-load.d/softdog.conf
+	fi
 }
+
+FILES_${PN} += "${systemd_unitdir}/system/*"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] watchdog: enable systemd support
  2015-11-27  6:27 rongqing.li
@ 2015-11-27 11:20 ` Otavio Salvador
  0 siblings, 0 replies; 6+ messages in thread
From: Otavio Salvador @ 2015-11-27 11:20 UTC (permalink / raw)
  To: Rongqing Li; +Cc: Patches and discussions about the oe-core layer

On Fri, Nov 27, 2015 at 4:27 AM,  <rongqing.li@windriver.com> wrote:
> From: Roy Li <rongqing.li@windriver.com>
>
> 1. inherit systemd, and add two unit files
> 2. auto load soft dog kernel module
>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>

The ping service conflicts with the main one. Could you highlight why?

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] watchdog: enable systemd support
@ 2016-01-20  2:01 rongqing.li
  2016-01-21 13:03 ` Burton, Ross
  2016-01-21 22:58 ` Randy MacLeod
  0 siblings, 2 replies; 6+ messages in thread
From: rongqing.li @ 2016-01-20  2:01 UTC (permalink / raw)
  To: openembedded-core

From: Roy Li <rongqing.li@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@windriver.com>
---
 .../watchdog/watchdog/watchdog-ping.service            | 12 ++++++++++++
 .../watchdog/watchdog/watchdog.service                 | 12 ++++++++++++
 meta/recipes-extended/watchdog/watchdog_5.14.bb        | 18 ++++++++++++++++--
 3 files changed, 40 insertions(+), 2 deletions(-)
 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..da403c9
--- /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=/usr/sbin/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..3c36a08
--- /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=/usr/sbin/watchdog
+ControlGroup=cpu:/
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-extended/watchdog/watchdog_5.14.bb b/meta/recipes-extended/watchdog/watchdog_5.14.bb
index 9cb89d5..55cbbb4 100644
--- a/meta/recipes-extended/watchdog/watchdog_5.14.bb
+++ b/meta/recipes-extended/watchdog/watchdog_5.14.bb
@@ -12,7 +12,10 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \
            file://fixsepbuild.patch \
 	   file://fix-ping-failure.patch \
 	   file://watchdog-init.patch \
-	   file://watchdog-conf.patch"
+	   file://watchdog-conf.patch \
+	   file://watchdog-ping.service \
+	   file://watchdog.service \
+"
 
 SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4"
 SRC_URI[sha256sum] = "620b2f49e9879f2e85c73d4c1f422f9101e6b38e824fea2414befd8bb6866ad1"
@@ -21,13 +24,24 @@ 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
 
 INITSCRIPT_NAME = "watchdog.sh"
 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)}; then
+		install -d ${D}${sysconfdir}/modules-load.d
+		echo "softdog" > ${D}${sysconfdir}/modules-load.d/softdog.conf
+	fi
 }
+
+FILES_${PN} += "${systemd_unitdir}/system/*"
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] watchdog: enable systemd support
  2016-01-20  2:01 [PATCH] watchdog: enable systemd support rongqing.li
@ 2016-01-21 13:03 ` Burton, Ross
  2016-01-21 22:58 ` Randy MacLeod
  1 sibling, 0 replies; 6+ messages in thread
From: Burton, Ross @ 2016-01-21 13:03 UTC (permalink / raw)
  To: rongqing.li@windriver.com; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

On 20 January 2016 at 02:01, <rongqing.li@windriver.com> wrote:

> +ExecStart=/usr/sbin/watchdog
>

Use SBINDIR and sed the right path in at install time, please.

Ross

[-- Attachment #2: Type: text/html, Size: 621 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] watchdog: enable systemd support
  2016-01-20  2:01 [PATCH] watchdog: enable systemd support rongqing.li
  2016-01-21 13:03 ` Burton, Ross
@ 2016-01-21 22:58 ` Randy MacLeod
  2016-01-22  5:29   ` Rongqing Li
  1 sibling, 1 reply; 6+ messages in thread
From: Randy MacLeod @ 2016-01-21 22:58 UTC (permalink / raw)
  To: rongqing.li, openembedded-core

On 2016-01-19 09:01 PM, rongqing.li@windriver.com wrote:
> 1. inherit systemd, and add two unit files which are from Fedora 23

Fine.
> 2. auto load soft dog kernel module

I haven't used a hardware watchdog for a while. Does softdog
abstract that away so that it's hidden by the BSP? If not,
can a user ditch the softdog for a hardware watchdog? Does that
over-ride process need to be documented?


-- 
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, 
Canada, K2K 2W5


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] watchdog: enable systemd support
  2016-01-21 22:58 ` Randy MacLeod
@ 2016-01-22  5:29   ` Rongqing Li
  0 siblings, 0 replies; 6+ messages in thread
From: Rongqing Li @ 2016-01-22  5:29 UTC (permalink / raw)
  To: Randy MacLeod, openembedded-core



On 2016年01月22日 06:58, Randy MacLeod wrote:
> On 2016-01-19 09:01 PM, rongqing.li@windriver.com wrote:
>> 1. inherit systemd, and add two unit files which are from Fedora 23
>
> Fine.
>> 2. auto load soft dog kernel module
>
> I haven't used a hardware watchdog for a while. Does softdog
> abstract that away so that it's hidden by the BSP? If not,
> can a user ditch the softdog for a hardware watchdog? Does that
> over-ride process need to be documented?
>
>

Usually, watchdog timers are implemented as add-on cards, or as on-chip
peripherals within microcontrollers. But if there is no hardware watchdog,
the Linux kernel can provide a software watchdog implemented using kernel
timers.

https://en.wikibooks.org/wiki/The_Linux_Kernel/Softdog_Driver


if the machine has the hardware watchdog, and drivers are compiled in,
the /dev/watchdog will be generated; softdog is /dev/watchdog1 or
/dev/watchdog2, and the watchdog daemon will use the hardware watchdog


if drivers are compiled as module, udev will auto load it, but udev
will be run after systemd-modules-load.service, and softdog will be
used


-- 
Best Reagrds,
Roy | RongQing Li


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-22  5:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-20  2:01 [PATCH] watchdog: enable systemd support rongqing.li
2016-01-21 13:03 ` Burton, Ross
2016-01-21 22:58 ` Randy MacLeod
2016-01-22  5:29   ` Rongqing Li
  -- strict thread matches above, loose matches on Subject: below --
2015-11-27  6:27 rongqing.li
2015-11-27 11:20 ` Otavio Salvador

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox