From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 09 Sep 2021 12:17:42 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mOH7m-0005lp-6R for lore@lore.pengutronix.de; Thu, 09 Sep 2021 12:17:42 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mOH7l-0003vT-Ry; Thu, 09 Sep 2021 12:17:41 +0200 Received: from mail.thorsis.com ([92.198.35.195]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mOH78-0003v2-0z for ptxdist@pengutronix.de; Thu, 09 Sep 2021 12:17:02 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.thorsis.com (Postfix) with ESMTP id 0D5DF297C for ; Thu, 9 Sep 2021 12:17:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.thorsis.com Received: from mail.thorsis.com ([127.0.0.1]) by localhost (mail.thorsis.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g4D6lWlP2Stt for ; Thu, 9 Sep 2021 12:17:00 +0200 (CEST) Received: by mail.thorsis.com (Postfix, from userid 109) id AF17E2958; Thu, 9 Sep 2021 12:16:57 +0200 (CEST) Received: from adahl by ada.ifak-system.com with local (Exim 4.92) (envelope-from ) id 1mOH6y-0002Qf-NH for ptxdist@pengutronix.de; Thu, 09 Sep 2021 12:16:52 +0200 From: Alexander Dahl To: ptxdist@pengutronix.de Date: Thu, 9 Sep 2021 12:16:52 +0200 Message-Id: <20210909101652.9288-3-ada@thorsis.com> In-Reply-To: <20210909101652.9288-1-ada@thorsis.com> References: <20210909101652.9288-1-ada@thorsis.com> X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: [ptxdist] [PATCH 2/2] mtd-utils: Introduce systemd unit for ubihealthd X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false It's possible to run multiple instances for multiple ubi devices by creating multiple symlinks. One symlink for the first device ubi0 is already created. Signed-off-by: Alexander Dahl --- .../usr/lib/systemd/system/ubihealthd@.service | 13 +++++++++++++ rules/mtd-utils.in | 12 +++++++++++- rules/mtd-utils.make | 6 ++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 projectroot/usr/lib/systemd/system/ubihealthd@.service diff --git a/projectroot/usr/lib/systemd/system/ubihealthd@.service b/projectroot/usr/lib/systemd/system/ubihealthd@.service new file mode 100644 index 000000000..f3f0ba25f --- /dev/null +++ b/projectroot/usr/lib/systemd/system/ubihealthd@.service @@ -0,0 +1,13 @@ +# enable with `systemctl enable ubihealthd@ubi0.service` + +[Unit] +Description=ubihealthd UBI device PEB scan daemon for %I +BindsTo=dev-%i.device +After=dev-%i.device + +[Service] +Type=forking +ExecStart=/usr/sbin/ubihealthd -d /dev/%I -i 120 + +[Install] +WantedBy=multi-user.target diff --git a/rules/mtd-utils.in b/rules/mtd-utils.in index 11b0be23f..0d8fb5f5a 100644 --- a/rules/mtd-utils.in +++ b/rules/mtd-utils.in @@ -294,13 +294,23 @@ config MTD_UTILS_UBIFS_MOUNTHELPER help Simplifies attaching an ubi and mounting an ubifs via /etc/fstab. -config MTD_UTILS_UBIHEALTHD +menuconfig MTD_UTILS_UBIHEALTHD bool prompt "ubihealthd" help Daemon that randomly scans each PEB of a UBI device to ensure that filesystems with little reading do enough wear leveling. +if MTD_UTILS_UBIHEALTHD + +config MTD_UTILS_UBIHEALTHD_SYSTEMD_UNIT + bool + prompt "install systemd unit files" + default y + depends on SYSTEMD + +endif + config MTD_UTILS_UBIMKVOL bool prompt "ubimkvol" diff --git a/rules/mtd-utils.make b/rules/mtd-utils.make index 15288acd7..d96ab02b0 100644 --- a/rules/mtd-utils.make +++ b/rules/mtd-utils.make @@ -205,6 +205,12 @@ endif ifdef PTXCONF_MTD_UTILS_UBIHEALTHD @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ /usr/sbin/ubihealthd) +ifdef PTXCONF_MTD_UTILS_UBIHEALTHD_SYSTEMD_UNIT + @$(call install_alternative, mtd-utils, 0, 0, 0644, \ + /usr/lib/systemd/system/ubihealthd@.service) + @$(call install_link, mtd-utils, ../ubihealthd@.service, \ + /usr/lib/systemd/system/multi-user.target.wants/ubihealthd@ubi0.service) +endif endif ifdef PTXCONF_MTD_UTILS_UBIMKVOL @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ -- 2.30.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de