diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-extended/watchdog')
10 files changed, 276 insertions, 245 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config.bb b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config.bb new file mode 100644 index 000000000..8bf40f0f0 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config.bb @@ -0,0 +1,20 @@ +SUMMARY = "Software watchdog" +DESCRIPTION = "Watchdog is a daemon that checks if your system is still \ +working. If programs in user space are not longer executed it will reboot \ +the system." +HOMEPAGE = "http://watchdog.sourceforge.net/" +BUGTRACKER = "http://sourceforge.net/tracker/?group_id=172030&atid=860194" + +LICENSE = "MIT-X" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +SRC_URI = " \ + file://watchdog.default \ + file://watchdog.conf \ +" + +do_install() { + install -Dm 0644 ${WORKDIR}/watchdog.default ${D}${sysconfdir}/default/watchdog + install -Dm 0644 ${WORKDIR}/watchdog.conf ${D}${sysconfdir}/watchdog.conf +} + diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config/watchdog.conf b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config/watchdog.conf new file mode 100644 index 000000000..c493d12d3 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config/watchdog.conf @@ -0,0 +1,42 @@ +#ping = 172.31.14.1 +#ping = 172.26.1.255 +#interface = eth0 +#file = /var/log/messages +#change = 1407 + +# Uncomment to enable test. Setting one of these values to '0' disables it. +# These values will hopefully never reboot your machine during normal use +# (if your machine is really hung, the loadavg will go much higher than 25) +#max-load-1 = 24 +#max-load-5 = 18 +#max-load-15 = 12 + +# Note that this is the number of pages! +# To get the real size, check how large the pagesize is on your machine. +#min-memory = 1 + +#repair-binary = /usr/sbin/repair +#repair-timeout = +#test-binary = +#test-timeout = + +watchdog-device = /dev/watchdog + +# Defaults compiled into the binary +#temperature-device = +#max-temperature = 120 + +# Defaults compiled into the binary +#admin = root +#interval = 1 +#logtick = 1 +#log-dir = /var/log/watchdog + +# This greatly decreases the chance that watchdog won't be scheduled before +# your machine is really loaded +realtime = yes +priority = 1 + +# Check if rsyslogd is still running by enabling the following line +#pidfile = /var/run/rsyslogd.pid + diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config/watchdog.default b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config/watchdog.default new file mode 100644 index 000000000..647d5abca --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog-config/watchdog.default @@ -0,0 +1,2 @@ +# Start watchdog at boot time? 0 or 1 +run_watchdog=1 diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch deleted file mode 100644 index 8afed5c0d..000000000 --- a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 83ec34df357218a1c9cfc13a23d3367d333652c3 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Wed, 30 Dec 2015 01:01:15 +0000 -Subject: [PATCH] Fix build issues found with non glibc C libraries - -Add time.h for getting time_t definition -limits.h for PATH_MAX -linux/param.h for EXEC_PAGESIZE -Replace deprecated MNTTAB with _PATH_MNTTAB -include ext2_mnt.h for MNTOPT_USRQUOTA and MNTOPT_GRPQUOTA and -MNTTYPE_EXT2 -Include sys/types.h for u_char definition - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - -Upstream-Status: Submitted - - include/extern.h | 1 + - src/configfile.c | 1 + - src/memory.c | 3 +++ - src/net.c | 1 + - src/shutdown.c | 3 ++- - 5 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/include/extern.h b/include/extern.h -index 21db11b..04b16bc 100644 ---- a/include/extern.h -+++ b/include/extern.h -@@ -3,6 +3,7 @@ - - #include <netinet/in.h> - #include <stdio.h> -+#include <time.h> - - #include "logmessage.h" - #include "xmalloc.h" -diff --git a/src/configfile.c b/src/configfile.c -index be5d7b3..7c1d1dd 100644 ---- a/src/configfile.c -+++ b/src/configfile.c -@@ -16,6 +16,7 @@ - #include <errno.h> - #include <string.h> - #include <dirent.h> -+#include <limits.h> - #include <sys/stat.h> - - #include "extern.h" -diff --git a/src/memory.c b/src/memory.c -index e9607e4..b5e08aa 100644 ---- a/src/memory.c -+++ b/src/memory.c -@@ -21,6 +21,9 @@ - #include <sys/stat.h> - #include <sys/param.h> - #include <sys/mman.h> -+#ifdef __linux__ -+#include <linux/param.h> -+#endif - - #include "extern.h" - #include "watch_err.h" -diff --git a/src/net.c b/src/net.c -index 21823ae..8930caf 100644 ---- a/src/net.c -+++ b/src/net.c -@@ -17,6 +17,7 @@ - #include <string.h> - #include <unistd.h> /* for gethostname() etc */ - #include <netdb.h> /* for gethostbyname() */ -+#include <sys/types.h> - #include <sys/param.h> /* for MAXHOSTNAMELEN */ - #include <sys/socket.h> - #include <netinet/in.h> -diff --git a/src/shutdown.c b/src/shutdown.c -index 74aafa5..46b99cf 100644 ---- a/src/shutdown.c -+++ b/src/shutdown.c -@@ -25,6 +25,7 @@ - - #include "watch_err.h" - #include "extern.h" -+#include "ext2_mnt.h" - - #if defined __GLIBC__ - #include "ext2_mnt.h" -@@ -123,7 +124,7 @@ static void mnt_off() - FILE *fp; - struct mntent *mnt; - -- fp = setmntent(MNTTAB, "r"); -+ fp = setmntent(_PATH_MNTTAB, "r"); - /* in some rare cases fp might be NULL so be careful */ - while (fp != NULL && ((mnt = getmntent(fp)) != (struct mntent *)0)) { - /* First check if swap */ --- -2.6.4 - diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/0001-Include-linux-param.h-for-EXEC_PAGESIZE-definition.patch b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/0001-Include-linux-param.h-for-EXEC_PAGESIZE-definition.patch new file mode 100644 index 000000000..198f19861 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/0001-Include-linux-param.h-for-EXEC_PAGESIZE-definition.patch @@ -0,0 +1,32 @@ +From 8f91385dbd5e7c14b36ecbd8a01ca82c709f6d77 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 24 Jun 2016 18:19:29 +0000 +Subject: [PATCH] Include linux/param.h for EXEC_PAGESIZE definition + +Musl does not include linux/param.h whereas glibc +does, so it fails to build on musl. + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Submitted + + src/watchdog.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/watchdog.c b/src/watchdog.c +index acf6450..486384a 100644 +--- a/src/watchdog.c ++++ b/src/watchdog.c +@@ -26,6 +26,9 @@ + #include <sys/param.h> /* For EXEC_PAGESIZE */ + #include <linux/oom.h> + #include <linux/watchdog.h> ++#ifdef __linux__ ++#include <linux/param.h> ++#endif + #include <string.h> + + #include <libgen.h> +-- +1.8.3.1 + diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/fix-ping-failure.patch b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/fix-ping-failure.patch deleted file mode 100644 index 14ab9c56a..000000000 --- a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/fix-ping-failure.patch +++ /dev/null @@ -1,79 +0,0 @@ -Fix ping mode failure - -Upstream-Status: Pending - -When watchdog works on ping mode, the system will be rebooted since -watchdog can not receive the expected ECOREPLY on a setting interval. - -Ping mode uses a raw socket to send a ECO packet, then uses select() -to wait and recvfrom() to receive the ECOREPLY packet, if select() -shows the data is ready, and the data is not the expected ECOREPLY, -and waiting time is not overdue, it will continue use select() and -recvfrom(). - -Problem is that the raw socket can receive any icmp packets, if we do -not set filters, and there are many icmp packets on socket, this -program will not find its interested ECOREPLY packet in a special -interval, which makes the ping mode fail. - - -Other program is that watchdog sometime can not reach the call of -recvfrom to try to receive packets since tv_sec of struct timeval -of select parameter is 0. - -The timeout of select() is the result of ping interval minusing the -time of calling gettimeofday spending, when ping interval is 1 second, -and the call of gettimeofday() spends several useconds, the tv_sec of -struct timeval of select parameter must be 0, at that condition, we -should it is valid of tv_sec of struct timeval of select parameter be 0 - -Signed-off-by: Roy.Li <rongqing.li@windriver.com> ---- - src/net.c | 2 +- - src/watchdog.c | 5 ++++- - 2 files changed, 5 insertions(+), 2 deletions(-) - -Index: watchdog-5.14/src/watchdog.c -=================================================================== ---- watchdog-5.14.orig/src/watchdog.c -+++ watchdog-5.14/src/watchdog.c -@@ -24,6 +24,7 @@ - #include <sys/types.h> - #include <sys/ioctl.h> - #include <linux/oom.h> -+#include <linux/icmp.h> - #include <linux/watchdog.h> - #include <string.h> - -Index: watchdog-5.14/src/net.c -=================================================================== ---- watchdog-5.14.orig/src/net.c -+++ watchdog-5.14/src/net.c -@@ -11,7 +11,8 @@ - #include <errno.h> - #include <sys/time.h> - #include <netinet/ip.h> --#include <netinet/ip_icmp.h> -+#include <linux/icmp.h> -+//#include <netinet/ip_icmp.h> - #include <fcntl.h> - #include <string.h> - #include <unistd.h> /* for gethostname() etc */ -@@ -179,6 +180,9 @@ int open_netcheck(struct list *tlist) - { - struct list *act; - int hold = 0; -+ struct icmp_filter filt; -+ filt.data = ~(1<<ICMP_ECHOREPLY); -+ - - if (tlist != NULL) { - for (act = tlist; act != NULL; act = act->next) { -@@ -202,6 +206,7 @@ int open_netcheck(struct list *tlist) - fatal_error(EX_SYSERR, "error opening socket (%s)", strerror(errno)); - } - -+ setsockopt(net->sock_fp, SOL_RAW, ICMP_FILTER, (char*)&filt, sizeof(filt)); - /* this is necessary for broadcast pings to work */ - (void)setsockopt(net->sock_fp, SOL_SOCKET, SO_BROADCAST, (char *)&hold, sizeof(hold)); - diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/fixsepbuild.patch b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/fixsepbuild.patch deleted file mode 100644 index 2fad3a112..000000000 --- a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/fixsepbuild.patch +++ /dev/null @@ -1,27 +0,0 @@ -Fix out of tree build support: - -| installing /etc/watchdog.conf -| /bin/mkdir -p '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man5' -| /bin/mkdir -p '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man8' -| /usr/bin/install -c -m 644 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/watchdog.conf.5 '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man5' -| /usr/bin/install -c -m 644 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/watchdog.8 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/wd_keepalive.8 /media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/watchdog-5.13/wd_identify.8 '/media/build1/poky/build/tmp/work/i586-poky-linux/watchdog/5.13-r0/image/usr/share/man/man8' -| /usr/bin/install: cannot stat `watchdog.conf': No such file or directory -| make[2]: *** [install-etc-local] Error 1 - -Upstream-Status: Pending - -RP 2013/03/21 - -Index: watchdog-5.13/Makefile.am -=================================================================== ---- watchdog-5.13.orig/Makefile.am 2013-02-01 11:15:44.000000000 +0000 -+++ watchdog-5.13/Makefile.am 2013-03-21 11:59:35.637139031 +0000 -@@ -16,7 +16,7 @@ - else \ - echo "installing $(CONFIG_FILENAME)"; \ - $(mkinstalldirs) `dirname $(DESTDIR)$(CONFIG_FILENAME)`; \ -- $(INSTALL_DATA) watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ -+ $(INSTALL_DATA) $(srcdir)/watchdog.conf $(DESTDIR)$(CONFIG_FILENAME); \ - fi - - install-data-local: install-etc-local diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/wd_keepalive.init b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/wd_keepalive.init new file mode 100644 index 000000000..1d3e4c555 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog/wd_keepalive.init @@ -0,0 +1,121 @@ +#!/bin/sh +#/etc/init.d/wd_keepalive: start wd_keepalive daemon. + +### BEGIN INIT INFO +# Provides: wd_keepalive +# Short-Description: Start watchdog keepalive daemon +# Required-Start: $remote_fs +# Required-Stop: $remote_fs +# X-Start-Before: $all +# Default-Start: 2 3 4 5 +# Default-Stop +### END INIT INFO + +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +test -x /usr/sbin/wd_keepalive || exit 0 + +# For configuration of the init script use the file +# /etc/default/watchdog, do not edit this init script. + +# Set run_watchdog to 1 to start watchdog or 0 to disable it. +run_watchdog=0 + +# Specify additional watchdog options here (see manpage). +watchdog_options="" + +# Specify module to load +watchdog_module="none" + +[ -e /etc/default/watchdog ] && . /etc/default/watchdog + +NAME=wd_keepalive +DAEMON=/usr/sbin/wd_keepalive + +STOP_RETRY_SCHEDULE='TERM/10/forever/KILL/1' + +# . /lib/lsb/init-functions + +# Mock Debian stuff +log_begin_msg() { + echo -n $* +} + +log_end_msg() { + if [ "$1" = "0" ]; then + echo 'done' + else + echo 'error' + fi +} + +log_daemon_msg() { + echo $* +} + +log_progress_msg() { + echo $* +} + + +case "$1" in + start) + if [ $run_watchdog = 1 ] + then + [ ${watchdog_module:-none} != "none" ] && /sbin/modprobe $watchdog_module + echo -n "Starting watchdog keepalive daemon: " + if start-stop-daemon --start --quiet \ + --exec $DAEMON -- $watchdog_options + then + echo wd_keepalive. + else + echo + fi + fi + ;; + + stop) + if [ $run_watchdog = 1 ] + then + echo -n "Stopping watchdog keepalive daemon: " + if start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + $STOP_RETRY_SCHEDULE + then + echo wd_keepalive. + else + echo + fi + fi + ;; + + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + + restart) + $0 force-reload + ;; + + force-reload) + if [ $run_watchdog = 0 ]; then exit 0; fi + echo -n "Restarting $NAME daemon." + start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + $STOP_RETRY_SCHEDULE + echo -n "." + if start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ + --exec $DAEMON -- $watchdog_options + then + echo "done." + else + echo + fi + ;; + + *) + echo "Usage: /etc/init.d/wd_keepalive {start|stop|status|restart|force-reload}" + exit 1 + +esac + +exit 0 + diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.14.bb b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.14.bb deleted file mode 100644 index 733023897..000000000 --- a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.14.bb +++ /dev/null @@ -1,40 +0,0 @@ -SUMMARY = "Software watchdog" -DESCRIPTION = "Watchdog is a daemon that checks if your system is still \ -working. If programs in user space are not longer executed \ -it will reboot the system." -HOMEPAGE = "http://watchdog.sourceforge.net/" -BUGTRACKER = "http://sourceforge.net/tracker/?group_id=172030&atid=860194" - -LICENSE = "GPL-2.0+" -LIC_FILES_CHKSUM = "file://COPYING;md5=ecc0551bf54ad97f6b541720f84d6569" - -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://0001-Fix-build-issues-found-with-non-glibc-C-libraries.patch \ -" - -SRC_URI[md5sum] = "5b2dba0c593942f4acc100bca0d560c4" -SRC_URI[sha256sum] = "620b2f49e9879f2e85c73d4c1f422f9101e6b38e824fea2414befd8bb6866ad1" - -UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/watchdog/files/watchdog/" -UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/" - -inherit autotools -inherit update-rc.d - -DEPENDS_append_libc-musl = " libtirpc " -CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc " -LDFLAGS_append_libc-musl = " -ltirpc " -EXTRA_OECONF_append_libc-musl = " --disable-nfs " - -INITSCRIPT_NAME = "watchdog.sh" -INITSCRIPT_PARAMS = "start 15 1 2 3 4 5 . stop 85 0 6 ." - -RRECOMMENDS_${PN} = "kernel-module-softdog" - -do_install_append() { - install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh -} diff --git a/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb new file mode 100644 index 000000000..cedfc042c --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-extended/watchdog/watchdog_5.15.bb @@ -0,0 +1,59 @@ +SUMMARY = "Software watchdog" +DESCRIPTION = "Watchdog is a daemon that checks if your system is still \ +working. If programs in user space are not longer executed \ +it will reboot the system." +HOMEPAGE = "http://watchdog.sourceforge.net/" +BUGTRACKER = "http://sourceforge.net/tracker/?group_id=172030&atid=860194" + +LICENSE = "GPL-2.0+" +LIC_FILES_CHKSUM = "file://COPYING;md5=ecc0551bf54ad97f6b541720f84d6569" + +SRC_URI = "${SOURCEFORGE_MIRROR}/watchdog/watchdog-${PV}.tar.gz \ + file://0001-Include-linux-param.h-for-EXEC_PAGESIZE-definition.patch \ + file://watchdog-init.patch \ + file://watchdog-conf.patch \ + file://wd_keepalive.init \ +" + +SRC_URI[md5sum] = "678c32f6f35a0492c9c1b76b4aa88828" +SRC_URI[sha256sum] = "ffdc865137ad5d8e53664bd22bad4de6ca136d1b4636720320cb52af0c18947c" + +UPSTREAM_CHECK_URI = "http://sourceforge.net/projects/watchdog/files/watchdog/" +UPSTREAM_CHECK_REGEX = "/watchdog/(?P<pver>(\d+[\.\-_]*)+)/" + +inherit autotools +inherit update-rc.d + +DEPENDS_append_libc-musl = " libtirpc " +CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc " +LDFLAGS_append_libc-musl = " -ltirpc " +EXTRA_OECONF_append_libc-musl = " --disable-nfs " + +INITSCRIPT_PACKAGES = "${PN} ${PN}-keepalive" + +INITSCRIPT_NAME_${PN} = "watchdog.sh" +INITSCRIPT_PARAMS_${PN} = "start 15 1 2 3 4 5 . stop 85 0 6 ." + +INITSCRIPT_NAME_${PN}-keepalive = "wd_keepalive" +INITSCRIPT_PARAMS_${PN}-keepalive = "start 15 1 2 3 4 5 . stop 85 0 6 ." + +do_install_append() { + install -D ${S}/redhat/watchdog.init ${D}/${sysconfdir}/init.d/watchdog.sh + install -Dm 0755 ${WORKDIR}/wd_keepalive.init ${D}${sysconfdir}/init.d/wd_keepalive + + # watchdog.conf is provided by the watchdog-config recipe + rm ${D}${sysconfdir}/watchdog.conf +} + +PACKAGES =+ "${PN}-keepalive" + +FILES_${PN}-keepalive = " \ + ${sysconfdir}/init.d/wd_keepalive \ + ${sbindir}/wd_keepalive \ +" + +RDEPENDS_${PN} += "${PN}-config ${PN}-keepalive" +RDEPENDS_${PN}-keepalive += "${PN}-config" + +RRECOMMENDS_${PN} = "kernel-module-softdog" + |