From patchwork Wed Apr 4 08:16:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Porcedda X-Patchwork-Id: 150635 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id DF9D5B6FF7 for ; Wed, 4 Apr 2012 18:16:25 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 99CC48FC11; Wed, 4 Apr 2012 08:16:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cCQopTfRTVYI; Wed, 4 Apr 2012 08:16:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 5B2228FC13; Wed, 4 Apr 2012 08:16:18 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7D5538F753 for ; Wed, 4 Apr 2012 08:16:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 74A998FC13 for ; Wed, 4 Apr 2012 08:16:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RBjXyXZdWTBU for ; Wed, 4 Apr 2012 08:16:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ey0-f171.google.com (mail-ey0-f171.google.com [209.85.215.171]) by whitealder.osuosl.org (Postfix) with ESMTPS id 008278FC11 for ; Wed, 4 Apr 2012 08:16:13 +0000 (UTC) Received: by eaal11 with SMTP id l11so2286eaa.16 for ; Wed, 04 Apr 2012 01:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=KpACChf6c3ntksKVnYpNow6IEmjVKB3RWlPCDer8haE=; b=JGrTxOPCmkw+hvilgxB1U6T+VR1vHvPkPgS7zMBQdj9q0TB3a3WHp0HnNcsLFax9cz CdPC1pbmx9oLydpP0wofk26GXCGZLuuO6LD9Pl11zc9jWIK6cb9i2Lg3Jq9miqg1geaK f1LrbBefzvM+ua18aVEutUW3DehHa8lKaf1ipSUwJ8EKFNNzlY/O2MlrEtVZjURkyNHe G66GKGLlBdNDd/7CadTMnUv5xL9K5z5S+53TZsE190hFn1RNWEbn7JvYzCdbzuk/krlO i2ZoNyAdkKVfW0nd5NfIEH/nlJ/QTWci6zmPVy3m78b5/hOxO35MVZwmepVVJG4X+IIG sVsQ== Received: by 10.213.108.77 with SMTP id e13mr1527368ebp.11.1333527372148; Wed, 04 Apr 2012 01:16:12 -0700 (PDT) Received: from ld2036.tmt.telital.com ([213.205.6.118]) by mx.google.com with ESMTPS id e56sm82347333eea.11.2012.04.04.01.16.10 (version=SSLv3 cipher=OTHER); Wed, 04 Apr 2012 01:16:11 -0700 (PDT) From: Fabio Porcedda To: buildroot@busybox.net Date: Wed, 4 Apr 2012 10:16:09 +0200 Message-Id: <1333527369-6055-1-git-send-email-fabio.porcedda@gmail.com> X-Mailer: git-send-email 1.7.9.4 Subject: [Buildroot] [PATCH v6] busybox: add watchdog daemon startup script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Signed-off-by: Fabio Porcedda Acked-by: Arnout Vandecappelle (Essensium/Mind) --- Changes for v6: - Change my email address Changes for v5: - Add the Acked-by: Arnout Vandecappelle Changes for v4: - Add the config modifier to force-enable the watchdog daemon, as asked by Arnout Vandecappelle. 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 | 15 +++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 package/busybox/S15watchdog diff --git a/package/busybox/Config.in b/package/busybox/Config.in index c206509..9d7257b 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_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 diff --git a/package/busybox/S15watchdog b/package/busybox/S15watchdog new file mode 100644 index 0000000..7f1110c --- /dev/null +++ b/package/busybox/S15watchdog @@ -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 $? diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 59448d5..1d988f8 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -142,6 +142,19 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi endef +ifeq ($(BR2_PACKAGE_BUSYBOX_WATCHDOG),y) +define BUSYBOX_SET_WATCHDOG + $(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG,$(BUSYBOX_BUILD_CONFIG)) +endef +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 @@ -155,6 +168,7 @@ define BUSYBOX_CONFIGURE_CMDS $(BUSYBOX_NETKITTELNET) $(BUSYBOX_INTERNAL_SHADOW_PASSWORDS) $(BUSYBOX_DISABLE_MMU_APPLETS) + $(BUSYBOX_SET_WATCHDOG) @yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \ -C $(@D) oldconfig endef @@ -172,6 +186,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