Busybox mdev improvements
PATCH 2/2 busybox/find-touchscreen.sh: Simplify script and recognize USB devices
In reply to Mike LooijmansSimplify 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.
--- .../recipes-core/busybox/files/find-touchscreen.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
meta/recipes-core/busybox/files/find-touchscreen.sh +2 -5
@@ -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
Signature · 1 line
1.7.9.5
cover Busybox mdev improvements
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.
PATCH 1/2 busybox-mdev: Install missing find-touchscreen.sh
mdev.conf references the find-touchscreen.sh script, but this file was not being installed. Add the script to the busybox-mdev package.
--- meta/recipes-core/busybox/busybox.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/busybox/busybox.inc +3 -1
@@ -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
Signature · 1 line
1.7.9.5
Quoted 2 lines · Mike Looijmans
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.
Signature · 3 lines
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
Quoted 6 lines · Otavio Salvador
Quoted 2 lines · Mike Looijmans
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/mdevto 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: [email protected]
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/
PATCH 1/2 busybox-mdev: Support automatic mounting of block devices
In reply to Mike LooijmansUpon 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.
--- 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
meta/recipes-core/busybox/busybox.inc +1 -0
@@ -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
meta/recipes-core/busybox/busybox_1.22.1.bb +1 -0
@@ -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 \
meta/recipes-core/busybox/busybox_git.bb +1 -0
@@ -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 \
meta/recipes-core/busybox/files/mdev-mount.sh new file +62 -0
62 lines not on this page · raw message
meta/recipes-core/busybox/files/mdev.conf +3 -0
@@ -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
Signature · 1 line
1.7.9.5
PATCH 2/2 busybox-mdev: Add hotplug kernel module support to mdev.conf
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(+)
meta/recipes-core/busybox/files/mdev.conf +2 -0
@@ -1,3 +1,5 @@ +$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS" + console 0:0 0600 cpu_dma_latency 0:0 0660 fb0:0 44 0660
Signature · 1 line
1.7.9.5
Quoted 9 lines · Mike Looijmans
Quoted 8 lines · Otavio Salvador
Quoted 3 lines · Mike Looijmans
This first series fixes the touchscreen support. A patch to automatically have mdev mount storage devices will follow soon, I'm still testing it.
Quoted 6 lines
Quoted 2 lines
I enjoy this idea but please put this one in a specific sub-package or with a setting in
/etc/default/mdevto enable/disable it.By "this" you refer to the automatic mounting? No problem, and a good suggestion too.
Yes.
Quoted 5 lines
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.
Signature · 3 lines
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
Quoted 19 lines · Otavio Salvador
Quoted 9 lines · Mike Looijmans
Quoted 8 lines · Otavio Salvador
Quoted 3 lines · Mike Looijmans
This first series fixes the touchscreen support. A patch to automatically have mdev mount storage devices will follow soon, I'm still testing it.
Quoted 6 lines
Quoted 2 lines
I enjoy this idea but please put this one in a specific sub-package or with a setting in
/etc/default/mdevto enable/disable it.By "this" you refer to the automatic mounting? No problem, and a good suggestion too.
Yes.
Quoted 8 lines
Quoted 5 lines
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: [email protected]
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/
Quoted 8 lines · Mike Looijmans
Quoted 3 lines · Otavio Salvador
On Fri, Dec 5, 2014 at 4:18 AM, Mike Looijmans <[email protected]> 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 :)
Signature · 3 lines
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
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Mike LooijmansQuoted 5 lines · Mike Looijmans
The automatic mounting can be disabled by adding a line MDEV_AUTOMOUNT=y
into/etc/default/mdev
Presumably you meant =n there, right?
Ross
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Mike LooijmansHi Mike,
Quoted 11 lines · 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
Quoted 5 lines · Ross
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
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Burton, RossQuoted 15 lines · Ross
Hi Mike,
On 5 December 2014 at 09:58, Mike Looijmans <[email protected] <mailto:[email protected]>> 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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).
Quoted 2 lines
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>
Signature · 4 lines
------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Burton, RossQuoted 15 lines · Ross
Hi Mike,
On 5 December 2014 at 09:58, Mike Looijmans <[email protected] <mailto:[email protected]>> 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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).
Quoted 3 lines
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: [email protected]
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/
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Gary ThomasQuoted 17 lines · Gary Thomas
Quoted 16 lines · Ross
Hi Mike,
On 5 December 2014 at 09:58, Mike Looijmans <[email protected] <mailto:[email protected]>> 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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).
Quoted 7 lines
Quoted 4 lines
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: [email protected]
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/
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
Hello Mike,
Quoted 20 lines · Mike Looijmans
Quoted 19 lines · Gary Thomas
Quoted 17 lines · Ross
Hi Mike,
On 5 December 2014 at 09:58, Mike Looijmans <[email protected] <mailto:[email protected]>> 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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).
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
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.
Quoted 6 lines
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
Quoted 2 lines
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.
Signature · 3 lines
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
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Burton, RossQuoted 10 lines · Ross
On 5 December 2014 at 09:58, Mike Looijmans <[email protected] <mailto:[email protected]>> wrote:
The automatic mounting can be disabled by adding a line MDEV_AUTOMOUNT=y
into/etc/default/mdevPresumably 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: [email protected]
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/
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Mike LooijmansQuoted 3 lines · Mike Looijmans
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
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
Quoted 10 lines · Ross
On 18 December 2014 at 06:23, Mike Looijmans <[email protected] <mailto:[email protected]>> 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: [email protected]
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/
v2 cover Busybox mdev improvements
In reply to Mike LooijmansI'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.
PATCH v2 1/4 busybox-mdev: Install missing find-touchscreen.sh
mdev.conf references the find-touchscreen.sh script, but this file was not being installed. Add the script to the busybox-mdev package.
--- meta/recipes-core/busybox/busybox.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/busybox/busybox.inc +3 -1
@@ -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
Signature · 1 line
1.7.9.5
PATCH v2 2/4 busybox/find-touchscreen.sh: Simplify script and recognize USB devices
In reply to Mike LooijmansSimplify 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.
--- .../recipes-core/busybox/files/find-touchscreen.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
meta/recipes-core/busybox/files/find-touchscreen.sh +2 -5
@@ -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
Signature · 1 line
1.7.9.5
PATCH v2 4/4 busybox-mdev: Support automatic mounting of block devices
In reply to Mike LooijmansUpon 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.
--- 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
meta/recipes-core/busybox/busybox.inc +1 -0
@@ -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
meta/recipes-core/busybox/busybox_1.22.1.bb +1 -0
@@ -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 \
meta/recipes-core/busybox/busybox_git.bb +1 -0
@@ -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 \
meta/recipes-core/busybox/files/mdev-mount.sh new file +63 -0
63 lines not on this page · raw message
meta/recipes-core/busybox/files/mdev.conf +3 -0
@@ -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
Signature · 1 line
1.7.9.5
PATCH v2 3/4 busybox-mdev: Add hotplug kernel module support to mdev.conf
In reply to Mike LooijmansAdd 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(+)
meta/recipes-core/busybox/files/mdev.conf +2 -0
@@ -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: [email protected]
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/
Re: [PATCH 1/2] busybox-mdev: Support automatic mounting of block devices
In reply to Otavio SalvadorQuoted 29 lines · Otavio Salvador
Hello Mike,
Quoted 20 lines · Mike Looijmans
Quoted 19 lines · Gary Thomas
Quoted 17 lines · Ross
Hi Mike,
On 5 December 2014 at 09:58, Mike Looijmans <[email protected] <mailto:[email protected]>> 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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).Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
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.
Quoted 5 lines
...
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.
Quoted 8 lines
Quoted 6 lines
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.
Quoted 7 lines
Quoted 2 lines
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: [email protected]
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/
Re: [PATCH v2 1/4] busybox-mdev: Install missing find-touchscreen.sh
In reply to Mike LooijmansQuoted 4 lines · Mike Looijmans
mdev.conf references the
find-touchscreen.shscript, but this file was not being installed. Add the script to the busybox-mdev package.Signed-off-by Mike Looijmans <[email protected]>
Signature · 3 lines
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
Re: [PATCH v2 3/4] busybox-mdev: Add hotplug kernel module support to mdev.conf
In reply to Mike LooijmansQuoted 8 lines · 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.
Signature · 3 lines
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
Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
In reply to Mike LooijmansQuoted 96 lines · 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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 <[email protected]>---
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.shmeta/recipes-core/busybox/busybox.inc +1
-0@@ -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 fimeta/recipes-core/busybox/busybox_1.22.1.bb +1
-0@@ -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 \meta/recipes-core/busybox/busybox_git.bb +1
-0@@ -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 \meta/recipes-core/busybox/files/mdev-mount.sh new file +17
-0@@ -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`
meta/recipes-core/busybox/files/mdev-mount.sh line 27
Quoted 10 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +10
-0+ 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.
Quoted 55 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +36
-0+ 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 + ;; +esacmeta/recipes-core/busybox/files/mdev.conf +0
-0@@ -37,3 +37,6 @@ input/mice 0:0 0660input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
meta/recipes-core/busybox/files/mdev.conf +3
-0+ +[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh +mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.shSignature · 7 lines
1.7.9.5 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
Quoted 100 lines · Khem Raj
Quoted 100 lines · 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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 <[email protected]>---
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.shmeta/recipes-core/busybox/busybox.inc +1
-0@@ -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 fimeta/recipes-core/busybox/busybox_1.22.1.bb +1
-0@@ -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 \meta/recipes-core/busybox/busybox_git.bb +1
-0@@ -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 \meta/recipes-core/busybox/files/mdev-mount.sh new file +21
-0@@ -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
Quoted 8 lines
meta/recipes-core/busybox/files/mdev-mount.sh line 27
Quoted 6 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +6
-0+ if [ -f "/dev/nomount.${DEVBASE}" ] ; then + # blocked + exit 0 + fi + # check for full-disk partition + if [ "${DEVBASE}" == "${MDEV}" ] ; thenbashism, get rid of it.
please explain?
Quoted 57 lines
Quoted 56 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +36
-0+ 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 + ;; +esacmeta/recipes-core/busybox/files/mdev.conf +0
-0@@ -37,3 +37,6 @@ input/mice 0:0 0660input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
meta/recipes-core/busybox/files/mdev.conf +3
-1+ +[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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Mike Looijmans
Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
Quoted 115 lines · Mike Looijmans
Quoted 105 lines · Khem Raj
Quoted 105 lines · 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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 <[email protected]>---
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.shmeta/recipes-core/busybox/busybox.inc +0
-0@@ -270,6 +270,7 @@ do_install () { install -m 644 ${WORKDIR}/mdev.conf
${D}${sysconfdir}/mdev.confinstall -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
fimeta/recipes-core/busybox/busybox_1.22.1.bb +1
-0@@ -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 \meta/recipes-core/busybox/busybox_git.bb +1
-0@@ -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 \meta/recipes-core/busybox/files/mdev-mount.sh new file +21
-0@@ -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" fileQuoted 8 lines
meta/recipes-core/busybox/files/mdev-mount.sh line 27
Quoted 6 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +6
-0+ if [ -f "/dev/nomount.${DEVBASE}" ] ; then + # blocked + exit 0 + fi + # check for full-disk partition + if [ "${DEVBASE}" == "${MDEV}" ] ; thenbashism, get rid of it.
Quoted 1 line
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.
Quoted 61 lines
Quoted 59 lines
Quoted 58 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +36
-1+ 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 + ;; +esacmeta/recipes-core/busybox/files/mdev.conf +0
-0@@ -37,3 +37,6 @@ input/mice 0:0 0660input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
meta/recipes-core/busybox/files/mdev.conf +3
-0+ +[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh +mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.shSignature · 7 lines
1.7.9.5 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH v2 4/4] busybox-mdev: Support automatic mounting of block devices
Quoted 128 lines · Peter A. Bigot
Quoted 120 lines · Mike Looijmans
Quoted 110 lines · Khem Raj
Quoted 110 lines
On Dec 18, 2014, at 6:17 AM, Mike Looijmans
<[email protected]> 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/fstabentries so that mounting on UUID or LABEL or using custom mount options is still possible. If/etc/fstabdoes 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 <[email protected]>---
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.shmeta/recipes-core/busybox/busybox.inc +0
-0@@ -270,6 +270,7 @@ do_install () { install -m 644 ${WORKDIR}/mdev.conf
${D}${sysconfdir}/mdev.confinstall -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
fimeta/recipes-core/busybox/busybox_1.22.1.bb +1
-0@@ -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 \meta/recipes-core/busybox/busybox_git.bb +1
-0@@ -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 \meta/recipes-core/busybox/files/mdev-mount.sh new file +21
-0@@ -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" fileQuoted 8 lines
meta/recipes-core/busybox/files/mdev-mount.sh line 27
Quoted 6 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +6
-0+ if [ -f "/dev/nomount.${DEVBASE}" ] ; then + # blocked + exit 0 + fi + # check for full-disk partition + if [ "${DEVBASE}" == "${MDEV}" ] ; thenbashism, get rid of it.
Quoted 1 line
please explain?
From
http://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html:
Quoted 5 lines
string1 == string2
string1 = string2True 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.
Quoted 64 lines
Quoted 63 lines
Quoted 61 lines
Quoted 60 lines
meta/recipes-core/busybox/files/mdev-mount.sh new file +36
-1+ 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 + ;; +esacmeta/recipes-core/busybox/files/mdev.conf +0
-0@@ -37,3 +37,6 @@ input/mice 0:0 0660input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
meta/recipes-core/busybox/files/mdev.conf +3
-1+ +[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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Mike Looijmans