summaryrefslogtreecommitdiffstats
path: root/rules.d
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>2023-10-11 16:33:25 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-10-17 11:43:30 +0200
commit84ff5894db9a9e5633b27db51876c18dc8470c35 (patch)
tree6b076aaaee2f8c03ef2cfd1c934f43c3146a0403 /rules.d
parentMerge pull request #28373 from DaanDeMeyer/udevadm-query (diff)
downloadsystemd-84ff5894db9a9e5633b27db51876c18dc8470c35.tar.xz
systemd-84ff5894db9a9e5633b27db51876c18dc8470c35.zip
rules: add mtd/by-name symlinks
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.
Diffstat (limited to 'rules.d')
-rw-r--r--rules.d/60-persistent-storage-mtd.rules12
-rw-r--r--rules.d/meson.build1
2 files changed, 13 insertions, 0 deletions
diff --git a/rules.d/60-persistent-storage-mtd.rules b/rules.d/60-persistent-storage-mtd.rules
new file mode 100644
index 0000000000..bcf93b9a05
--- /dev/null
+++ b/rules.d/60-persistent-storage-mtd.rules
@@ -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"
diff --git a/rules.d/meson.build b/rules.d/meson.build
index 13f25397dc..3040fae8a4 100644
--- a/rules.d/meson.build
+++ b/rules.d/meson.build
@@ -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',