]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
rules: add mtd/by-name symlinks
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Wed, 11 Oct 2023 14:33:25 +0000 (16:33 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 17 Oct 2023 09:43:30 +0000 (11:43 +0200)
Add persistent symlinks for MTD devices like SPI-NOR flash, based on the
partition names specified on the cmdline, in a Device Tree, or by other
MTD partitioning parser drivers. Using the persistent name can be
preferable to using the numbered /dev/mtdX device, as the latter can
change depending on probe order or when partitioning has changed.

rules.d/60-persistent-storage-mtd.rules [new file with mode: 0644]
rules.d/meson.build

diff --git a/rules.d/60-persistent-storage-mtd.rules b/rules.d/60-persistent-storage-mtd.rules
new file mode 100644 (file)
index 0000000..bcf93b9
--- /dev/null
@@ -0,0 +1,12 @@
+# do not edit this file, it will be overwritten on update
+
+# persistent storage links: /dev/mtd/by-name
+
+ACTION=="remove", GOTO="persistent_storage_mtd_end"
+SUBSYSTEM!="mtd", GOTO="persistent_storage_mtd_end"
+KERNEL!="mtd[0-9]*", GOTO="persistent_storage_mtd_end"
+KERNEL=="mtd[0-9]*ro", GOTO="persistent_storage_mtd_end"
+
+ATTR{name}=="?*", SYMLINK+="mtd/by-name/$attr{name}"
+
+LABEL="persistent_storage_mtd_end"
index 13f25397dcde3554b62a0644ff50b6c94050caaa..3040fae8a43f94d4c784f575d7cc7f6d8352a333 100644 (file)
@@ -16,6 +16,7 @@ rules = [
                '60-input-id.rules',
                '60-persistent-alsa.rules',
                '60-persistent-input.rules',
+               '60-persistent-storage-mtd.rules',
                '60-persistent-storage-tape.rules',
                '60-persistent-v4l.rules',
                '60-sensor.rules',