Skip to contentSkip to conversation

busybox: add watchdog daemon startup script

PATCH Superseded Fabio Porcedda 3 participants 4 messages Feb 8, 2012 – Feb 9, 2012

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 busybox: add watchdog daemon startup script

---
 package/busybox/Config.in   |    6 ++++++
 package/busybox/S15watchdog |   20 ++++++++++++++++++++
 package/busybox/busybox.mk  |    9 +++++++++
 3 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 package/busybox/S15watchdog
package/busybox/Config.in +6 -0
index 4176020..c5b2eb8 100644
@@ -62,6 +62,12 @@ config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	  Show packages in menuconfig that are potentially also provided
 	  by busybox.
 
+config BR2_PACKAGE_BUSYBOX_WATCHDOG
+	bool "Install watchdog daemon startup script"
+	help
+	  Install the watchdog daemon startup script,
+	  that just start at the boot the busybox watchdog daemon.
+
 endif
 
 if !BR2_PACKAGE_BUSYBOX # kconfig doesn't support else
package/busybox/S15watchdog new file +20 -0
new file mode 100644
index 0000000..3a2e8eb
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# Start watchdog
+#
+
+case "$1" in
+ start)
+	echo "Starting watchdog..."
+	watchdog -t 5 /dev/watchdog
+	;;
+  stop)
+	;;
+  restart|reload)
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
package/busybox/busybox.mk +9 -0
index 59448d5..985f974 100644
@@ -142,6 +142,14 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
 	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
 endef
 
+ifeq ($(BR2_PACKAGE_BUSYBOX_WATCHDOG),y)
+define BUSYBOX_INSTALL_WATCHDOG_SCRIPT
+	[ -f $(TARGET_DIR)/etc/init.d/S15watchdog ] || \
+		install -D -m 0755 package/busybox/S15watchdog \
+			$(TARGET_DIR)/etc/init.d/S15watchdog
+endef
+endif
+
 # We do this here to avoid busting a modified .config in configure
 BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
 
@@ -172,6 +180,7 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
+	$(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
 endef
 
 define BUSYBOX_UNINSTALL_TARGET_CMDS
Signature · 1 line
1.7.8.3
#1 lore raw

PATCH 1/1 busybox: add watchdog daemon startup script

Le Wed, 8 Feb 2012 08:41:33 +0100,
Fabio Porcedda <[email protected]> a ?crit :

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 70

Quoted 6 lines
package/busybox/Config.in +6 -0
+config BR2_PACKAGE_BUSYBOX_WATCHDOG
+	bool "Install watchdog daemon startup script"
+	help
+	  Install the watchdog daemon startup script,
+	  that just start at the boot the busybox watchdog daemon.
+

Maybe instead of creating a new configuration option, we can just make the installation of the S15watchdog script automatic if the Busybox configuration file has enabled CONFIG_WATCHDOG=y?

The current default Busybox configuration file in Buildroot has CONFIG_WATCHDOG=y, so we may want to change this default to disable CONFIG_WATCHDOG.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 busybox: add watchdog daemon startup script

Quoted 14 lines · On Wednesday 08 February 2012 22:26:39 Thomas Petazzoni wrote:

Le Wed, 8 Feb 2012 08:41:33 +0100,
Fabio Porcedda <[email protected]> a ?crit :

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS · line 70

Quoted 6 lines
package/busybox/Config.in +6 -0
+config BR2_PACKAGE_BUSYBOX_WATCHDOG
+	bool "Install watchdog daemon startup script"
+	help
+	  Install the watchdog daemon startup script,
+	  that just start at the boot the busybox watchdog daemon.
+

Maybe instead of creating a new configuration option, we can just make the installation of the S15watchdog script automatic if the Busybox configuration file has enabled CONFIG_WATCHDOG=y?

Quoted 3 lines

The current default Busybox configuration file in Buildroot has CONFIG_WATCHDOG=y, so we may want to change this default to disable CONFIG_WATCHDOG.

NACK. Many people will want to use watchdog in a different way. And it
may be installed as S<someothernumber>watchdog so the check if it exists already doesn't help.

Having the start script _is_ relevant, even if it is just as an example.
It would be even better if the config option allowed to set the reset frequency.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 busybox: add watchdog daemon startup script

Le Thu, 9 Feb 2012 00:04:34 +0100,
Arnout Vandecappelle <[email protected]> a ?crit :

Quoted 3 lines

NACK. Many people will want to use watchdog in a different way.
And it may be installed as S<someothernumber>watchdog so the check if it exists already doesn't help.

Many of our packages install a default init script, which can always be overridden in the filesystem skeleton or through the post-build script. So what shouldn't we do the same here?

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com