Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] busybox: add watchdog daemon startup script
@ 2012-02-09 10:31 Fabio Porcedda
  2012-02-09 12:42 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Porcedda @ 2012-02-09 10:31 UTC (permalink / raw)
  To: buildroot


Signed-off-by: Fabio Porcedda <fabio.porcedda@telit.com>
---
 Changes for v2:
	- Added the option to set the reset frequency,
	  as asked by Arnout Vandecappelle.

 package/busybox/Config.in   |   17 +++++++++++++++++
 package/busybox/S15watchdog |   20 ++++++++++++++++++++
 package/busybox/busybox.mk  |   11 +++++++++++
 3 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 package/busybox/S15watchdog

diff --git a/package/busybox/Config.in b/package/busybox/Config.in
index 4176020..1994500 100644
--- a/package/busybox/Config.in
+++ b/package/busybox/Config.in
@@ -62,6 +62,23 @@ config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	  Show packages in menuconfig that are potentially also provided
 	  by busybox.
 
+config BR2_PACKAGE_BUSYBOX_WATCHDOG
+	bool "Install the watchdog daemon startup script"
+	help
+	  Install the watchdog daemon startup script,
+	  that just start at the boot the busybox watchdog daemon.
+
+if BR2_PACKAGE_BUSYBOX_WATCHDOG
+
+config BR2_PACKAGE_BUSYBOX_WATCHDOG_RESETTIME
+	int "Delay between reset"
+	default "5"
+	help
+	  Select the number of seconds between each
+	  reset of the watchdog (default 5)
+
+endif
+
 endif
 
 if !BR2_PACKAGE_BUSYBOX # kconfig doesn't support else
diff --git a/package/busybox/S15watchdog b/package/busybox/S15watchdog
new file mode 100644
index 0000000..3a2e8eb
--- /dev/null
+++ b/package/busybox/S15watchdog
@@ -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 $?
diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index 59448d5..88053ca 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -142,6 +142,16 @@ 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 && \
+		sed -i s/5/$(BR2_PACKAGE_BUSYBOX_WATCHDOG_RESETTIME)/ \
+			$(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 +182,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
-- 
1.7.8.3

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

* [Buildroot] [PATCH v2] busybox: add watchdog daemon startup script
  2012-02-09 10:31 [Buildroot] [PATCH v2] busybox: add watchdog daemon startup script Fabio Porcedda
@ 2012-02-09 12:42 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-02-09 12:42 UTC (permalink / raw)
  To: buildroot

>  
>  if !BR2_PACKAGE_BUSYBOX # kconfig doesn't support else
> diff --git a/package/busybox/S15watchdog b/package/busybox/S15watchdog
> new file mode 100644
> index 0000000..3a2e8eb
> --- /dev/null
> +++ b/package/busybox/S15watchdog
> @@ -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 $?
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index 59448d5..88053ca 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -142,6 +142,16 @@ 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 && \
> +		sed -i s/5/$(BR2_PACKAGE_BUSYBOX_WATCHDOG_RESETTIME)/ \
use somethink else than 5 for the sed

Best Regards,
J.

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

end of thread, other threads:[~2012-02-09 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-09 10:31 [Buildroot] [PATCH v2] busybox: add watchdog daemon startup script Fabio Porcedda
2012-02-09 12:42 ` Jean-Christophe PLAGNIOL-VILLARD

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