summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/udev
diff options
context:
space:
mode:
authorMuhammad Hamza <Muhammad_Hamza@mentor.com>2022-06-21 14:05:12 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-21 18:44:27 +0100
commitaab4152eff4d3df3153307cf37ef8c80009991f5 (patch)
tree4d46d8cd799b4bfbd57756e7502094491148c8b0 /meta/recipes-core/udev
parent16797c1b94839db98de2e76f9bc71932e47fa3a6 (diff)
downloadpoky-aab4152eff4d3df3153307cf37ef8c80009991f5.tar.gz
udev-extraconf/mount.sh: add LABELs to mountpoints
This alters the mountpoints such that if a device has a LABEL or a PARTLABEL, it will be mounted at e.g.: /run/media/$LABEL-<device-node> /run/media/$PARTLABEL-<device-node> /run/media/rootfs-sda2 otherwise the device will be mounted at e.g.: /run/media/<device-node> /run/media/sda1 The <device-node> appended with LABEL or PARTLABEL makes sure that the mountpoint is unique, therefore, avoids overlapping mounts. (From OE-Core rev: a9a0a0967832445f1bcc65d58f95343d1b562e1b) Signed-off-by: Arsalan H. Awan <Arsalan_Awan@mentor.com> Signed-off-by: Muhammad Hamza <muhammad_hamza@mentor.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev')
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh18
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb2
2 files changed, 19 insertions, 1 deletions
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index c8b773bc07..40910be8bd 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -54,6 +54,9 @@ automount_systemd() {
54 grep "^[[:space:]]*$tmp" /etc/fstab && return 54 grep "^[[:space:]]*$tmp" /etc/fstab && return
55 done 55 done
56 56
57 # Get the unique name for mount point
58 get_label_name "${DEVNAME}"
59
57 [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" 60 [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name"
58 61
59 MOUNT="$MOUNT -o silent" 62 MOUNT="$MOUNT -o silent"
@@ -94,6 +97,9 @@ automount() {
94 # configured in fstab 97 # configured in fstab
95 grep -q "^$DEVNAME " /proc/mounts && return 98 grep -q "^$DEVNAME " /proc/mounts && return
96 99
100 # Get the unique name for mount point
101 get_label_name "${DEVNAME}"
102
97 ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" 103 ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name"
98 # Silent util-linux's version of mounting auto 104 # Silent util-linux's version of mounting auto
99 if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; 105 if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
@@ -134,6 +140,18 @@ rm_dir() {
134 fi 140 fi
135} 141}
136 142
143get_label_name() {
144 # Get the LABEL or PARTLABEL
145 LABEL=`/sbin/blkid | grep "$1:" | grep -o 'LABEL=".*"' | cut -d '"' -f2`
146 # If the $DEVNAME has a LABEL or a PARTLABEL
147 if [ -n "$LABEL" ]; then
148 # Set the mount location dir name to LABEL appended
149 # with $name e.g. label-sda. That would avoid overlapping
150 # mounts in case two devices have same LABEL
151 name="${LABEL}-${name}"
152 fi
153}
154
137# No ID_FS_TYPE for cdrom device, yet it should be mounted 155# No ID_FS_TYPE for cdrom device, yet it should be mounted
138name="`basename "$DEVNAME"`" 156name="`basename "$DEVNAME"`"
139[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media` 157[ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media`
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb
index 2b908ac05b..8213c1a930 100644
--- a/meta/recipes-core/udev/udev-extraconf_1.1.bb
+++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -38,7 +38,7 @@ do_install() {
38} 38}
39 39
40FILES:${PN} = "${sysconfdir}/udev" 40FILES:${PN} = "${sysconfdir}/udev"
41RDEPENDS:${PN} = "udev" 41RDEPENDS:${PN} = "udev util-linux-blkid"
42CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist" 42CONFFILES:${PN} = "${sysconfdir}/udev/mount.ignorelist"
43 43
44# to replace udev-extra-rules from meta-oe 44# to replace udev-extra-rules from meta-oe