diff options
author | Denys Dmytriyenko <denys@ti.com> | 2014-04-01 03:54:11 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-04-25 17:19:20 +0100 |
commit | 20ded0a263333a1eaef7a717cf8d764b47115e68 (patch) | |
tree | 7ed4e1af009ba71bc17e103fa92c7d1d3f0dc865 /meta/recipes-core | |
parent | 62238e1335e16347e9419184b8e30f508ada6e11 (diff) | |
download | poky-20ded0a263333a1eaef7a717cf8d764b47115e68.tar.gz |
udev-extraconf: update mount.sh to use /run/media instead of /media
This is done to work around the issue of auto-mounting block devices
(i.e. SD cards) when root filesystem is still in read-only mode and
creating /media/<device> mount-points by udev is not possible. That
is due to udev (/etc/rcS.d/S03udev) getting started earlier than
checkroot (/etc/rcS.d/S10checkroot.sh) gets a chance to re-mount the
rootfs as read-write.
Although, canonical FHS specifies /media/<device> as a mount point
for removable media devices, the latest 2.3 version was released in
2004 and since then FreeDesktop/udisks and other tools adopted the
new /run/media/<user>/<device> location. That was done to overcome
read-only rootfs limitation, since /run is usually a tmpfs mounted
partition, plus avoid name-clash between users.
For our embedded systems environment we assume single-user operation
and hence simplify mount point to just /run/media/<device>. But for
proper per-user mounting to /run/media/<user>/<device>, some sort of
session management is required along with the tool like udisks, that
is out of scope of this simple udev-based auto-mounting.
(From OE-Core rev: acfe3014d41de5e87cdbc58d0396349c6b9c3ffd)
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/udev/udev-extraconf/mount.sh | 14 | ||||
-rw-r--r-- | meta/recipes-core/udev/udev-extraconf_1.1.bb (renamed from meta/recipes-core/udev/udev-extraconf_1.0.bb) | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index cb57e47a90..3e4f21f2eb 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh | |||
@@ -20,7 +20,7 @@ done | |||
20 | automount() { | 20 | automount() { |
21 | name="`basename "$DEVNAME"`" | 21 | name="`basename "$DEVNAME"`" |
22 | 22 | ||
23 | ! test -d "/media/$name" && mkdir -p "/media/$name" | 23 | ! test -d "/run/media/$name" && mkdir -p "/run/media/$name" |
24 | # Silent util-linux's version of mounting auto | 24 | # Silent util-linux's version of mounting auto |
25 | if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; | 25 | if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; |
26 | then | 26 | then |
@@ -38,12 +38,12 @@ automount() { | |||
38 | ;; | 38 | ;; |
39 | esac | 39 | esac |
40 | 40 | ||
41 | if ! $MOUNT -t auto $DEVNAME "/media/$name" | 41 | if ! $MOUNT -t auto $DEVNAME "/run/media/$name" |
42 | then | 42 | then |
43 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!" | 43 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" |
44 | rm_dir "/media/$name" | 44 | rm_dir "/run/media/$name" |
45 | else | 45 | else |
46 | logger "mount.sh/automount" "Auto-mount of [/media/$name] successful" | 46 | logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" |
47 | touch "/tmp/.automount-$name" | 47 | touch "/tmp/.automount-$name" |
48 | fi | 48 | fi |
49 | } | 49 | } |
@@ -60,7 +60,7 @@ rm_dir() { | |||
60 | 60 | ||
61 | # No ID_FS_TYPE for cdrom device, yet it should be mounted | 61 | # No ID_FS_TYPE for cdrom device, yet it should be mounted |
62 | name="`basename "$DEVNAME"`" | 62 | name="`basename "$DEVNAME"`" |
63 | [ -e /sys/block/$name/device/media ] && media_type=`cat /sys/block/$name/device/media` | 63 | [ -e /sys/block/$name/device/run/media ] && media_type=`cat /sys/block/$name/device/run/media` |
64 | 64 | ||
65 | if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then | 65 | if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_type" = "cdrom" ]; then |
66 | if [ -x "$PMOUNT" ]; then | 66 | if [ -x "$PMOUNT" ]; then |
@@ -87,5 +87,5 @@ if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then | |||
87 | 87 | ||
88 | # Remove empty directories from auto-mounter | 88 | # Remove empty directories from auto-mounter |
89 | name="`basename "$DEVNAME"`" | 89 | name="`basename "$DEVNAME"`" |
90 | test -e "/tmp/.automount-$name" && rm_dir "/media/$name" | 90 | test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name" |
91 | fi | 91 | fi |
diff --git a/meta/recipes-core/udev/udev-extraconf_1.0.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index 3810b28155..d69056dd76 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.0.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb | |||
@@ -4,8 +4,6 @@ LICENSE = "MIT" | |||
4 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ | 4 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \ |
5 | file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | 5 | file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
6 | 6 | ||
7 | PR = "r16" | ||
8 | |||
9 | SRC_URI = " \ | 7 | SRC_URI = " \ |
10 | file://automount.rules \ | 8 | file://automount.rules \ |
11 | file://mount.sh \ | 9 | file://mount.sh \ |