mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 0/2] mtd-utils: Version bump and ubihealthd systemd unit
@ 2021-09-09 10:16 Alexander Dahl
  2021-09-09 10:16 ` [ptxdist] [PATCH 1/2] mtd-utils: version bump 2.1.2 -> 2.1.3 Alexander Dahl
  2021-09-09 10:16 ` [ptxdist] [PATCH 2/2] mtd-utils: Introduce systemd unit for ubihealthd Alexander Dahl
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Dahl @ 2021-09-09 10:16 UTC (permalink / raw)
  To: ptxdist

Hei hei,

two patches here. Please review. I might try to get that systemd unit
to upstream mtd-utils later.

Greets
Alex

Alexander Dahl (2):
  mtd-utils: version bump 2.1.2 -> 2.1.3
  mtd-utils: Introduce systemd unit for ubihealthd

 .../0002-Add-an-ubifs-mount-helper.patch      | 142 ------------------
 ...rkbad-new-util-to-mark-blocks-as-bad.patch |  18 +--
 .../autogen.sh                                |   0
 .../series                                    |   3 +-
 .../lib/systemd/system/ubihealthd@.service    |  13 ++
 rules/host-mtd-utils.make                     |   3 +-
 rules/mtd-utils.in                            |  12 +-
 rules/mtd-utils.make                          |  13 +-
 8 files changed, 46 insertions(+), 158 deletions(-)
 delete mode 100644 patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch
 rename patches/{mtd-utils-2.1.2 => mtd-utils-2.1.3}/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch (89%)
 rename patches/{mtd-utils-2.1.2 => mtd-utils-2.1.3}/autogen.sh (100%)
 rename patches/{mtd-utils-2.1.2 => mtd-utils-2.1.3}/series (53%)
 create mode 100644 projectroot/usr/lib/systemd/system/ubihealthd@.service


base-commit: ca47cbbcc38eded46776e3c5a6e5ccdb0fdd5544
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

* [ptxdist] [PATCH 1/2] mtd-utils: version bump 2.1.2 -> 2.1.3
  2021-09-09 10:16 [ptxdist] [PATCH 0/2] mtd-utils: Version bump and ubihealthd systemd unit Alexander Dahl
@ 2021-09-09 10:16 ` Alexander Dahl
  2021-10-07 10:18   ` [ptxdist] [APPLIED] " Michael Olbrich
  2021-09-09 10:16 ` [ptxdist] [PATCH 2/2] mtd-utils: Introduce systemd unit for ubihealthd Alexander Dahl
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2021-09-09 10:16 UTC (permalink / raw)
  To: ptxdist

Mostly build fixes, some bugfixes, some new features, ubifs mount helper
patch gone upstream.

Link: https://lists.infradead.org/pipermail/linux-mtd/2021-July/087588.html
Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 .../0002-Add-an-ubifs-mount-helper.patch      | 142 ------------------
 ...rkbad-new-util-to-mark-blocks-as-bad.patch |  18 +--
 .../autogen.sh                                |   0
 .../series                                    |   3 +-
 rules/host-mtd-utils.make                     |   3 +-
 rules/mtd-utils.make                          |   7 +-
 6 files changed, 16 insertions(+), 157 deletions(-)
 delete mode 100644 patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch
 rename patches/{mtd-utils-2.1.2 => mtd-utils-2.1.3}/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch (89%)
 rename patches/{mtd-utils-2.1.2 => mtd-utils-2.1.3}/autogen.sh (100%)
 rename patches/{mtd-utils-2.1.2 => mtd-utils-2.1.3}/series (53%)

diff --git a/patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch b/patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch
deleted file mode 100644
index f45b660ee..000000000
--- a/patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
-Date: Tue, 6 Oct 2020 11:19:13 +0200
-Subject: [PATCH] Add an ubifs mount helper
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This abstracts away attaching of the right ubi and then selecting the right
-ubi device and volume to mount.
-
-As described in the comment at the top this allows to mount ubifs volumes
-directly from /etc/fstab without having to use hardcoded numbers (which
-depend on mount order and so are unreliable) and extra magic to care for
-attaching.
-
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-Origin: upstream, commit:efeba0875ed181e7c1c7915742a3868799604d0c
----
- ubifs-utils/Makemodule.am |   2 +
- ubifs-utils/mount.ubifs   | 101 ++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 103 insertions(+)
- create mode 100755 ubifs-utils/mount.ubifs
-
-diff --git a/ubifs-utils/Makemodule.am b/ubifs-utils/Makemodule.am
-index 59109ccd613c..5c5d99f7572b 100644
---- a/ubifs-utils/Makemodule.am
-+++ b/ubifs-utils/Makemodule.am
-@@ -47,4 +47,6 @@ UBIFS_EXTRA = \
- 
- EXTRA_DIST += $(UBIFS_HEADER) $(UBIFS_EXTRA)
- 
-+dist_sbin_SCRIPTS = ubifs-utils/mount.ubifs
-+
- sbin_PROGRAMS += $(UBIFS_BINS)
-diff --git a/ubifs-utils/mount.ubifs b/ubifs-utils/mount.ubifs
-new file mode 100755
-index 000000000000..b94ddc5649f4
---- /dev/null
-+++ b/ubifs-utils/mount.ubifs
-@@ -0,0 +1,101 @@
-+#!/bin/sh
-+
-+# This script should be installed as /sbin/mount.ubifs. The benefit is that an
-+# fstab entry like:
-+#
-+# 	mtd=mtddev:home     /home        ubifs   defaults 0 0
-+#
-+# results in the ubi contained in the mtd named "mtddev" to be attached (if not
-+# already done) and then the volume named "home" being mounted to /home.
-+
-+# This is called by mount with the following options:
-+# /sbin/mount.ubifs spec dir [-sfnv] [-N namespace] [-o options] [-t type.subtype]
-+
-+spec="$1"
-+shift
-+
-+mtdname2num() {
-+	local name
-+
-+	name="$1"
-+
-+	for d in $(find /sys/class/mtd/ -regex '.*/mtd[0-9]*'); do
-+		case "$d" in
-+			*ro)
-+				continue
-+				;;
-+		esac
-+
-+		if test "$name" = "$(cat "$d/name")"; then
-+			local dev mtdnum
-+
-+			dev="$(basename "$d")"
-+			mtdnum="${dev#mtd}"
-+			echo "$mtdnum"
-+			return
-+		fi
-+	done
-+
-+	return 1
-+}
-+
-+mtdnum2ubi() {
-+	local mtdnum
-+
-+	mtdnum="$1"
-+
-+	for d in $(find /sys/class/ubi/ -regex '.*/ubi[0-9]*'); do
-+		case "$d" in
-+			*_[0-9]*)
-+				continue
-+				;;
-+		esac
-+
-+		if test "$mtdnum" = "$(cat "$d/mtd_num")"; then
-+			local ubi
-+
-+			ubi="$(basename "$d")"
-+			echo "$ubi"
-+			return;
-+		fi
-+	done
-+
-+	return 1
-+}
-+
-+mtdnum2ubi_autoattach() {
-+	local mtdnum ubi
-+
-+	mtdnum="$1"
-+
-+	ubi="$(mtdnum2ubi "$mtdnum")" && { echo "$ubi"; return; }
-+
-+	# ubiattach might fail with "mtdX is already attached to ubiY" if there
-+	# is more than one mount to do in the same mtd partition. So ignore errors.
-+	ubiattach -m "$mtdnum" >&2 || true
-+
-+	mtdnum2ubi "$mtdnum"
-+}
-+
-+case "$spec" in
-+	mtd=*:*)
-+		spec="${spec#mtd=}"
-+		mtd="${spec%:*}"
-+		rspec="${spec#*:}"
-+
-+		mtdnum="$(mtdname2num "$mtd")" || {
-+			echo "Failed to find mtdnum for mtd \"$mtd\""
-+			exit 1
-+		}
-+
-+		ubi="$(mtdnum2ubi_autoattach "$mtdnum")" || {
-+			echo "Failed to find ubi for mtd \"$mtd\""
-+			exit 1
-+		}
-+
-+		spec="$ubi:$rspec"
-+
-+		;;
-+esac
-+
-+/bin/mount -i -t ubifs "$spec" "$@"
diff --git a/patches/mtd-utils-2.1.2/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch b/patches/mtd-utils-2.1.3/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
similarity index 89%
rename from patches/mtd-utils-2.1.2/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
rename to patches/mtd-utils-2.1.3/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
index 1cea5f238..e6ff202a7 100644
--- a/patches/mtd-utils-2.1.2/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
+++ b/patches/mtd-utils-2.1.3/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
@@ -9,7 +9,7 @@ Subject: [PATCH] nandmarkbad: new util to mark blocks as bad
  create mode 100644 nand-utils/nandmarkbad.c
 
 diff --git a/nand-utils/Makemodule.am b/nand-utils/Makemodule.am
-index d75b0cb3e36c..c31dcb01f06e 100644
+index cee677783e7a..7fd1de5aa9ae 100644
 --- a/nand-utils/Makemodule.am
 +++ b/nand-utils/Makemodule.am
 @@ -7,6 +7,9 @@ nandwrite_LDADD = libmtd.a
@@ -19,18 +19,18 @@ index d75b0cb3e36c..c31dcb01f06e 100644
 +nandmarkbad_SOURCES = nand-utils/nandmarkbad.c
 +nandmarkbad_LDADD = libmtd.a
 +
- nftldump_SOURCES = nand-utils/nftldump.c
+ nftldump_SOURCES = nand-utils/nftldump.c include/mtd_swab.h
+ nftldump_SOURCES += include/mtd/nftl-user.h include/mtd/ftl-user.h
  nftldump_LDADD = libmtd.a
+@@ -23,7 +26,7 @@ NAND_SH = \
  
-@@ -14,7 +17,7 @@ nftl_format_SOURCES = nand-utils/nftl_format.c
- nftl_format_LDADD = libmtd.a
+ EXTRA_DIST += $(NAND_SH)
  
- NAND_BINS = \
--	nanddump nandwrite nandtest nftldump nftl_format
-+	nanddump nandwrite nandtest nandmarkbad nftldump nftl_format
+-sbin_PROGRAMS += nanddump nandwrite nandtest nftldump nftl_format nandflipbits
++sbin_PROGRAMS += nanddump nandwrite nandtest nandmarkbad nftldump nftl_format nandflipbits
  
- NAND_SH = \
- 	nand-utils/load_nandsim.sh
+ if BUILD_TESTS
+ test_SCRIPTS += $(NAND_SH)
 diff --git a/nand-utils/nandmarkbad.c b/nand-utils/nandmarkbad.c
 new file mode 100644
 index 000000000000..cf05698c3609
diff --git a/patches/mtd-utils-2.1.2/autogen.sh b/patches/mtd-utils-2.1.3/autogen.sh
similarity index 100%
rename from patches/mtd-utils-2.1.2/autogen.sh
rename to patches/mtd-utils-2.1.3/autogen.sh
diff --git a/patches/mtd-utils-2.1.2/series b/patches/mtd-utils-2.1.3/series
similarity index 53%
rename from patches/mtd-utils-2.1.2/series
rename to patches/mtd-utils-2.1.3/series
index 7a5eec8b0..92dc1b94f 100644
--- a/patches/mtd-utils-2.1.2/series
+++ b/patches/mtd-utils-2.1.3/series
@@ -1,5 +1,4 @@
 # generated by git-ptx-patches
 #tag:base --start-number 1
 0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
-0002-Add-an-ubifs-mount-helper.patch
-# 096af547b18d202f08576089a0cee058  - git-ptx-patches magic
+# 407ded52b82ffa3ff91d50cf6b2388e0  - git-ptx-patches magic
diff --git a/rules/host-mtd-utils.make b/rules/host-mtd-utils.make
index f49a08261..0352339f0 100644
--- a/rules/host-mtd-utils.make
+++ b/rules/host-mtd-utils.make
@@ -23,8 +23,9 @@ HOST_MTD_UTILS_CONF_TOOL	:= autoconf
 HOST_MTD_UTILS_CONF_OPT		:= \
 	$(HOST_AUTOCONF) \
 	--disable-unit-tests \
+	--enable-largefile \
 	--disable-tests \
-	--disable-install-tests \
+	--disable-ubihealthd \
 	--disable-lsmtd \
 	--without-jffs \
 	--with-ubifs \
diff --git a/rules/mtd-utils.make b/rules/mtd-utils.make
index e1a953c28..15288acd7 100644
--- a/rules/mtd-utils.make
+++ b/rules/mtd-utils.make
@@ -15,8 +15,8 @@ PACKAGES-$(PTXCONF_MTD_UTILS) += mtd-utils
 #
 # Paths and names
 #
-MTD_UTILS_VERSION	:= 2.1.2
-MTD_UTILS_MD5		:= 19191bc0195a779c0bd1284c886084ab
+MTD_UTILS_VERSION	:= 2.1.3
+MTD_UTILS_MD5		:= 32f3e1dcb21adb1185e994f7b2bf14d8
 MTD_UTILS		:= mtd-utils-$(MTD_UTILS_VERSION)
 MTD_UTILS_SUFFIX	:= tar.bz2
 MTD_UTILS_URL		:= https://infraroot.at/pub/mtd/$(MTD_UTILS).$(MTD_UTILS_SUFFIX)
@@ -34,8 +34,9 @@ MTD_UTILS_CONF_TOOL	:= autoconf
 MTD_UTILS_CONF_OPT	:= \
 	$(CROSS_AUTOCONF_USR) \
 	--disable-unit-tests \
+	$(GLOBAL_LARGE_FILE_OPTION) \
 	--disable-tests \
-	--disable-install-tests \
+	--$(call ptx/endis,PTXCONF_MTD_UTILS_UBIHEALTHD)-ubihealthd \
 	--$(call ptx/endis, PTXCONF_MTD_UTILS_LSMTD)-lsmtd \
 	--$(call ptx/wwo, PTXCONF_MTD_UTILS_JFFS)-jffs \
 	--$(call ptx/wwo, PTXCONF_MTD_UTILS_UBIFS)-ubifs \
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

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

* [ptxdist] [PATCH 2/2] mtd-utils: Introduce systemd unit for ubihealthd
  2021-09-09 10:16 [ptxdist] [PATCH 0/2] mtd-utils: Version bump and ubihealthd systemd unit Alexander Dahl
  2021-09-09 10:16 ` [ptxdist] [PATCH 1/2] mtd-utils: version bump 2.1.2 -> 2.1.3 Alexander Dahl
@ 2021-09-09 10:16 ` Alexander Dahl
  2021-10-07 10:18   ` [ptxdist] [APPLIED] " Michael Olbrich
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Dahl @ 2021-09-09 10:16 UTC (permalink / raw)
  To: ptxdist

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 <ada@thorsis.com>
---
 .../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


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

* Re: [ptxdist] [APPLIED] mtd-utils: version bump 2.1.2 -> 2.1.3
  2021-09-09 10:16 ` [ptxdist] [PATCH 1/2] mtd-utils: version bump 2.1.2 -> 2.1.3 Alexander Dahl
@ 2021-10-07 10:18   ` Michael Olbrich
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Olbrich @ 2021-10-07 10:18 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Dahl

Thanks, applied as 943b1effc28055c072e20aaab772ff80576f9443.

Michael

[sent from post-receive hook]

On Thu, 07 Oct 2021 12:18:52 +0200, Alexander Dahl <ada@thorsis.com> wrote:
> Mostly build fixes, some bugfixes, some new features, ubifs mount helper
> patch gone upstream.
> 
> Link: https://lists.infradead.org/pipermail/linux-mtd/2021-July/087588.html
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> Message-Id: <20210909101652.9288-2-ada@thorsis.com>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch b/patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch
> deleted file mode 100644
> index f45b660ee2d1..000000000000
> --- a/patches/mtd-utils-2.1.2/0002-Add-an-ubifs-mount-helper.patch
> +++ /dev/null
> @@ -1,142 +0,0 @@
> -From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
> -Date: Tue, 6 Oct 2020 11:19:13 +0200
> -Subject: [PATCH] Add an ubifs mount helper
> -MIME-Version: 1.0
> -Content-Type: text/plain; charset=UTF-8
> -Content-Transfer-Encoding: 8bit
> -
> -This abstracts away attaching of the right ubi and then selecting the right
> -ubi device and volume to mount.
> -
> -As described in the comment at the top this allows to mount ubifs volumes
> -directly from /etc/fstab without having to use hardcoded numbers (which
> -depend on mount order and so are unreliable) and extra magic to care for
> -attaching.
> -
> -Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> -Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
> -Origin: upstream, commit:efeba0875ed181e7c1c7915742a3868799604d0c
> ----
> - ubifs-utils/Makemodule.am |   2 +
> - ubifs-utils/mount.ubifs   | 101 ++++++++++++++++++++++++++++++++++++++++++++++
> - 2 files changed, 103 insertions(+)
> - create mode 100755 ubifs-utils/mount.ubifs
> -
> -diff --git a/ubifs-utils/Makemodule.am b/ubifs-utils/Makemodule.am
> -index 59109ccd613c..5c5d99f7572b 100644
> ---- a/ubifs-utils/Makemodule.am
> -+++ b/ubifs-utils/Makemodule.am
> -@@ -47,4 +47,6 @@ UBIFS_EXTRA = \
> - 
> - EXTRA_DIST += $(UBIFS_HEADER) $(UBIFS_EXTRA)
> - 
> -+dist_sbin_SCRIPTS = ubifs-utils/mount.ubifs
> -+
> - sbin_PROGRAMS += $(UBIFS_BINS)
> -diff --git a/ubifs-utils/mount.ubifs b/ubifs-utils/mount.ubifs
> -new file mode 100755
> -index 000000000000..b94ddc5649f4
> ---- /dev/null
> -+++ b/ubifs-utils/mount.ubifs
> -@@ -0,0 +1,101 @@
> -+#!/bin/sh
> -+
> -+# This script should be installed as /sbin/mount.ubifs. The benefit is that an
> -+# fstab entry like:
> -+#
> -+# 	mtd=mtddev:home     /home        ubifs   defaults 0 0
> -+#
> -+# results in the ubi contained in the mtd named "mtddev" to be attached (if not
> -+# already done) and then the volume named "home" being mounted to /home.
> -+
> -+# This is called by mount with the following options:
> -+# /sbin/mount.ubifs spec dir [-sfnv] [-N namespace] [-o options] [-t type.subtype]
> -+
> -+spec="$1"
> -+shift
> -+
> -+mtdname2num() {
> -+	local name
> -+
> -+	name="$1"
> -+
> -+	for d in $(find /sys/class/mtd/ -regex '.*/mtd[0-9]*'); do
> -+		case "$d" in
> -+			*ro)
> -+				continue
> -+				;;
> -+		esac
> -+
> -+		if test "$name" = "$(cat "$d/name")"; then
> -+			local dev mtdnum
> -+
> -+			dev="$(basename "$d")"
> -+			mtdnum="${dev#mtd}"
> -+			echo "$mtdnum"
> -+			return
> -+		fi
> -+	done
> -+
> -+	return 1
> -+}
> -+
> -+mtdnum2ubi() {
> -+	local mtdnum
> -+
> -+	mtdnum="$1"
> -+
> -+	for d in $(find /sys/class/ubi/ -regex '.*/ubi[0-9]*'); do
> -+		case "$d" in
> -+			*_[0-9]*)
> -+				continue
> -+				;;
> -+		esac
> -+
> -+		if test "$mtdnum" = "$(cat "$d/mtd_num")"; then
> -+			local ubi
> -+
> -+			ubi="$(basename "$d")"
> -+			echo "$ubi"
> -+			return;
> -+		fi
> -+	done
> -+
> -+	return 1
> -+}
> -+
> -+mtdnum2ubi_autoattach() {
> -+	local mtdnum ubi
> -+
> -+	mtdnum="$1"
> -+
> -+	ubi="$(mtdnum2ubi "$mtdnum")" && { echo "$ubi"; return; }
> -+
> -+	# ubiattach might fail with "mtdX is already attached to ubiY" if there
> -+	# is more than one mount to do in the same mtd partition. So ignore errors.
> -+	ubiattach -m "$mtdnum" >&2 || true
> -+
> -+	mtdnum2ubi "$mtdnum"
> -+}
> -+
> -+case "$spec" in
> -+	mtd=*:*)
> -+		spec="${spec#mtd=}"
> -+		mtd="${spec%:*}"
> -+		rspec="${spec#*:}"
> -+
> -+		mtdnum="$(mtdname2num "$mtd")" || {
> -+			echo "Failed to find mtdnum for mtd \"$mtd\""
> -+			exit 1
> -+		}
> -+
> -+		ubi="$(mtdnum2ubi_autoattach "$mtdnum")" || {
> -+			echo "Failed to find ubi for mtd \"$mtd\""
> -+			exit 1
> -+		}
> -+
> -+		spec="$ubi:$rspec"
> -+
> -+		;;
> -+esac
> -+
> -+/bin/mount -i -t ubifs "$spec" "$@"
> diff --git a/patches/mtd-utils-2.1.2/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch b/patches/mtd-utils-2.1.3/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> similarity index 89%
> rename from patches/mtd-utils-2.1.2/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> rename to patches/mtd-utils-2.1.3/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> index 1cea5f238e20..e6ff202a7b98 100644
> --- a/patches/mtd-utils-2.1.2/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> +++ b/patches/mtd-utils-2.1.3/0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> @@ -9,7 +9,7 @@ Subject: [PATCH] nandmarkbad: new util to mark blocks as bad
>   create mode 100644 nand-utils/nandmarkbad.c
>  
>  diff --git a/nand-utils/Makemodule.am b/nand-utils/Makemodule.am
> -index d75b0cb3e36c..c31dcb01f06e 100644
> +index cee677783e7a..7fd1de5aa9ae 100644
>  --- a/nand-utils/Makemodule.am
>  +++ b/nand-utils/Makemodule.am
>  @@ -7,6 +7,9 @@ nandwrite_LDADD = libmtd.a
> @@ -19,18 +19,18 @@ index d75b0cb3e36c..c31dcb01f06e 100644
>  +nandmarkbad_SOURCES = nand-utils/nandmarkbad.c
>  +nandmarkbad_LDADD = libmtd.a
>  +
> - nftldump_SOURCES = nand-utils/nftldump.c
> + nftldump_SOURCES = nand-utils/nftldump.c include/mtd_swab.h
> + nftldump_SOURCES += include/mtd/nftl-user.h include/mtd/ftl-user.h
>   nftldump_LDADD = libmtd.a
> +@@ -23,7 +26,7 @@ NAND_SH = \
>   
> -@@ -14,7 +17,7 @@ nftl_format_SOURCES = nand-utils/nftl_format.c
> - nftl_format_LDADD = libmtd.a
> + EXTRA_DIST += $(NAND_SH)
>   
> - NAND_BINS = \
> --	nanddump nandwrite nandtest nftldump nftl_format
> -+	nanddump nandwrite nandtest nandmarkbad nftldump nftl_format
> +-sbin_PROGRAMS += nanddump nandwrite nandtest nftldump nftl_format nandflipbits
> ++sbin_PROGRAMS += nanddump nandwrite nandtest nandmarkbad nftldump nftl_format nandflipbits
>   
> - NAND_SH = \
> - 	nand-utils/load_nandsim.sh
> + if BUILD_TESTS
> + test_SCRIPTS += $(NAND_SH)
>  diff --git a/nand-utils/nandmarkbad.c b/nand-utils/nandmarkbad.c
>  new file mode 100644
>  index 000000000000..cf05698c3609
> diff --git a/patches/mtd-utils-2.1.2/autogen.sh b/patches/mtd-utils-2.1.3/autogen.sh
> similarity index 100%
> rename from patches/mtd-utils-2.1.2/autogen.sh
> rename to patches/mtd-utils-2.1.3/autogen.sh
> diff --git a/patches/mtd-utils-2.1.2/series b/patches/mtd-utils-2.1.3/series
> similarity index 53%
> rename from patches/mtd-utils-2.1.2/series
> rename to patches/mtd-utils-2.1.3/series
> index 7a5eec8b0eeb..92dc1b94f4ca 100644
> --- a/patches/mtd-utils-2.1.2/series
> +++ b/patches/mtd-utils-2.1.3/series
> @@ -1,5 +1,4 @@
>  # generated by git-ptx-patches
>  #tag:base --start-number 1
>  0001-nandmarkbad-new-util-to-mark-blocks-as-bad.patch
> -0002-Add-an-ubifs-mount-helper.patch
> -# 096af547b18d202f08576089a0cee058  - git-ptx-patches magic
> +# 407ded52b82ffa3ff91d50cf6b2388e0  - git-ptx-patches magic
> diff --git a/rules/host-mtd-utils.make b/rules/host-mtd-utils.make
> index f49a08261781..0352339f0215 100644
> --- a/rules/host-mtd-utils.make
> +++ b/rules/host-mtd-utils.make
> @@ -23,8 +23,9 @@ HOST_MTD_UTILS_CONF_TOOL	:= autoconf
>  HOST_MTD_UTILS_CONF_OPT		:= \
>  	$(HOST_AUTOCONF) \
>  	--disable-unit-tests \
> +	--enable-largefile \
>  	--disable-tests \
> -	--disable-install-tests \
> +	--disable-ubihealthd \
>  	--disable-lsmtd \
>  	--without-jffs \
>  	--with-ubifs \
> diff --git a/rules/mtd-utils.make b/rules/mtd-utils.make
> index e1a953c28dfb..15288acd7ad1 100644
> --- a/rules/mtd-utils.make
> +++ b/rules/mtd-utils.make
> @@ -15,8 +15,8 @@ PACKAGES-$(PTXCONF_MTD_UTILS) += mtd-utils
>  #
>  # Paths and names
>  #
> -MTD_UTILS_VERSION	:= 2.1.2
> -MTD_UTILS_MD5		:= 19191bc0195a779c0bd1284c886084ab
> +MTD_UTILS_VERSION	:= 2.1.3
> +MTD_UTILS_MD5		:= 32f3e1dcb21adb1185e994f7b2bf14d8
>  MTD_UTILS		:= mtd-utils-$(MTD_UTILS_VERSION)
>  MTD_UTILS_SUFFIX	:= tar.bz2
>  MTD_UTILS_URL		:= https://infraroot.at/pub/mtd/$(MTD_UTILS).$(MTD_UTILS_SUFFIX)
> @@ -34,8 +34,9 @@ MTD_UTILS_CONF_TOOL	:= autoconf
>  MTD_UTILS_CONF_OPT	:= \
>  	$(CROSS_AUTOCONF_USR) \
>  	--disable-unit-tests \
> +	$(GLOBAL_LARGE_FILE_OPTION) \
>  	--disable-tests \
> -	--disable-install-tests \
> +	--$(call ptx/endis,PTXCONF_MTD_UTILS_UBIHEALTHD)-ubihealthd \
>  	--$(call ptx/endis, PTXCONF_MTD_UTILS_LSMTD)-lsmtd \
>  	--$(call ptx/wwo, PTXCONF_MTD_UTILS_JFFS)-jffs \
>  	--$(call ptx/wwo, PTXCONF_MTD_UTILS_UBIFS)-ubifs \

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

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

* Re: [ptxdist] [APPLIED] mtd-utils: Introduce systemd unit for ubihealthd
  2021-09-09 10:16 ` [ptxdist] [PATCH 2/2] mtd-utils: Introduce systemd unit for ubihealthd Alexander Dahl
@ 2021-10-07 10:18   ` Michael Olbrich
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Olbrich @ 2021-10-07 10:18 UTC (permalink / raw)
  To: ptxdist; +Cc: Alexander Dahl

Thanks, applied as 434bd8a2cee93a599e2d282a152842447aa45cb4.

Michael

[sent from post-receive hook]

On Thu, 07 Oct 2021 12:18:53 +0200, Alexander Dahl <ada@thorsis.com> wrote:
> 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 <ada@thorsis.com>
> Message-Id: <20210909101652.9288-3-ada@thorsis.com>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/projectroot/usr/lib/systemd/system/ubihealthd@.service b/projectroot/usr/lib/systemd/system/ubihealthd@.service
> new file mode 100644
> index 000000000000..f3f0ba25fe05
> --- /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 11b0be23f03d..0d8fb5f5a0df 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 15288acd7ad1..d96ab02b0a7d 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, -, \

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


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

end of thread, other threads:[~2021-10-07 10:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 10:16 [ptxdist] [PATCH 0/2] mtd-utils: Version bump and ubihealthd systemd unit Alexander Dahl
2021-09-09 10:16 ` [ptxdist] [PATCH 1/2] mtd-utils: version bump 2.1.2 -> 2.1.3 Alexander Dahl
2021-10-07 10:18   ` [ptxdist] [APPLIED] " Michael Olbrich
2021-09-09 10:16 ` [ptxdist] [PATCH 2/2] mtd-utils: Introduce systemd unit for ubihealthd Alexander Dahl
2021-10-07 10:18   ` [ptxdist] [APPLIED] " Michael Olbrich

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