All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Busybox mdev improvements
@ 2014-12-04 10:27 Mike Looijmans
  2014-12-04 10:27 ` [PATCH 1/2] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
                   ` (4 more replies)
  0 siblings, 5 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-04 10:27 UTC (permalink / raw)
  To: openembedded-core

I've been using busybox mdev instead of udev in many projects, which so
far has worked excellently.

Each of these projects needed similar patches to busybox to make it work,
so I think its time these changes move into the core for everyone to use.

This first series fixes the touchscreen support. A patch to automatically
have mdev mount storage devices will follow soon, I'm still testing it.



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

* [PATCH 1/2] busybox-mdev: Install missing find-touchscreen.sh
  2014-12-04 10:27 [PATCH 0/2] Busybox mdev improvements Mike Looijmans
@ 2014-12-04 10:27 ` Mike Looijmans
  2014-12-04 10:27 ` [PATCH 2/2] busybox/find-touchscreen.sh: Simplify script and recognize USB devices Mike Looijmans
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-04 10:27 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

mdev.conf references the find-touchscreen.sh script, but this file
was not being installed. Add the script to the busybox-mdev package.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 meta/recipes-core/busybox/busybox.inc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index bd66e4f..deb2ee4 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -23,7 +23,7 @@ PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}
 
 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
 FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
-FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf"
+FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
 FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
 FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
@@ -268,6 +268,8 @@ do_install () {
                install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
                if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
                        install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
+                       install -d ${D}${sysconfdir}/mdev
+                       install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
                fi
 	fi
 
-- 
1.7.9.5



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

* [PATCH 2/2] busybox/find-touchscreen.sh: Simplify script and recognize USB devices
  2014-12-04 10:27 [PATCH 0/2] Busybox mdev improvements Mike Looijmans
  2014-12-04 10:27 ` [PATCH 1/2] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
@ 2014-12-04 10:27 ` Mike Looijmans
  2014-12-04 20:47 ` [PATCH 0/2] Busybox mdev improvements Otavio Salvador
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-04 10:27 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

Simplify the grep expression, use the more common "grep" command instead
of "egrep", avoid forking extra processes, join multiple invokations into
a single combined expression.

Change the touchscreen regex so that it also recognizes various USB
touchscreen controllers and the ad7879 i2c device.

Based on code used in OpenPLi and meta-topic.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 .../recipes-core/busybox/files/find-touchscreen.sh |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/busybox/files/find-touchscreen.sh b/meta/recipes-core/busybox/files/find-touchscreen.sh
index 1582ea8..52c5e7a 100644
--- a/meta/recipes-core/busybox/files/find-touchscreen.sh
+++ b/meta/recipes-core/busybox/files/find-touchscreen.sh
@@ -1,9 +1,6 @@
 #!/bin/sh
 
-if [ `egrep "input:.*-e0.*,3,.*a0,1,.*18,.*" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
-	ln -sf /dev/input/$MDEV /dev/input/touchscreen0
+if grep -q "input:.*-e0.*,3,.*a0,1,\|ads7846" /sys/class/$MDEV/device/modalias ; then
+	ln -sf /dev/$MDEV /dev/input/touchscreen0
 fi
 
-if [ `egrep "ads7846" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
-	ln -sf /dev/input/$MDEV /dev/input/touchscreen0
-fi
-- 
1.7.9.5



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

* Re: [PATCH 0/2] Busybox mdev improvements
  2014-12-04 10:27 [PATCH 0/2] Busybox mdev improvements Mike Looijmans
  2014-12-04 10:27 ` [PATCH 1/2] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
  2014-12-04 10:27 ` [PATCH 2/2] busybox/find-touchscreen.sh: Simplify script and recognize USB devices Mike Looijmans
@ 2014-12-04 20:47 ` Otavio Salvador
  2014-12-05  6:18   ` Mike Looijmans
  2014-12-05  9:58 ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
  2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
  4 siblings, 1 reply; 32+ messages in thread
From: Otavio Salvador @ 2014-12-04 20:47 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: Patches and discussions about the oe-core layer

On Thu, Dec 4, 2014 at 8:27 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> This first series fixes the touchscreen support. A patch to automatically
> have mdev mount storage devices will follow soon, I'm still testing it.

I enjoy this idea but please put this one in a specific sub-package or
with a setting in /etc/default/mdev to enable/disable it.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH 0/2] Busybox mdev improvements
  2014-12-04 20:47 ` [PATCH 0/2] Busybox mdev improvements Otavio Salvador
@ 2014-12-05  6:18   ` Mike Looijmans
  2014-12-05 11:27     ` Otavio Salvador
  0 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-05  6:18 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Patches and discussions about the oe-core layer

On 12/04/2014 09:47 PM, Otavio Salvador wrote:
> On Thu, Dec 4, 2014 at 8:27 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>> This first series fixes the touchscreen support. A patch to automatically
>> have mdev mount storage devices will follow soon, I'm still testing it.
>
> I enjoy this idea but please put this one in a specific sub-package or
> with a setting in /etc/default/mdev to enable/disable it.

By "this" you refer to the automatic mounting? No problem, and a good 
suggestion too.

Another problem I solved in various projects is the automatic loading of 
kernel drivers. It makes mdev automatically load modules and firmware, e.g. 
when plugging in a USB device, and adds a script to scan for hotpluggable 
devices at boot. It's only a few lines, but these make mdeve provide most of 
udev's functionality.




Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-04 10:27 [PATCH 0/2] Busybox mdev improvements Mike Looijmans
                   ` (2 preceding siblings ...)
  2014-12-04 20:47 ` [PATCH 0/2] Busybox mdev improvements Otavio Salvador
@ 2014-12-05  9:58 ` Mike Looijmans
  2014-12-05  9:58   ` [PATCH 2/2] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
                     ` (2 more replies)
  2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
  4 siblings, 3 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-05  9:58 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

Upon inserting a USB stick or similar device, mdev will run
an automounter script that mounts valid partitions on
/media/<device>. The script first checks /etc/fstab entries
so that mounting on UUID or LABEL or using custom mount options
is still possible. If /etc/fstab does not contain particular
mount options, the script will create (and remove) the mountpoint
automatically.
The script also supports full disk partitions (devices without
partition table).

The automatic mounting can be disabled by adding a line
MDEV_AUTOMOUNT=y
into /etc/default/mdev

Automatic mounting for a particular device can be disabled by
creating a file "/dev/<device>.nomount". This is helpful in
scripts that create partitions for example, and want to perform
specific actions which require the device to remain unmounted.

A more complex variation (using LABEL based mounts) on this script
has been in use in OpenPLi for many years now, and I've used this
one on many projects already, so it's about time to push this to
mainline.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 meta/recipes-core/busybox/busybox.inc         |    1 +
 meta/recipes-core/busybox/busybox_1.22.1.bb   |    1 +
 meta/recipes-core/busybox/busybox_git.bb      |    1 +
 meta/recipes-core/busybox/files/mdev-mount.sh |   62 +++++++++++++++++++++++++
 meta/recipes-core/busybox/files/mdev.conf     |    3 ++
 5 files changed, 68 insertions(+)
 create mode 100644 meta/recipes-core/busybox/files/mdev-mount.sh

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index deb2ee4..0769d92 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -270,6 +270,7 @@ do_install () {
                        install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
                        install -d ${D}${sysconfdir}/mdev
                        install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
+                       install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
                fi
 	fi
 
diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb b/meta/recipes-core/busybox/busybox_1.22.1.bb
index 82f7f68..f379bb6 100644
--- a/meta/recipes-core/busybox/busybox_1.22.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
@@ -20,6 +20,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://busybox-syslog.default \
            file://mdev \
            file://mdev.conf \
+           file://mdev-mount.sh \
            file://umount.busybox \
            file://defconfig \
            file://busybox-syslog.service.in \
diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
index f2cc119..f91b552 100644
--- a/meta/recipes-core/busybox/busybox_git.bb
+++ b/meta/recipes-core/busybox/busybox_git.bb
@@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
            file://busybox-syslog.default \
            file://mdev \
            file://mdev.conf \
+           file://mdev-mount.sh \
            file://umount.busybox \
            file://defconfig \
            file://busybox-syslog.service.in \
diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh b/meta/recipes-core/busybox/files/mdev-mount.sh
new file mode 100644
index 0000000..60ecf88
--- /dev/null
+++ b/meta/recipes-core/busybox/files/mdev-mount.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+MDEV_AUTOMOUNT=y
+[ -f /etc/default/mdev ] && . /etc/default/mdev
+if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
+	exit 0
+fi
+
+case "$ACTION" in
+	add|"")
+		ACTION="add"
+		# check if already mounted
+		if grep -q "^/dev/${MDEV} " /proc/mounts ; then
+			# Already mounted
+			exit 0
+		fi
+		DEVBASE=`expr substr $MDEV 1 3`
+		if [ "${DEVBASE}" == "mmc" ] ; then
+			DEVBASE=`expr substr $MDEV 1 7`
+		fi
+		# check for "please don't mount it" file
+		if [ -f "/dev/nomount.${DEVBASE}" ] ; then
+			# blocked
+			exit 0
+		fi
+		# check for full-disk partition
+		if [ "${DEVBASE}" == "${MDEV}" ] ; then
+			if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
+				# Partition detected, just quit
+				exit 0
+			fi
+			if [ ! -f /sys/block/${DEVBASE}/size ] ; then
+				# No size at all
+				exit 0
+			fi
+			if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
+				# empty device, bail out
+				exit 0
+			fi
+		fi
+		# first allow fstab to determine the mountpoint
+		if ! mount /dev/$MDEV > /dev/null 2>&1
+		then
+			MOUNTPOINT="/media/$MDEV"
+			mkdir "$MOUNTPOINT"
+			mount -t auto /dev/$MDEV "$MOUNTPOINT"
+		fi
+		;;
+	remove)
+		MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
+		if [ ! -z "$MOUNTPOINT" ]
+		then
+			umount "$MOUNTPOINT"
+			rmdir "$MOUNTPOINT"
+		else
+			umount /dev/$MDEV
+		fi
+		;;
+	*)
+		# Unexpected keyword
+		exit 1
+		;;
+esac
diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
index e688911..c83bb4c 100644
--- a/meta/recipes-core/busybox/files/mdev.conf
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -35,3 +35,6 @@ input/mice 0:0 0660
 input/mouse.* 0:0 0660
 
 tun[0-9]* 0:0 0660 =net/
+
+[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
+mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
-- 
1.7.9.5



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

* [PATCH 2/2] busybox-mdev: Add hotplug kernel module support to mdev.conf
  2014-12-05  9:58 ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
@ 2014-12-05  9:58   ` Mike Looijmans
  2014-12-17 22:01   ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Burton, Ross
  2014-12-17 22:03   ` Burton, Ross
  2 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-05  9:58 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

Add a line to mdev.conf that tells mdev to load kernel modules when
required.

For example, if you built wifi support as an external module, inserting
a wifi stick into a USB port will now automatically load that module
into the kernel and the wlan device will be ready for configuration.
Without this patch, you have to load required modules manually or force
them to load at system startup.
---
 meta/recipes-core/busybox/files/mdev.conf |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
index c83bb4c..17e93da 100644
--- a/meta/recipes-core/busybox/files/mdev.conf
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -1,3 +1,5 @@
+$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
+
 console 0:0 0600 
 cpu_dma_latency 0:0 0660 
 fb0:0 44 0660 
-- 
1.7.9.5



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

* Re: [PATCH 0/2] Busybox mdev improvements
  2014-12-05  6:18   ` Mike Looijmans
@ 2014-12-05 11:27     ` Otavio Salvador
  2014-12-05 12:57       ` Mike Looijmans
  0 siblings, 1 reply; 32+ messages in thread
From: Otavio Salvador @ 2014-12-05 11:27 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 5, 2014 at 4:18 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> On 12/04/2014 09:47 PM, Otavio Salvador wrote:
>>
>> On Thu, Dec 4, 2014 at 8:27 AM, Mike Looijmans <mike.looijmans@topic.nl>
>> wrote:
>>>
>>> This first series fixes the touchscreen support. A patch to automatically
>>> have mdev mount storage devices will follow soon, I'm still testing it.
>>
>>
>> I enjoy this idea but please put this one in a specific sub-package or
>> with a setting in /etc/default/mdev to enable/disable it.
>
>
> By "this" you refer to the automatic mounting? No problem, and a good
> suggestion too.

Yes.

> Another problem I solved in various projects is the automatic loading of
> kernel drivers. It makes mdev automatically load modules and firmware, e.g.
> when plugging in a USB device, and adds a script to scan for hotpluggable
> devices at boot. It's only a few lines, but these make mdeve provide most of
> udev's functionality.

Agreed and I think this is also a good addition; however we should
have it in a subpackage as well.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH 0/2] Busybox mdev improvements
  2014-12-05 11:27     ` Otavio Salvador
@ 2014-12-05 12:57       ` Mike Looijmans
  2014-12-05 14:13         ` Otavio Salvador
  0 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-05 12:57 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Patches and discussions about the oe-core layer

On 12/05/2014 12:27 PM, Otavio Salvador wrote:
> On Fri, Dec 5, 2014 at 4:18 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>> On 12/04/2014 09:47 PM, Otavio Salvador wrote:
>>>
>>> On Thu, Dec 4, 2014 at 8:27 AM, Mike Looijmans <mike.looijmans@topic.nl>
>>> wrote:
>>>>
>>>> This first series fixes the touchscreen support. A patch to automatically
>>>> have mdev mount storage devices will follow soon, I'm still testing it.
>>>
>>>
>>> I enjoy this idea but please put this one in a specific sub-package or
>>> with a setting in /etc/default/mdev to enable/disable it.
>>
>>
>> By "this" you refer to the automatic mounting? No problem, and a good
>> suggestion too.
>
> Yes.
>
>> Another problem I solved in various projects is the automatic loading of
>> kernel drivers. It makes mdev automatically load modules and firmware, e.g.
>> when plugging in a USB device, and adds a script to scan for hotpluggable
>> devices at boot. It's only a few lines, but these make mdeve provide most of
>> udev's functionality.
>
> Agreed and I think this is also a good addition; however we should
> have it in a subpackage as well.

"busybox-mdev" is already a separate package. Both automounter and module 
loader need an entry in mdev.conf to work. (The module loader is nothing but 
an entry).

If projects or users don't want these, they can provide their own mdev.conf 
(it's a CONFFILE anyway). This just makes for a better default.

The "load modules at boot" script is yet on its way, it contains about 3 lines 
of shell script which only make sense for mdev, so putting that in a separate 
package seems overkill to me.


(PS:)
 From the current state of busybox-mdev in OE-core, my perception is that 
there are only a handful of projects in the world that use it, and I'm a 
member of two of those...


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* Re: [PATCH 0/2] Busybox mdev improvements
  2014-12-05 12:57       ` Mike Looijmans
@ 2014-12-05 14:13         ` Otavio Salvador
  0 siblings, 0 replies; 32+ messages in thread
From: Otavio Salvador @ 2014-12-05 14:13 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 5, 2014 at 10:57 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> On 12/05/2014 12:27 PM, Otavio Salvador wrote:
>>
>> On Fri, Dec 5, 2014 at 4:18 AM, Mike Looijmans <mike.looijmans@topic.nl>
>> wrote:
> (PS:)
> From the current state of busybox-mdev in OE-core, my perception is that
> there are only a handful of projects in the world that use it, and I'm a
> member of two of those...

I also use it :)

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-05  9:58 ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
  2014-12-05  9:58   ` [PATCH 2/2] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
@ 2014-12-17 22:01   ` Burton, Ross
  2014-12-18 13:14     ` Mike Looijmans
  2014-12-17 22:03   ` Burton, Ross
  2 siblings, 1 reply; 32+ messages in thread
From: Burton, Ross @ 2014-12-17 22:01 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]

On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>
> The automatic mounting can be disabled by adding a line
> MDEV_AUTOMOUNT=y
> into /etc/default/mdev
>

Presumably you meant =n there, right?

Ross

[-- Attachment #2: Type: text/html, Size: 642 bytes --]

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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-05  9:58 ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
  2014-12-05  9:58   ` [PATCH 2/2] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
  2014-12-17 22:01   ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Burton, Ross
@ 2014-12-17 22:03   ` Burton, Ross
  2014-12-17 22:05     ` Burton, Ross
                       ` (2 more replies)
  2 siblings, 3 replies; 32+ messages in thread
From: Burton, Ross @ 2014-12-17 22:03 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

Hi Mike,

On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>
> Upon inserting a USB stick or similar device, mdev will run
> an automounter script that mounts valid partitions on
> /media/<device>. The script first checks /etc/fstab entries
> so that mounting on UUID or LABEL or using custom mount options
> is still possible. If /etc/fstab does not contain particular
> mount options, the script will create (and remove) the mountpoint
> automatically.
> The script also supports full disk partitions (devices without
> partition table).
>

Thanks for this, but can this script be put into a separate recipe to make
it even easier for people who don't want it, or want their own version?
The prior art here is the udev automounting script which is in
udev-extraconf.

Cheers,
Ross

[-- Attachment #2: Type: text/html, Size: 1314 bytes --]

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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-17 22:03   ` Burton, Ross
@ 2014-12-17 22:05     ` Burton, Ross
  2014-12-17 22:08     ` Gary Thomas
  2014-12-18  6:23     ` Mike Looijmans
  2 siblings, 0 replies; 32+ messages in thread
From: Burton, Ross @ 2014-12-17 22:05 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

On 17 December 2014 at 22:03, Burton, Ross <ross.burton@intel.com> wrote:
>
> Thanks for this, but can this script be put into a separate recipe to make
> it even easier for people who don't want it, or want their own version?
> The prior art here is the udev automounting script which is in
> udev-extraconf.


That embarrassing moment when you realise that Otavio said the same thing
twelve days earlier. :)
Ross

[-- Attachment #2: Type: text/html, Size: 732 bytes --]

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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-17 22:03   ` Burton, Ross
  2014-12-17 22:05     ` Burton, Ross
@ 2014-12-17 22:08     ` Gary Thomas
  2014-12-18  6:31       ` Mike Looijmans
  2014-12-18  6:23     ` Mike Looijmans
  2 siblings, 1 reply; 32+ messages in thread
From: Gary Thomas @ 2014-12-17 22:08 UTC (permalink / raw)
  To: openembedded-core

On 2014-12-17 15:03, Burton, Ross wrote:
> Hi Mike,
>
> On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl <mailto:mike.looijmans@topic.nl>> wrote:
>
>     Upon inserting a USB stick or similar device, mdev will run
>     an automounter script that mounts valid partitions on
>     /media/<device>. The script first checks /etc/fstab entries
>     so that mounting on UUID or LABEL or using custom mount options
>     is still possible. If /etc/fstab does not contain particular
>     mount options, the script will create (and remove) the mountpoint
>     automatically.
>     The script also supports full disk partitions (devices without
>     partition table).
>
>
> Thanks for this, but can this script be put into a separate recipe to make it even easier for people who don't want it, or want their own version?  The prior art here is the udev
> automounting script which is in udev-extraconf.

Also it would be nice if the path matched the most recent
use in udev which is /run/media/<device>

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-17 22:03   ` Burton, Ross
  2014-12-17 22:05     ` Burton, Ross
  2014-12-17 22:08     ` Gary Thomas
@ 2014-12-18  6:23     ` Mike Looijmans
  2014-12-18 13:30       ` Burton, Ross
  2 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18  6:23 UTC (permalink / raw)
  To: Burton, Ross, OE-core

On 12/17/2014 11:03 PM, Burton, Ross wrote:
> Hi Mike,
>
> On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl
> <mailto:mike.looijmans@topic.nl>> wrote:
>
>     Upon inserting a USB stick or similar device, mdev will run
>     an automounter script that mounts valid partitions on
>     /media/<device>. The script first checks /etc/fstab entries
>     so that mounting on UUID or LABEL or using custom mount options
>     is still possible. If /etc/fstab does not contain particular
>     mount options, the script will create (and remove) the mountpoint
>     automatically.
>     The script also supports full disk partitions (devices without
>     partition table).
>
> Thanks for this, but can this script be put into a separate recipe to make it
> even easier for people who don't want it, or want their own version?  The
> prior art here is the udev automounting script which is in udev-extraconf.

Putting the script into its own package is no problem, but how does one 
arrange this with mdev.conf?

For the automounter to work, mdev.conf needs extra entries to call the script 
when block devices appear/disappear.

Unlike udev, mdev only has one config file.


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-17 22:08     ` Gary Thomas
@ 2014-12-18  6:31       ` Mike Looijmans
  2014-12-18 12:55         ` Otavio Salvador
  0 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18  6:31 UTC (permalink / raw)
  To: openembedded-core

On 12/17/2014 11:08 PM, Gary Thomas wrote:
> On 2014-12-17 15:03, Burton, Ross wrote:
>> Hi Mike,
>>
>> On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl
>> <mailto:mike.looijmans@topic.nl>> wrote:
>>
>>     Upon inserting a USB stick or similar device, mdev will run
>>     an automounter script that mounts valid partitions on
>>     /media/<device>. The script first checks /etc/fstab entries
>>     so that mounting on UUID or LABEL or using custom mount options
>>     is still possible. If /etc/fstab does not contain particular
>>     mount options, the script will create (and remove) the mountpoint
>>     automatically.
>>     The script also supports full disk partitions (devices without
>>     partition table).
>>
>>
>> Thanks for this, but can this script be put into a separate recipe to make
>> it even easier for people who don't want it, or want their own version?  The
>> prior art here is the udev
>> automounting script which is in udev-extraconf.
>
> Also it would be nice if the path matched the most recent
> use in udev which is /run/media/<device>

Of course, these locations need to move around every few years, otherwise 
people would be expecting things to remain in place...

I'd rather keep using the /media symlink, as it gives distributions a chance 
to move things around.

On the satellite settop boxes, /media is a 64k tmpfs mount. This is because 
when a mount fails, the box may end up writing a TV recording to wherever 
/media happens to be. It that's flash or a big tmpfs, the box will commit 
suicide in mere seconds by either filling the flash or eating up the precious 
RAM. And for some things, the box really needs a big tmpfs, so just reducing 
the volatiles' sizes wasn't an option.

Having said that, if this is blocking, I'll do a s./media./run/media.g on the 
file, getting this mainlined has higher priority.

M.


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-18  6:31       ` Mike Looijmans
@ 2014-12-18 12:55         ` Otavio Salvador
  2014-12-18 14:38           ` Mike Looijmans
  0 siblings, 1 reply; 32+ messages in thread
From: Otavio Salvador @ 2014-12-18 12:55 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: Patches and discussions about the oe-core layer

Hello Mike,

On Thu, Dec 18, 2014 at 4:31 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> On 12/17/2014 11:08 PM, Gary Thomas wrote:
>>
>> On 2014-12-17 15:03, Burton, Ross wrote:
>>>
>>> Hi Mike,
>>>
>>> On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl
>>> <mailto:mike.looijmans@topic.nl>> wrote:
>>>
>>>     Upon inserting a USB stick or similar device, mdev will run
>>>     an automounter script that mounts valid partitions on
>>>     /media/<device>. The script first checks /etc/fstab entries
>>>     so that mounting on UUID or LABEL or using custom mount options
>>>     is still possible. If /etc/fstab does not contain particular
>>>     mount options, the script will create (and remove) the mountpoint
>>>     automatically.
>>>     The script also supports full disk partitions (devices without
>>>     partition table).
>>>
>>>
>>> Thanks for this, but can this script be put into a separate recipe to
>>> make
>>> it even easier for people who don't want it, or want their own version?
>>> The
>>> prior art here is the udev
>>> automounting script which is in udev-extraconf.
...

I didn't try but what happens in mdev if the script does not exists? I
mean keep mdev.conf as is (ready for use) and move the script to
another package which can be installed or not.

> On the satellite settop boxes, /media is a 64k tmpfs mount. This is because
> when a mount fails, the box may end up writing a TV recording to wherever
> /media happens to be. It that's flash or a big tmpfs, the box will commit
> suicide in mere seconds by either filling the flash or eating up the
> precious RAM. And for some things, the box really needs a big tmpfs, so just
> reducing the volatiles' sizes wasn't an option.

Nice 'solution' to avoid a more serious problem :-D

> Having said that, if this is blocking, I'll do a s./media./run/media.g on
> the file, getting this mainlined has higher priority.

I prefer to have it behaving as udev as much as possible, by default.
However, the script could source a defaults file (if it exists) to
change the mounting point for example and allow for those special
systems to be handle without forking.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-17 22:01   ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Burton, Ross
@ 2014-12-18 13:14     ` Mike Looijmans
  0 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 13:14 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On 12/17/2014 11:01 PM, Burton, Ross wrote:
>
> On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl
> <mailto:mike.looijmans@topic.nl>> wrote:
>
>     The automatic mounting can be disabled by adding a line
>     MDEV_AUTOMOUNT=y
>     into /etc/default/mdev
>
>
> Presumably you meant =n there, right?

Yeah.


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-18  6:23     ` Mike Looijmans
@ 2014-12-18 13:30       ` Burton, Ross
  2014-12-18 13:54         ` Mike Looijmans
  0 siblings, 1 reply; 32+ messages in thread
From: Burton, Ross @ 2014-12-18 13:30 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

On 18 December 2014 at 06:23, Mike Looijmans <mike.looijmans@topic.nl>
wrote:
>
> Putting the script into its own package is no problem, but how does one
> arrange this with mdev.conf?


That's a fairly good argument for keeping it in the same package, and we
can expect that users of mdev will be providing their own configuration
file anyway.

Ross

[-- Attachment #2: Type: text/html, Size: 706 bytes --]

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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-18 13:30       ` Burton, Ross
@ 2014-12-18 13:54         ` Mike Looijmans
  0 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 13:54 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On 12/18/2014 02:30 PM, Burton, Ross wrote:
>
> On 18 December 2014 at 06:23, Mike Looijmans <mike.looijmans@topic.nl
> <mailto:mike.looijmans@topic.nl>> wrote:
>
>     Putting the script into its own package is no problem, but how does one
>     arrange this with mdev.conf?
>
>
> That's a fairly good argument for keeping it in the same package, and we can
> expect that users of mdev will be providing their own configuration file anyway.

Indeed. I was just implementing the split up, but it looks weird. You end up 
with a package "busybox-mdev" that contains nothing but an initscript and a 
config file (because the actual "mdev" binary is supplied by busybox), which 
refers to scripts that don't exist, and then an extra busybox-mdev-extraconf 
that supplies these scripts, but doesn't actually contain any configuration 
files in spite of its name. And then I had to find a way to get this package 
installed by default, which also isn't trivial.

So can we keep it al in busybox-mdev? It's a tiny config package anyway, and 
when providing private configs (which should rarely be needed now), it's easy 
enough to replace these in a bbappend.

M.


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* [PATCH v2 0/4] Busybox mdev improvements
  2014-12-04 10:27 [PATCH 0/2] Busybox mdev improvements Mike Looijmans
                   ` (3 preceding siblings ...)
  2014-12-05  9:58 ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
@ 2014-12-18 14:17 ` Mike Looijmans
  2014-12-18 14:17   ` [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
                     ` (3 more replies)
  4 siblings, 4 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 14:17 UTC (permalink / raw)
  To: openembedded-core

I've been using busybox mdev instead of udev in many projects, which so
far has worked excellently.

Each of these projects needed similar patches to busybox to make it work,
so I think its time these changes move into the core for everyone to use.

v2: I joined the two patch sets together.
The first two fix the touchscreen support.
The third makes the system automatically load kernel modules when
you plug in a device.
The fourth adds automounter capabilities. In v2 the default location is
/run/media, which can be changed in /etc/default/mdev.



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

* [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh
  2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
@ 2014-12-18 14:17   ` Mike Looijmans
  2014-12-18 14:43     ` Otavio Salvador
  2014-12-18 14:17   ` [PATCH v2 2/4] busybox/find-touchscreen.sh: Simplify script and recognize USB devices Mike Looijmans
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 14:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

mdev.conf references the find-touchscreen.sh script, but this file
was not being installed. Add the script to the busybox-mdev package.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 meta/recipes-core/busybox/busybox.inc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index bd66e4f..deb2ee4 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -23,7 +23,7 @@ PACKAGES =+ "${PN}-httpd ${PN}-udhcpd ${PN}-udhcpc ${PN}-syslog ${PN}-mdev ${PN}
 
 FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
 FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog* ${sysconfdir}/syslog-startup.conf* ${sysconfdir}/syslog.conf* ${systemd_unitdir}/system/syslog.service ${sysconfdir}/default/busybox-syslog"
-FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf"
+FILES_${PN}-mdev = "${sysconfdir}/init.d/mdev ${sysconfdir}/mdev.conf ${sysconfdir}/mdev/*"
 FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
 FILES_${PN}-udhcpc = "${sysconfdir}/udhcpc.d ${datadir}/udhcpc"
 FILES_${PN}-hwclock = "${sysconfdir}/init.d/hwclock.sh"
@@ -268,6 +268,8 @@ do_install () {
                install -m 0755 ${WORKDIR}/mdev ${D}${sysconfdir}/init.d/mdev
                if grep "CONFIG_FEATURE_MDEV_CONF=y" ${B}/.config; then
                        install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
+                       install -d ${D}${sysconfdir}/mdev
+                       install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
                fi
 	fi
 
-- 
1.7.9.5



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

* [PATCH v2 2/4] busybox/find-touchscreen.sh: Simplify script and recognize USB devices
  2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
  2014-12-18 14:17   ` [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
@ 2014-12-18 14:17   ` Mike Looijmans
  2014-12-18 14:17   ` [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
  2014-12-18 14:19   ` [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
  3 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 14:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

Simplify the grep expression, use the more common "grep" command instead
of "egrep", avoid forking extra processes, join multiple invokations into
a single combined expression.

Change the touchscreen regex so that it also recognizes various USB
touchscreen controllers and the ad7879 i2c device.

Based on code used in OpenPLi and meta-topic.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 .../recipes-core/busybox/files/find-touchscreen.sh |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/busybox/files/find-touchscreen.sh b/meta/recipes-core/busybox/files/find-touchscreen.sh
index 1582ea8..52c5e7a 100644
--- a/meta/recipes-core/busybox/files/find-touchscreen.sh
+++ b/meta/recipes-core/busybox/files/find-touchscreen.sh
@@ -1,9 +1,6 @@
 #!/bin/sh
 
-if [ `egrep "input:.*-e0.*,3,.*a0,1,.*18,.*" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
-	ln -sf /dev/input/$MDEV /dev/input/touchscreen0
+if grep -q "input:.*-e0.*,3,.*a0,1,\|ads7846" /sys/class/$MDEV/device/modalias ; then
+	ln -sf /dev/$MDEV /dev/input/touchscreen0
 fi
 
-if [ `egrep "ads7846" /sys/class/input/$MDEV/device/modalias|wc -l` -gt 0 ]; then
-	ln -sf /dev/input/$MDEV /dev/input/touchscreen0
-fi
-- 
1.7.9.5



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

* [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
  2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
  2014-12-18 14:17   ` [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
  2014-12-18 14:17   ` [PATCH v2 2/4] busybox/find-touchscreen.sh: Simplify script and recognize USB devices Mike Looijmans
@ 2014-12-18 14:17   ` Mike Looijmans
  2015-01-01  2:49     ` Khem Raj
  2014-12-18 14:19   ` [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
  3 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 14:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

Upon inserting a USB stick or similar device, mdev will run
an automounter script that mounts valid partitions on
/media/<device>. The script first checks /etc/fstab entries
so that mounting on UUID or LABEL or using custom mount options
is still possible. If /etc/fstab does not contain particular
mount options, the script will create (and remove) the mountpoint
automatically.
The script also supports full disk partitions (devices without
partition table).

The following environments can be set in /etc/default/mdev:
MDEV_AUTOMOUNT=n (Disables automounting completely)
MDEV_AUTOMOUNT_ROOT=/media (Change the mount root location)

Automatic mounting for a particular device can be disabled by
creating a file "/dev/<device>.nomount". This is helpful in
scripts that create partitions for example, and want to perform
specific actions which require the device to remain unmounted.

A more complex variation (using LABEL based mounts) on this script
has been in use in OpenPLi for many years now, and I've used this
one on many projects already, so it's about time to push this to
mainline.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 meta/recipes-core/busybox/busybox.inc         |    1 +
 meta/recipes-core/busybox/busybox_1.22.1.bb   |    1 +
 meta/recipes-core/busybox/busybox_git.bb      |    1 +
 meta/recipes-core/busybox/files/mdev-mount.sh |   63 +++++++++++++++++++++++++
 meta/recipes-core/busybox/files/mdev.conf     |    3 ++
 5 files changed, 69 insertions(+)
 create mode 100644 meta/recipes-core/busybox/files/mdev-mount.sh

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index deb2ee4..0769d92 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -270,6 +270,7 @@ do_install () {
                        install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
                        install -d ${D}${sysconfdir}/mdev
                        install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
+                       install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
                fi
 	fi
 
diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb b/meta/recipes-core/busybox/busybox_1.22.1.bb
index 82f7f68..f379bb6 100644
--- a/meta/recipes-core/busybox/busybox_1.22.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
@@ -20,6 +20,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://busybox-syslog.default \
            file://mdev \
            file://mdev.conf \
+           file://mdev-mount.sh \
            file://umount.busybox \
            file://defconfig \
            file://busybox-syslog.service.in \
diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
index f2cc119..f91b552 100644
--- a/meta/recipes-core/busybox/busybox_git.bb
+++ b/meta/recipes-core/busybox/busybox_git.bb
@@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
            file://busybox-syslog.default \
            file://mdev \
            file://mdev.conf \
+           file://mdev-mount.sh \
            file://umount.busybox \
            file://defconfig \
            file://busybox-syslog.service.in \
diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh b/meta/recipes-core/busybox/files/mdev-mount.sh
new file mode 100644
index 0000000..d5d66d6
--- /dev/null
+++ b/meta/recipes-core/busybox/files/mdev-mount.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+MDEV_AUTOMOUNT=y
+MDEV_AUTOMOUNT_ROOT=/run/media
+[ -f /etc/default/mdev ] && . /etc/default/mdev
+if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
+	exit 0
+fi
+
+case "$ACTION" in
+	add|"")
+		ACTION="add"
+		# check if already mounted
+		if grep -q "^/dev/${MDEV} " /proc/mounts ; then
+			# Already mounted
+			exit 0
+		fi
+		DEVBASE=`expr substr $MDEV 1 3`
+		if [ "${DEVBASE}" == "mmc" ] ; then
+			DEVBASE=`expr substr $MDEV 1 7`
+		fi
+		# check for "please don't mount it" file
+		if [ -f "/dev/nomount.${DEVBASE}" ] ; then
+			# blocked
+			exit 0
+		fi
+		# check for full-disk partition
+		if [ "${DEVBASE}" == "${MDEV}" ] ; then
+			if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
+				# Partition detected, just quit
+				exit 0
+			fi
+			if [ ! -f /sys/block/${DEVBASE}/size ] ; then
+				# No size at all
+				exit 0
+			fi
+			if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
+				# empty device, bail out
+				exit 0
+			fi
+		fi
+		# first allow fstab to determine the mountpoint
+		if ! mount /dev/$MDEV > /dev/null 2>&1
+		then
+			MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
+			mkdir "$MOUNTPOINT"
+			mount -t auto /dev/$MDEV "$MOUNTPOINT"
+		fi
+		;;
+	remove)
+		MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
+		if [ ! -z "$MOUNTPOINT" ]
+		then
+			umount "$MOUNTPOINT"
+			rmdir "$MOUNTPOINT"
+		else
+			umount /dev/$MDEV
+		fi
+		;;
+	*)
+		# Unexpected keyword
+		exit 1
+		;;
+esac
diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
index 6dfd161..17e93da 100644
--- a/meta/recipes-core/busybox/files/mdev.conf
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -37,3 +37,6 @@ input/mice 0:0 0660
 input/mouse.* 0:0 0660
 
 tun[0-9]* 0:0 0660 =net/
+
+[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
+mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
-- 
1.7.9.5



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

* [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf
  2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
                     ` (2 preceding siblings ...)
  2014-12-18 14:17   ` [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
@ 2014-12-18 14:19   ` Mike Looijmans
  2014-12-18 14:44     ` Otavio Salvador
  3 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 14:19 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

Add a line to mdev.conf that tells mdev to load kernel modules when
required.

For example, if you built wifi support as an external module, inserting
a wifi stick into a USB port will now automatically load that module
into the kernel and the wlan device will be ready for configuration.
Without this patch, you have to load required modules manually or force
them to load at system startup.
---
  meta/recipes-core/busybox/files/mdev.conf |    2 ++
  1 file changed, 2 insertions(+)

diff --git a/meta/recipes-core/busybox/files/mdev.conf 
b/meta/recipes-core/busybox/files/mdev.conf
index e688911..6dfd161 100644
--- a/meta/recipes-core/busybox/files/mdev.conf
+++ b/meta/recipes-core/busybox/files/mdev.conf
@@ -1,3 +1,5 @@
+$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
+
  console 0:0 0600  cpu_dma_latency 0:0 0660  fb0:0 44 0660 -- 1.7.9.5



Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
  2014-12-18 12:55         ` Otavio Salvador
@ 2014-12-18 14:38           ` Mike Looijmans
  0 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2014-12-18 14:38 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Patches and discussions about the oe-core layer

On 12/18/2014 01:55 PM, Otavio Salvador wrote:
> Hello Mike,
>
> On Thu, Dec 18, 2014 at 4:31 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>> On 12/17/2014 11:08 PM, Gary Thomas wrote:
>>>
>>> On 2014-12-17 15:03, Burton, Ross wrote:
>>>>
>>>> Hi Mike,
>>>>
>>>> On 5 December 2014 at 09:58, Mike Looijmans <mike.looijmans@topic.nl
>>>> <mailto:mike.looijmans@topic.nl>> wrote:
>>>>
>>>>      Upon inserting a USB stick or similar device, mdev will run
>>>>      an automounter script that mounts valid partitions on
>>>>      /media/<device>. The script first checks /etc/fstab entries
>>>>      so that mounting on UUID or LABEL or using custom mount options
>>>>      is still possible. If /etc/fstab does not contain particular
>>>>      mount options, the script will create (and remove) the mountpoint
>>>>      automatically.
>>>>      The script also supports full disk partitions (devices without
>>>>      partition table).
>>>>
>>>>
>>>> Thanks for this, but can this script be put into a separate recipe to
>>>> make
>>>> it even easier for people who don't want it, or want their own version?
>>>> The
>>>> prior art here is the udev
>>>> automounting script which is in udev-extraconf.
> ...
>
> I didn't try but what happens in mdev if the script does not exists? I
> mean keep mdev.conf as is (ready for use) and move the script to
> another package which can be installed or not.

I just tried, removed the script and inserted a stick. It still created 
/dev/sda and /dev/sda1 so it seems nothing really bad will happen then.

>> On the satellite settop boxes, /media is a 64k tmpfs mount. This is because
>> when a mount fails, the box may end up writing a TV recording to wherever
>> /media happens to be. It that's flash or a big tmpfs, the box will commit
>> suicide in mere seconds by either filling the flash or eating up the
>> precious RAM. And for some things, the box really needs a big tmpfs, so just
>> reducing the volatiles' sizes wasn't an option.
>
> Nice 'solution' to avoid a more serious problem :-D

Well, it got rid of tons of "check if this and that" code in the recorder code 
which occasionally would still be fooled into recording onto flash or RAM.

>> Having said that, if this is blocking, I'll do a s./media./run/media.g on
>> the file, getting this mainlined has higher priority.
>
> I prefer to have it behaving as udev as much as possible, by default.
> However, the script could source a defaults file (if it exists) to
> change the mounting point for example and allow for those special
> systems to be handle without forking.

Yeah, something like "MDEV_AUTOMOUNT_ROOT=/media" in /etc/default/mdev should 
do the trick.



Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/



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

* Re: [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh
  2014-12-18 14:17   ` [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
@ 2014-12-18 14:43     ` Otavio Salvador
  0 siblings, 0 replies; 32+ messages in thread
From: Otavio Salvador @ 2014-12-18 14:43 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: Patches and discussions about the oe-core layer

On Thu, Dec 18, 2014 at 12:17 PM, Mike Looijmans
<mike.looijmans@topic.nl> wrote:
> mdev.conf references the find-touchscreen.sh script, but this file
> was not being installed. Add the script to the busybox-mdev package.
>
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf
  2014-12-18 14:19   ` [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
@ 2014-12-18 14:44     ` Otavio Salvador
  0 siblings, 0 replies; 32+ messages in thread
From: Otavio Salvador @ 2014-12-18 14:44 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: Patches and discussions about the oe-core layer

On Thu, Dec 18, 2014 at 12:19 PM, Mike Looijmans
<mike.looijmans@topic.nl> wrote:
> Add a line to mdev.conf that tells mdev to load kernel modules when
> required.
>
> For example, if you built wifi support as an external module, inserting
> a wifi stick into a USB port will now automatically load that module
> into the kernel and the wlan device will be ready for configuration.
> Without this patch, you have to load required modules manually or force
> them to load at system startup.

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


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

* Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
  2014-12-18 14:17   ` [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
@ 2015-01-01  2:49     ` Khem Raj
  2015-01-01  9:07       ` Mike Looijmans
  0 siblings, 1 reply; 32+ messages in thread
From: Khem Raj @ 2015-01-01  2:49 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: openembedded-core


> On Dec 18, 2014, at 6:17 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
> 
> Upon inserting a USB stick or similar device, mdev will run
> an automounter script that mounts valid partitions on
> /media/<device>. The script first checks /etc/fstab entries
> so that mounting on UUID or LABEL or using custom mount options
> is still possible. If /etc/fstab does not contain particular
> mount options, the script will create (and remove) the mountpoint
> automatically.
> The script also supports full disk partitions (devices without
> partition table).
> 
> The following environments can be set in /etc/default/mdev:
> MDEV_AUTOMOUNT=n (Disables automounting completely)
> MDEV_AUTOMOUNT_ROOT=/media (Change the mount root location)
> 
> Automatic mounting for a particular device can be disabled by
> creating a file "/dev/<device>.nomount". This is helpful in
> scripts that create partitions for example, and want to perform
> specific actions which require the device to remain unmounted.
> 
> A more complex variation (using LABEL based mounts) on this script
> has been in use in OpenPLi for many years now, and I've used this
> one on many projects already, so it's about time to push this to
> mainline.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---
> meta/recipes-core/busybox/busybox.inc         |    1 +
> meta/recipes-core/busybox/busybox_1.22.1.bb   |    1 +
> meta/recipes-core/busybox/busybox_git.bb      |    1 +
> meta/recipes-core/busybox/files/mdev-mount.sh |   63 +++++++++++++++++++++++++
> meta/recipes-core/busybox/files/mdev.conf     |    3 ++
> 5 files changed, 69 insertions(+)
> create mode 100644 meta/recipes-core/busybox/files/mdev-mount.sh
> 
> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
> index deb2ee4..0769d92 100644
> --- a/meta/recipes-core/busybox/busybox.inc
> +++ b/meta/recipes-core/busybox/busybox.inc
> @@ -270,6 +270,7 @@ do_install () {
>                        install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
>                        install -d ${D}${sysconfdir}/mdev
>                        install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
> +                       install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
>                fi
> 	fi
> 
> diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb b/meta/recipes-core/busybox/busybox_1.22.1.bb
> index 82f7f68..f379bb6 100644
> --- a/meta/recipes-core/busybox/busybox_1.22.1.bb
> +++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
> @@ -20,6 +20,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>            file://busybox-syslog.default \
>            file://mdev \
>            file://mdev.conf \
> +           file://mdev-mount.sh \
>            file://umount.busybox \
>            file://defconfig \
>            file://busybox-syslog.service.in \
> diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
> index f2cc119..f91b552 100644
> --- a/meta/recipes-core/busybox/busybox_git.bb
> +++ b/meta/recipes-core/busybox/busybox_git.bb
> @@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
>            file://busybox-syslog.default \
>            file://mdev \
>            file://mdev.conf \
> +           file://mdev-mount.sh \
>            file://umount.busybox \
>            file://defconfig \
>            file://busybox-syslog.service.in \
> diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh b/meta/recipes-core/busybox/files/mdev-mount.sh
> new file mode 100644
> index 0000000..d5d66d6
> --- /dev/null
> +++ b/meta/recipes-core/busybox/files/mdev-mount.sh
> @@ -0,0 +1,63 @@
> +#!/bin/sh
> +MDEV_AUTOMOUNT=y
> +MDEV_AUTOMOUNT_ROOT=/run/media
> +[ -f /etc/default/mdev ] && . /etc/default/mdev
> +if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
> +	exit 0
> +fi
> +
> +case "$ACTION" in
> +	add|"")
> +		ACTION="add"
> +		# check if already mounted
> +		if grep -q "^/dev/${MDEV} " /proc/mounts ; then
> +			# Already mounted
> +			exit 0
> +		fi
> +		DEVBASE=`expr substr $MDEV 1 3`
> +		if [ "${DEVBASE}" == "mmc" ] ; then
> +			DEVBASE=`expr substr $MDEV 1 7`
> +		fi
> +		# check for "please don't mount it" file
> +		if [ -f "/dev/nomount.${DEVBASE}" ] ; then
> +			# blocked
> +			exit 0
> +		fi
> +		# check for full-disk partition
> +		if [ "${DEVBASE}" == "${MDEV}" ] ; then

bashism, get rid of it.

> +			if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
> +				# Partition detected, just quit
> +				exit 0
> +			fi
> +			if [ ! -f /sys/block/${DEVBASE}/size ] ; then
> +				# No size at all
> +				exit 0
> +			fi
> +			if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
> +				# empty device, bail out
> +				exit 0
> +			fi
> +		fi
> +		# first allow fstab to determine the mountpoint
> +		if ! mount /dev/$MDEV > /dev/null 2>&1
> +		then
> +			MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
> +			mkdir "$MOUNTPOINT"
> +			mount -t auto /dev/$MDEV "$MOUNTPOINT"
> +		fi
> +		;;
> +	remove)
> +		MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
> +		if [ ! -z "$MOUNTPOINT" ]
> +		then
> +			umount "$MOUNTPOINT"
> +			rmdir "$MOUNTPOINT"
> +		else
> +			umount /dev/$MDEV
> +		fi
> +		;;
> +	*)
> +		# Unexpected keyword
> +		exit 1
> +		;;
> +esac
> diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
> index 6dfd161..17e93da 100644
> --- a/meta/recipes-core/busybox/files/mdev.conf
> +++ b/meta/recipes-core/busybox/files/mdev.conf
> @@ -37,3 +37,6 @@ input/mice 0:0 0660
> input/mouse.* 0:0 0660
> 
> tun[0-9]* 0:0 0660 =net/
> +
> +[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
> +mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
> -- 
> 1.7.9.5
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



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

* Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
  2015-01-01  2:49     ` Khem Raj
@ 2015-01-01  9:07       ` Mike Looijmans
  2015-01-01 13:08         ` Peter A. Bigot
  0 siblings, 1 reply; 32+ messages in thread
From: Mike Looijmans @ 2015-01-01  9:07 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On 01/01/2015 03:49 AM, Khem Raj wrote:
>
>> On Dec 18, 2014, at 6:17 AM, Mike Looijmans <mike.looijmans@topic.nl> wrote:
>>
>> Upon inserting a USB stick or similar device, mdev will run
>> an automounter script that mounts valid partitions on
>> /media/<device>. The script first checks /etc/fstab entries
>> so that mounting on UUID or LABEL or using custom mount options
>> is still possible. If /etc/fstab does not contain particular
>> mount options, the script will create (and remove) the mountpoint
>> automatically.
>> The script also supports full disk partitions (devices without
>> partition table).
>>
>> The following environments can be set in /etc/default/mdev:
>> MDEV_AUTOMOUNT=n (Disables automounting completely)
>> MDEV_AUTOMOUNT_ROOT=/media (Change the mount root location)
>>
>> Automatic mounting for a particular device can be disabled by
>> creating a file "/dev/<device>.nomount". This is helpful in
>> scripts that create partitions for example, and want to perform
>> specific actions which require the device to remain unmounted.
>>
>> A more complex variation (using LABEL based mounts) on this script
>> has been in use in OpenPLi for many years now, and I've used this
>> one on many projects already, so it's about time to push this to
>> mainline.
>>
>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>> ---
>> meta/recipes-core/busybox/busybox.inc         |    1 +
>> meta/recipes-core/busybox/busybox_1.22.1.bb   |    1 +
>> meta/recipes-core/busybox/busybox_git.bb      |    1 +
>> meta/recipes-core/busybox/files/mdev-mount.sh |   63 +++++++++++++++++++++++++
>> meta/recipes-core/busybox/files/mdev.conf     |    3 ++
>> 5 files changed, 69 insertions(+)
>> create mode 100644 meta/recipes-core/busybox/files/mdev-mount.sh
>>
>> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
>> index deb2ee4..0769d92 100644
>> --- a/meta/recipes-core/busybox/busybox.inc
>> +++ b/meta/recipes-core/busybox/busybox.inc
>> @@ -270,6 +270,7 @@ do_install () {
>>                         install -m 644 ${WORKDIR}/mdev.conf ${D}${sysconfdir}/mdev.conf
>>                         install -d ${D}${sysconfdir}/mdev
>>                         install -m 0755 ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
>> +                       install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
>>                 fi
>> 	fi
>>
>> diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb b/meta/recipes-core/busybox/busybox_1.22.1.bb
>> index 82f7f68..f379bb6 100644
>> --- a/meta/recipes-core/busybox/busybox_1.22.1.bb
>> +++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
>> @@ -20,6 +20,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>>             file://busybox-syslog.default \
>>             file://mdev \
>>             file://mdev.conf \
>> +           file://mdev-mount.sh \
>>             file://umount.busybox \
>>             file://defconfig \
>>             file://busybox-syslog.service.in \
>> diff --git a/meta/recipes-core/busybox/busybox_git.bb b/meta/recipes-core/busybox/busybox_git.bb
>> index f2cc119..f91b552 100644
>> --- a/meta/recipes-core/busybox/busybox_git.bb
>> +++ b/meta/recipes-core/busybox/busybox_git.bb
>> @@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
>>             file://busybox-syslog.default \
>>             file://mdev \
>>             file://mdev.conf \
>> +           file://mdev-mount.sh \
>>             file://umount.busybox \
>>             file://defconfig \
>>             file://busybox-syslog.service.in \
>> diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh b/meta/recipes-core/busybox/files/mdev-mount.sh
>> new file mode 100644
>> index 0000000..d5d66d6
>> --- /dev/null
>> +++ b/meta/recipes-core/busybox/files/mdev-mount.sh
>> @@ -0,0 +1,63 @@
>> +#!/bin/sh
>> +MDEV_AUTOMOUNT=y
>> +MDEV_AUTOMOUNT_ROOT=/run/media
>> +[ -f /etc/default/mdev ] && . /etc/default/mdev
>> +if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
>> +	exit 0
>> +fi
>> +
>> +case "$ACTION" in
>> +	add|"")
>> +		ACTION="add"
>> +		# check if already mounted
>> +		if grep -q "^/dev/${MDEV} " /proc/mounts ; then
>> +			# Already mounted
>> +			exit 0
>> +		fi
>> +		DEVBASE=`expr substr $MDEV 1 3`
>> +		if [ "${DEVBASE}" == "mmc" ] ; then
>> +			DEVBASE=`expr substr $MDEV 1 7`
>> +		fi
>> +		# check for "please don't mount it" file
>> +		if [ -f "/dev/nomount.${DEVBASE}" ] ; then
>> +			# blocked
>> +			exit 0
>> +		fi
>> +		# check for full-disk partition
>> +		if [ "${DEVBASE}" == "${MDEV}" ] ; then
>
> bashism, get rid of it.

please explain?

>
>> +			if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
>> +				# Partition detected, just quit
>> +				exit 0
>> +			fi
>> +			if [ ! -f /sys/block/${DEVBASE}/size ] ; then
>> +				# No size at all
>> +				exit 0
>> +			fi
>> +			if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
>> +				# empty device, bail out
>> +				exit 0
>> +			fi
>> +		fi
>> +		# first allow fstab to determine the mountpoint
>> +		if ! mount /dev/$MDEV > /dev/null 2>&1
>> +		then
>> +			MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
>> +			mkdir "$MOUNTPOINT"
>> +			mount -t auto /dev/$MDEV "$MOUNTPOINT"
>> +		fi
>> +		;;
>> +	remove)
>> +		MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
>> +		if [ ! -z "$MOUNTPOINT" ]
>> +		then
>> +			umount "$MOUNTPOINT"
>> +			rmdir "$MOUNTPOINT"
>> +		else
>> +			umount /dev/$MDEV
>> +		fi
>> +		;;
>> +	*)
>> +		# Unexpected keyword
>> +		exit 1
>> +		;;
>> +esac
>> diff --git a/meta/recipes-core/busybox/files/mdev.conf b/meta/recipes-core/busybox/files/mdev.conf
>> index 6dfd161..17e93da 100644
>> --- a/meta/recipes-core/busybox/files/mdev.conf
>> +++ b/meta/recipes-core/busybox/files/mdev.conf
>> @@ -37,3 +37,6 @@ input/mice 0:0 0660
>> input/mouse.* 0:0 0660
>>
>> tun[0-9]* 0:0 0660 =net/
>> +
>> +[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
>> +mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
>> --
>> 1.7.9.5
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>


-- 
Mike Looijmans


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

* Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
  2015-01-01  9:07       ` Mike Looijmans
@ 2015-01-01 13:08         ` Peter A. Bigot
  2015-01-01 19:21           ` Mike Looijmans
  0 siblings, 1 reply; 32+ messages in thread
From: Peter A. Bigot @ 2015-01-01 13:08 UTC (permalink / raw)
  To: openembedded-core

On 01/01/2015 03:07 AM, Mike Looijmans wrote:
> On 01/01/2015 03:49 AM, Khem Raj wrote:
>>
>>> On Dec 18, 2014, at 6:17 AM, Mike Looijmans 
>>> <mike.looijmans@topic.nl> wrote:
>>>
>>> Upon inserting a USB stick or similar device, mdev will run
>>> an automounter script that mounts valid partitions on
>>> /media/<device>. The script first checks /etc/fstab entries
>>> so that mounting on UUID or LABEL or using custom mount options
>>> is still possible. If /etc/fstab does not contain particular
>>> mount options, the script will create (and remove) the mountpoint
>>> automatically.
>>> The script also supports full disk partitions (devices without
>>> partition table).
>>>
>>> The following environments can be set in /etc/default/mdev:
>>> MDEV_AUTOMOUNT=n (Disables automounting completely)
>>> MDEV_AUTOMOUNT_ROOT=/media (Change the mount root location)
>>>
>>> Automatic mounting for a particular device can be disabled by
>>> creating a file "/dev/<device>.nomount". This is helpful in
>>> scripts that create partitions for example, and want to perform
>>> specific actions which require the device to remain unmounted.
>>>
>>> A more complex variation (using LABEL based mounts) on this script
>>> has been in use in OpenPLi for many years now, and I've used this
>>> one on many projects already, so it's about time to push this to
>>> mainline.
>>>
>>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>>> ---
>>> meta/recipes-core/busybox/busybox.inc         |    1 +
>>> meta/recipes-core/busybox/busybox_1.22.1.bb   |    1 +
>>> meta/recipes-core/busybox/busybox_git.bb      |    1 +
>>> meta/recipes-core/busybox/files/mdev-mount.sh |   63 
>>> +++++++++++++++++++++++++
>>> meta/recipes-core/busybox/files/mdev.conf     |    3 ++
>>> 5 files changed, 69 insertions(+)
>>> create mode 100644 meta/recipes-core/busybox/files/mdev-mount.sh
>>>
>>> diff --git a/meta/recipes-core/busybox/busybox.inc 
>>> b/meta/recipes-core/busybox/busybox.inc
>>> index deb2ee4..0769d92 100644
>>> --- a/meta/recipes-core/busybox/busybox.inc
>>> +++ b/meta/recipes-core/busybox/busybox.inc
>>> @@ -270,6 +270,7 @@ do_install () {
>>>                         install -m 644 ${WORKDIR}/mdev.conf 
>>> ${D}${sysconfdir}/mdev.conf
>>>                         install -d ${D}${sysconfdir}/mdev
>>>                         install -m 0755 
>>> ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
>>> +                       install -m 0755 ${WORKDIR}/mdev-mount.sh 
>>> ${D}${sysconfdir}/mdev
>>>                 fi
>>>     fi
>>>
>>> diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb 
>>> b/meta/recipes-core/busybox/busybox_1.22.1.bb
>>> index 82f7f68..f379bb6 100644
>>> --- a/meta/recipes-core/busybox/busybox_1.22.1.bb
>>> +++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
>>> @@ -20,6 +20,7 @@ SRC_URI = 
>>> "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>>>             file://busybox-syslog.default \
>>>             file://mdev \
>>>             file://mdev.conf \
>>> +           file://mdev-mount.sh \
>>>             file://umount.busybox \
>>>             file://defconfig \
>>>             file://busybox-syslog.service.in \
>>> diff --git a/meta/recipes-core/busybox/busybox_git.bb 
>>> b/meta/recipes-core/busybox/busybox_git.bb
>>> index f2cc119..f91b552 100644
>>> --- a/meta/recipes-core/busybox/busybox_git.bb
>>> +++ b/meta/recipes-core/busybox/busybox_git.bb
>>> @@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
>>>             file://busybox-syslog.default \
>>>             file://mdev \
>>>             file://mdev.conf \
>>> +           file://mdev-mount.sh \
>>>             file://umount.busybox \
>>>             file://defconfig \
>>>             file://busybox-syslog.service.in \
>>> diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh 
>>> b/meta/recipes-core/busybox/files/mdev-mount.sh
>>> new file mode 100644
>>> index 0000000..d5d66d6
>>> --- /dev/null
>>> +++ b/meta/recipes-core/busybox/files/mdev-mount.sh
>>> @@ -0,0 +1,63 @@
>>> +#!/bin/sh
>>> +MDEV_AUTOMOUNT=y
>>> +MDEV_AUTOMOUNT_ROOT=/run/media
>>> +[ -f /etc/default/mdev ] && . /etc/default/mdev
>>> +if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
>>> +    exit 0
>>> +fi
>>> +
>>> +case "$ACTION" in
>>> +    add|"")
>>> +        ACTION="add"
>>> +        # check if already mounted
>>> +        if grep -q "^/dev/${MDEV} " /proc/mounts ; then
>>> +            # Already mounted
>>> +            exit 0
>>> +        fi
>>> +        DEVBASE=`expr substr $MDEV 1 3`
>>> +        if [ "${DEVBASE}" == "mmc" ] ; then
>>> +            DEVBASE=`expr substr $MDEV 1 7`
>>> +        fi
>>> +        # check for "please don't mount it" file
>>> +        if [ -f "/dev/nomount.${DEVBASE}" ] ; then
>>> +            # blocked
>>> +            exit 0
>>> +        fi
>>> +        # check for full-disk partition
>>> +        if [ "${DEVBASE}" == "${MDEV}" ] ; then
>>
>> bashism, get rid of it.
>
> please explain?

From 
http://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html:


string1 == string2
string1 = string2

     True if the strings are equal. ‘=’ should be used with the test 
command for POSIX conformance.


>
>>
>>> +            if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
>>> +                # Partition detected, just quit
>>> +                exit 0
>>> +            fi
>>> +            if [ ! -f /sys/block/${DEVBASE}/size ] ; then
>>> +                # No size at all
>>> +                exit 0
>>> +            fi
>>> +            if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
>>> +                # empty device, bail out
>>> +                exit 0
>>> +            fi
>>> +        fi
>>> +        # first allow fstab to determine the mountpoint
>>> +        if ! mount /dev/$MDEV > /dev/null 2>&1
>>> +        then
>>> +            MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
>>> +            mkdir "$MOUNTPOINT"
>>> +            mount -t auto /dev/$MDEV "$MOUNTPOINT"
>>> +        fi
>>> +        ;;
>>> +    remove)
>>> +        MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' 
>>> -f 2`
>>> +        if [ ! -z "$MOUNTPOINT" ]
>>> +        then
>>> +            umount "$MOUNTPOINT"
>>> +            rmdir "$MOUNTPOINT"
>>> +        else
>>> +            umount /dev/$MDEV
>>> +        fi
>>> +        ;;
>>> +    *)
>>> +        # Unexpected keyword
>>> +        exit 1
>>> +        ;;
>>> +esac
>>> diff --git a/meta/recipes-core/busybox/files/mdev.conf 
>>> b/meta/recipes-core/busybox/files/mdev.conf
>>> index 6dfd161..17e93da 100644
>>> --- a/meta/recipes-core/busybox/files/mdev.conf
>>> +++ b/meta/recipes-core/busybox/files/mdev.conf
>>> @@ -37,3 +37,6 @@ input/mice 0:0 0660
>>> input/mouse.* 0:0 0660
>>>
>>> tun[0-9]* 0:0 0660 =net/
>>> +
>>> +[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
>>> +mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
>>> -- 
>>> 1.7.9.5
>>>
>>> -- 
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>
>
>



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

* Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
  2015-01-01 13:08         ` Peter A. Bigot
@ 2015-01-01 19:21           ` Mike Looijmans
  0 siblings, 0 replies; 32+ messages in thread
From: Mike Looijmans @ 2015-01-01 19:21 UTC (permalink / raw)
  To: openembedded-core

On 1-1-2015 14:08, Peter A. Bigot wrote:
> On 01/01/2015 03:07 AM, Mike Looijmans wrote:
>> On 01/01/2015 03:49 AM, Khem Raj wrote:
>>>
>>>> On Dec 18, 2014, at 6:17 AM, Mike Looijmans
>>>> <mike.looijmans@topic.nl> wrote:
>>>>
>>>> Upon inserting a USB stick or similar device, mdev will run
>>>> an automounter script that mounts valid partitions on
>>>> /media/<device>. The script first checks /etc/fstab entries
>>>> so that mounting on UUID or LABEL or using custom mount options
>>>> is still possible. If /etc/fstab does not contain particular
>>>> mount options, the script will create (and remove) the mountpoint
>>>> automatically.
>>>> The script also supports full disk partitions (devices without
>>>> partition table).
>>>>
>>>> The following environments can be set in /etc/default/mdev:
>>>> MDEV_AUTOMOUNT=n (Disables automounting completely)
>>>> MDEV_AUTOMOUNT_ROOT=/media (Change the mount root location)
>>>>
>>>> Automatic mounting for a particular device can be disabled by
>>>> creating a file "/dev/<device>.nomount". This is helpful in
>>>> scripts that create partitions for example, and want to perform
>>>> specific actions which require the device to remain unmounted.
>>>>
>>>> A more complex variation (using LABEL based mounts) on this script
>>>> has been in use in OpenPLi for many years now, and I've used this
>>>> one on many projects already, so it's about time to push this to
>>>> mainline.
>>>>
>>>> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
>>>> ---
>>>> meta/recipes-core/busybox/busybox.inc         |    1 +
>>>> meta/recipes-core/busybox/busybox_1.22.1.bb   |    1 +
>>>> meta/recipes-core/busybox/busybox_git.bb      |    1 +
>>>> meta/recipes-core/busybox/files/mdev-mount.sh |   63
>>>> +++++++++++++++++++++++++
>>>> meta/recipes-core/busybox/files/mdev.conf     |    3 ++
>>>> 5 files changed, 69 insertions(+)
>>>> create mode 100644 meta/recipes-core/busybox/files/mdev-mount.sh
>>>>
>>>> diff --git a/meta/recipes-core/busybox/busybox.inc
>>>> b/meta/recipes-core/busybox/busybox.inc
>>>> index deb2ee4..0769d92 100644
>>>> --- a/meta/recipes-core/busybox/busybox.inc
>>>> +++ b/meta/recipes-core/busybox/busybox.inc
>>>> @@ -270,6 +270,7 @@ do_install () {
>>>>                         install -m 644 ${WORKDIR}/mdev.conf
>>>> ${D}${sysconfdir}/mdev.conf
>>>>                         install -d ${D}${sysconfdir}/mdev
>>>>                         install -m 0755
>>>> ${WORKDIR}/find-touchscreen.sh ${D}${sysconfdir}/mdev
>>>> +                       install -m 0755 ${WORKDIR}/mdev-mount.sh
>>>> ${D}${sysconfdir}/mdev
>>>>                 fi
>>>>     fi
>>>>
>>>> diff --git a/meta/recipes-core/busybox/busybox_1.22.1.bb
>>>> b/meta/recipes-core/busybox/busybox_1.22.1.bb
>>>> index 82f7f68..f379bb6 100644
>>>> --- a/meta/recipes-core/busybox/busybox_1.22.1.bb
>>>> +++ b/meta/recipes-core/busybox/busybox_1.22.1.bb
>>>> @@ -20,6 +20,7 @@ SRC_URI =
>>>> "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>>>>             file://busybox-syslog.default \
>>>>             file://mdev \
>>>>             file://mdev.conf \
>>>> +           file://mdev-mount.sh \
>>>>             file://umount.busybox \
>>>>             file://defconfig \
>>>>             file://busybox-syslog.service.in \
>>>> diff --git a/meta/recipes-core/busybox/busybox_git.bb
>>>> b/meta/recipes-core/busybox/busybox_git.bb
>>>> index f2cc119..f91b552 100644
>>>> --- a/meta/recipes-core/busybox/busybox_git.bb
>>>> +++ b/meta/recipes-core/busybox/busybox_git.bb
>>>> @@ -24,6 +24,7 @@ SRC_URI = "git://busybox.net/busybox.git \
>>>>             file://busybox-syslog.default \
>>>>             file://mdev \
>>>>             file://mdev.conf \
>>>> +           file://mdev-mount.sh \
>>>>             file://umount.busybox \
>>>>             file://defconfig \
>>>>             file://busybox-syslog.service.in \
>>>> diff --git a/meta/recipes-core/busybox/files/mdev-mount.sh
>>>> b/meta/recipes-core/busybox/files/mdev-mount.sh
>>>> new file mode 100644
>>>> index 0000000..d5d66d6
>>>> --- /dev/null
>>>> +++ b/meta/recipes-core/busybox/files/mdev-mount.sh
>>>> @@ -0,0 +1,63 @@
>>>> +#!/bin/sh
>>>> +MDEV_AUTOMOUNT=y
>>>> +MDEV_AUTOMOUNT_ROOT=/run/media
>>>> +[ -f /etc/default/mdev ] && . /etc/default/mdev
>>>> +if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
>>>> +    exit 0
>>>> +fi
>>>> +
>>>> +case "$ACTION" in
>>>> +    add|"")
>>>> +        ACTION="add"
>>>> +        # check if already mounted
>>>> +        if grep -q "^/dev/${MDEV} " /proc/mounts ; then
>>>> +            # Already mounted
>>>> +            exit 0
>>>> +        fi
>>>> +        DEVBASE=`expr substr $MDEV 1 3`
>>>> +        if [ "${DEVBASE}" == "mmc" ] ; then
>>>> +            DEVBASE=`expr substr $MDEV 1 7`
>>>> +        fi
>>>> +        # check for "please don't mount it" file
>>>> +        if [ -f "/dev/nomount.${DEVBASE}" ] ; then
>>>> +            # blocked
>>>> +            exit 0
>>>> +        fi
>>>> +        # check for full-disk partition
>>>> +        if [ "${DEVBASE}" == "${MDEV}" ] ; then
>>>
>>> bashism, get rid of it.
>>
>> please explain?
>
>  From
> http://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html:
>
>
>
> string1 == string2
> string1 = string2
>
>      True if the strings are equal. ‘=’ should be used with the test
> command for POSIX conformance.

Ah, okay. I'll change s/==/=/g in the script, and submit a new version.


>
>>
>>>
>>>> +            if [ -d /sys/block/${DEVBASE}/${DEVBASE}*1 ] ; then
>>>> +                # Partition detected, just quit
>>>> +                exit 0
>>>> +            fi
>>>> +            if [ ! -f /sys/block/${DEVBASE}/size ] ; then
>>>> +                # No size at all
>>>> +                exit 0
>>>> +            fi
>>>> +            if [ `cat /sys/block/${DEVBASE}/size` == 0 ] ; then
>>>> +                # empty device, bail out
>>>> +                exit 0
>>>> +            fi
>>>> +        fi
>>>> +        # first allow fstab to determine the mountpoint
>>>> +        if ! mount /dev/$MDEV > /dev/null 2>&1
>>>> +        then
>>>> +            MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
>>>> +            mkdir "$MOUNTPOINT"
>>>> +            mount -t auto /dev/$MDEV "$MOUNTPOINT"
>>>> +        fi
>>>> +        ;;
>>>> +    remove)
>>>> +        MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' '
>>>> -f 2`
>>>> +        if [ ! -z "$MOUNTPOINT" ]
>>>> +        then
>>>> +            umount "$MOUNTPOINT"
>>>> +            rmdir "$MOUNTPOINT"
>>>> +        else
>>>> +            umount /dev/$MDEV
>>>> +        fi
>>>> +        ;;
>>>> +    *)
>>>> +        # Unexpected keyword
>>>> +        exit 1
>>>> +        ;;
>>>> +esac
>>>> diff --git a/meta/recipes-core/busybox/files/mdev.conf
>>>> b/meta/recipes-core/busybox/files/mdev.conf
>>>> index 6dfd161..17e93da 100644
>>>> --- a/meta/recipes-core/busybox/files/mdev.conf
>>>> +++ b/meta/recipes-core/busybox/files/mdev.conf
>>>> @@ -37,3 +37,6 @@ input/mice 0:0 0660
>>>> input/mouse.* 0:0 0660
>>>>
>>>> tun[0-9]* 0:0 0660 =net/
>>>> +
>>>> +[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
>>>> +mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
>>>> --
>>>> 1.7.9.5
>>>>
>>>> --
>>>> _______________________________________________
>>>> Openembedded-core mailing list
>>>> Openembedded-core@lists.openembedded.org
>>>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>>>
>>
>>
>


-- 
Mike Looijmans


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

end of thread, other threads:[~2015-01-01 19:21 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-04 10:27 [PATCH 0/2] Busybox mdev improvements Mike Looijmans
2014-12-04 10:27 ` [PATCH 1/2] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
2014-12-04 10:27 ` [PATCH 2/2] busybox/find-touchscreen.sh: Simplify script and recognize USB devices Mike Looijmans
2014-12-04 20:47 ` [PATCH 0/2] Busybox mdev improvements Otavio Salvador
2014-12-05  6:18   ` Mike Looijmans
2014-12-05 11:27     ` Otavio Salvador
2014-12-05 12:57       ` Mike Looijmans
2014-12-05 14:13         ` Otavio Salvador
2014-12-05  9:58 ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
2014-12-05  9:58   ` [PATCH 2/2] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
2014-12-17 22:01   ` [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices Burton, Ross
2014-12-18 13:14     ` Mike Looijmans
2014-12-17 22:03   ` Burton, Ross
2014-12-17 22:05     ` Burton, Ross
2014-12-17 22:08     ` Gary Thomas
2014-12-18  6:31       ` Mike Looijmans
2014-12-18 12:55         ` Otavio Salvador
2014-12-18 14:38           ` Mike Looijmans
2014-12-18  6:23     ` Mike Looijmans
2014-12-18 13:30       ` Burton, Ross
2014-12-18 13:54         ` Mike Looijmans
2014-12-18 14:17 ` [PATCH v2 0/4] Busybox mdev improvements Mike Looijmans
2014-12-18 14:17   ` [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh Mike Looijmans
2014-12-18 14:43     ` Otavio Salvador
2014-12-18 14:17   ` [PATCH v2 2/4] busybox/find-touchscreen.sh: Simplify script and recognize USB devices Mike Looijmans
2014-12-18 14:17   ` [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices Mike Looijmans
2015-01-01  2:49     ` Khem Raj
2015-01-01  9:07       ` Mike Looijmans
2015-01-01 13:08         ` Peter A. Bigot
2015-01-01 19:21           ` Mike Looijmans
2014-12-18 14:19   ` [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf Mike Looijmans
2014-12-18 14:44     ` Otavio Salvador

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.