busybox: add watchdog daemon startup script
PATCH v3 1/1 busybox: add watchdog daemon startup script
---
Changes for v3:
- Changed the default value in the script, as asked by Jean-Christophe.
Changes for v2:
- Add 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
package/busybox/Config.in +17 -0
@@ -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_PERIOD + 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
package/busybox/S15watchdog new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh +# +# Start watchdog +# + +case "$1" in + start) + echo "Starting watchdog..." + watchdog -t PERIOD /dev/watchdog + ;; + stop) + ;; + restart|reload) + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $?
package/busybox/busybox.mk +11 -0
@@ -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/PERIOD/$(BR2_PACKAGE_BUSYBOX_WATCHDOG_PERIOD)/ \ + $(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
Signature · 1 line
1.7.8.3
PATCH v3 1/1 busybox: add watchdog daemon startup script
Quoted 1 line · On Friday 10 February 2012 17:52:05 Fabio Porcedda wrote:
Signed-off-by Fabio Porcedda <[email protected]>
It may be useful to force-enable the watchdog in the buildroot config
it this option is selected. For me, that's not necessary though.
It would look something like this:
ifeq ($(BR2_PACKAGE_BUSYBOX_WATCHDOG),y)
define BUSYBOX_SET_WATCHDOG
$(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG,$(BUSYBOX_BUILD_CONFIG))
endef
endif
and then add BUSYBOX_SET_WATCHDOG to the rest of the config modifiers.
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
PATCH v3 1/1 busybox: add watchdog daemon startup script
Quoted 9 lines · Arnout Vandecappelle
Quoted 1 line · On Friday 10 February 2012 17:52:05 Fabio Porcedda wrote:
Signed-off-by Fabio Porcedda <[email protected]>It may be useful to force-enable the watchdog in the buildroot config
it this option is selected. For me, that's not necessary though.It would look something like this:
Quoted 7 lines
ifeq ($(BR2_PACKAGE_BUSYBOX_WATCHDOG),y)
defineBUSYBOX_SET_WATCHDOG$(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG,$(BUSYBOX_BUILD_CONFIG))endef
endifand then add
BUSYBOX_SET_WATCHDOGto the rest of the config modifiers.
Ok, i'm making an updated patch following this suggestion.
Quoted 4 lines
Regards,
Arnout
Signature · 10 lines
Fabio Porcedda Software Developer - R&D Cagliari Telit Communications S.p.A. Loc. Sa Illetta, SS 195, Km 2.300 09122 Cagliari - Italy Phone: +39 070 4603 247 Fax: +39 070 4603 250 Skype: fabiopo_telit http://www.telit.com