* [PATCH] busybox: mdev: make mdev auto load modules at boot
@ 2018-03-05 8:22 Quentin Schulz
2018-03-06 3:12 ` Khem Raj
2018-03-06 12:28 ` Mike Looijmans
0 siblings, 2 replies; 5+ messages in thread
From: Quentin Schulz @ 2018-03-05 8:22 UTC (permalink / raw)
To: openembedded-core; +Cc: thomas.petazzoni
Thanks to the MODALIAS line at the beginning of mdev.conf, mdev supports
module auto probing on hotplug.
However, this does not work for cold plugged modules (i.e. modules for
devices that were probed before mdev is added as hotplug handler).
Running mdev -s to replay hotplug events does not work in that case.
Let's manually modprobe all modules in the rootfs.
Taken from:
- https://github.com/buildroot/buildroot/commit/07f46c2b6daec44a6176039c90be67e66c4c2e42
- https://github.com/buildroot/buildroot/commit/b4fc5a180c81689a982d5c595844331684c14f51
We need xargs to support zero termination of args so let's enable this
configuration in the fragment for mdev.
Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
---
meta/recipes-core/busybox/busybox/mdev.cfg | 2 ++
meta/recipes-core/busybox/files/mdev | 1 +
2 files changed, 3 insertions(+)
diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
index 6aefe90e43..0d60fc9560 100644
--- a/meta/recipes-core/busybox/busybox/mdev.cfg
+++ b/meta/recipes-core/busybox/busybox/mdev.cfg
@@ -9,3 +9,5 @@ CONFIG_SETSID=y
CONFIG_CTTYHACK=y
CONFIG_FEATURE_SHADOWPASSWDS=y
+
+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index 8c9c06e96c..165b275256 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -9,6 +9,7 @@ touch /dev/mdev.seq
#sysctl -w kernel.hotplug=/sbin/mdev
echo "/sbin/mdev" > /proc/sys/kernel/hotplug
mdev -s
+find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
#
# We might have mounted something over /dev, see if /dev/initctl is there.
--
2.14.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] busybox: mdev: make mdev auto load modules at boot
2018-03-05 8:22 [PATCH] busybox: mdev: make mdev auto load modules at boot Quentin Schulz
@ 2018-03-06 3:12 ` Khem Raj
2018-03-06 8:39 ` Quentin Schulz
2018-03-06 12:28 ` Mike Looijmans
1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2018-03-06 3:12 UTC (permalink / raw)
To: Quentin Schulz
Cc: thomas.petazzoni, Patches and discussions about the oe-core layer
On Mon, Mar 5, 2018 at 12:22 AM, Quentin Schulz
<quentin.schulz@bootlin.com> wrote:
> Thanks to the MODALIAS line at the beginning of mdev.conf, mdev supports
> module auto probing on hotplug.
>
> However, this does not work for cold plugged modules (i.e. modules for
> devices that were probed before mdev is added as hotplug handler).
> Running mdev -s to replay hotplug events does not work in that case.
>
> Let's manually modprobe all modules in the rootfs.
>
> Taken from:
> - https://github.com/buildroot/buildroot/commit/07f46c2b6daec44a6176039c90be67e66c4c2e42
> - https://github.com/buildroot/buildroot/commit/b4fc5a180c81689a982d5c595844331684c14f51
>
> We need xargs to support zero termination of args so let's enable this
> configuration in the fragment for mdev.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> ---
> meta/recipes-core/busybox/busybox/mdev.cfg | 2 ++
> meta/recipes-core/busybox/files/mdev | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> index 6aefe90e43..0d60fc9560 100644
> --- a/meta/recipes-core/busybox/busybox/mdev.cfg
> +++ b/meta/recipes-core/busybox/busybox/mdev.cfg
> @@ -9,3 +9,5 @@ CONFIG_SETSID=y
> CONFIG_CTTYHACK=y
>
> CONFIG_FEATURE_SHADOWPASSWDS=y
> +
> +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
> diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> index 8c9c06e96c..165b275256 100755
> --- a/meta/recipes-core/busybox/files/mdev
> +++ b/meta/recipes-core/busybox/files/mdev
> @@ -9,6 +9,7 @@ touch /dev/mdev.seq
> #sysctl -w kernel.hotplug=/sbin/mdev
> echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> mdev -s
> +find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
>
will this execute on every boot ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] busybox: mdev: make mdev auto load modules at boot
2018-03-06 3:12 ` Khem Raj
@ 2018-03-06 8:39 ` Quentin Schulz
0 siblings, 0 replies; 5+ messages in thread
From: Quentin Schulz @ 2018-03-06 8:39 UTC (permalink / raw)
To: Khem Raj
Cc: thomas.petazzoni, Patches and discussions about the oe-core layer
[-- Attachment #1: Type: text/plain, Size: 2585 bytes --]
Hi,
On Mon, Mar 05, 2018 at 07:12:01PM -0800, Khem Raj wrote:
> On Mon, Mar 5, 2018 at 12:22 AM, Quentin Schulz
> <quentin.schulz@bootlin.com> wrote:
> > Thanks to the MODALIAS line at the beginning of mdev.conf, mdev supports
> > module auto probing on hotplug.
> >
> > However, this does not work for cold plugged modules (i.e. modules for
> > devices that were probed before mdev is added as hotplug handler).
> > Running mdev -s to replay hotplug events does not work in that case.
> >
> > Let's manually modprobe all modules in the rootfs.
> >
> > Taken from:
> > - https://github.com/buildroot/buildroot/commit/07f46c2b6daec44a6176039c90be67e66c4c2e42
> > - https://github.com/buildroot/buildroot/commit/b4fc5a180c81689a982d5c595844331684c14f51
> >
> > We need xargs to support zero termination of args so let's enable this
> > configuration in the fragment for mdev.
> >
> > Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> > ---
> > meta/recipes-core/busybox/busybox/mdev.cfg | 2 ++
> > meta/recipes-core/busybox/files/mdev | 1 +
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> > index 6aefe90e43..0d60fc9560 100644
> > --- a/meta/recipes-core/busybox/busybox/mdev.cfg
> > +++ b/meta/recipes-core/busybox/busybox/mdev.cfg
> > @@ -9,3 +9,5 @@ CONFIG_SETSID=y
> > CONFIG_CTTYHACK=y
> >
> > CONFIG_FEATURE_SHADOWPASSWDS=y
> > +
> > +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
> > diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> > index 8c9c06e96c..165b275256 100755
> > --- a/meta/recipes-core/busybox/files/mdev
> > +++ b/meta/recipes-core/busybox/files/mdev
> > @@ -9,6 +9,7 @@ touch /dev/mdev.seq
> > #sysctl -w kernel.hotplug=/sbin/mdev
> > echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> > mdev -s
> > +find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
> >
>
> will this execute on every boot ?
This file is installed to /etc/init.d[1] and since this recipe inherits
update-rc.d[2] which takes care of adding those links to /etc/rcN.d/,
yes, it is executed at each boot.
I've also tested this patch since I need it for a USB controller driver
module and, in practical, it does get executed at each boot.
[1] http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-core/busybox/busybox.inc#n303
[2] http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-core/busybox/busybox.inc#n53
Quentin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 817 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] busybox: mdev: make mdev auto load modules at boot
2018-03-05 8:22 [PATCH] busybox: mdev: make mdev auto load modules at boot Quentin Schulz
2018-03-06 3:12 ` Khem Raj
@ 2018-03-06 12:28 ` Mike Looijmans
2018-03-07 10:12 ` Alexandre Belloni
1 sibling, 1 reply; 5+ messages in thread
From: Mike Looijmans @ 2018-03-06 12:28 UTC (permalink / raw)
To: Quentin Schulz, openembedded-core; +Cc: thomas.petazzoni
On 05-03-18 09:22, Quentin Schulz wrote:
> Thanks to the MODALIAS line at the beginning of mdev.conf, mdev supports
> module auto probing on hotplug.
>
> However, this does not work for cold plugged modules (i.e. modules for
> devices that were probed before mdev is added as hotplug handler).
> Running mdev -s to replay hotplug events does not work in that case.
I'd rather have this in a seperate bootscript, like this (which performs the
same but applies a filter):
https://github.com/topic-embedded-products/meta-topic/tree/master/recipes-core/module-init-tools
This gives users a choice as to whether or not they want this to happen.
Another note: Since this runs at each and every boot, it'd be wise to optimize
this for performance. That "sort -u" might be bad for performance, and
modprobe doesn't mind if modules were already probed.
> Let's manually modprobe all modules in the rootfs.
>
> Taken from:
> - https://github.com/buildroot/buildroot/commit/07f46c2b6daec44a6176039c90be67e66c4c2e42
> - https://github.com/buildroot/buildroot/commit/b4fc5a180c81689a982d5c595844331684c14f51
>
> We need xargs to support zero termination of args so let's enable this
> configuration in the fragment for mdev.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> ---
> meta/recipes-core/busybox/busybox/mdev.cfg | 2 ++
> meta/recipes-core/busybox/files/mdev | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> index 6aefe90e43..0d60fc9560 100644
> --- a/meta/recipes-core/busybox/busybox/mdev.cfg
> +++ b/meta/recipes-core/busybox/busybox/mdev.cfg
> @@ -9,3 +9,5 @@ CONFIG_SETSID=y
> CONFIG_CTTYHACK=y
>
> CONFIG_FEATURE_SHADOWPASSWDS=y
> +
> +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
> diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> index 8c9c06e96c..165b275256 100755
> --- a/meta/recipes-core/busybox/files/mdev
> +++ b/meta/recipes-core/busybox/files/mdev
> @@ -9,6 +9,7 @@ touch /dev/mdev.seq
> #sysctl -w kernel.hotplug=/sbin/mdev
> echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> mdev -s
> +find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
>
> #
> # We might have mounted something over /dev, see if /dev/initctl is there.
>
Kind regards,
Mike Looijmans
System Expert
TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] busybox: mdev: make mdev auto load modules at boot
2018-03-06 12:28 ` Mike Looijmans
@ 2018-03-07 10:12 ` Alexandre Belloni
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Belloni @ 2018-03-07 10:12 UTC (permalink / raw)
To: Mike Looijmans; +Cc: thomas.petazzoni, openembedded-core
On 06/03/2018 at 13:28:52 +0100, Mike Looijmans wrote:
> On 05-03-18 09:22, Quentin Schulz wrote:
> > Thanks to the MODALIAS line at the beginning of mdev.conf, mdev supports
> > module auto probing on hotplug.
> >
> > However, this does not work for cold plugged modules (i.e. modules for
> > devices that were probed before mdev is added as hotplug handler).
> > Running mdev -s to replay hotplug events does not work in that case.
>
> I'd rather have this in a seperate bootscript, like this (which performs the
> same but applies a filter):
> https://github.com/topic-embedded-products/meta-topic/tree/master/recipes-core/module-init-tools
>
> This gives users a choice as to whether or not they want this to happen.
>
Well, this is a matter of expectations, I really think that final users
will expect that by default modules will be automatically loaded at boot
time. Wanting modules to be loaded automatically by the hotplug events
and not at boot time is a really specific use case.
Advanced users will still have the choice to use a different init script
if they don't want that to happen.
> Another note: Since this runs at each and every boot, it'd be wise to
> optimize this for performance. That "sort -u" might be bad for performance,
> and modprobe doesn't mind if modules were already probed.
>
>
>
> > Let's manually modprobe all modules in the rootfs.
> >
> > Taken from:
> > - https://github.com/buildroot/buildroot/commit/07f46c2b6daec44a6176039c90be67e66c4c2e42
> > - https://github.com/buildroot/buildroot/commit/b4fc5a180c81689a982d5c595844331684c14f51
> >
> > We need xargs to support zero termination of args so let's enable this
> > configuration in the fragment for mdev.
> >
> > Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
> > ---
> > meta/recipes-core/busybox/busybox/mdev.cfg | 2 ++
> > meta/recipes-core/busybox/files/mdev | 1 +
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> > index 6aefe90e43..0d60fc9560 100644
> > --- a/meta/recipes-core/busybox/busybox/mdev.cfg
> > +++ b/meta/recipes-core/busybox/busybox/mdev.cfg
> > @@ -9,3 +9,5 @@ CONFIG_SETSID=y
> > CONFIG_CTTYHACK=y
> > CONFIG_FEATURE_SHADOWPASSWDS=y
> > +
> > +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y
> > diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> > index 8c9c06e96c..165b275256 100755
> > --- a/meta/recipes-core/busybox/files/mdev
> > +++ b/meta/recipes-core/busybox/files/mdev
> > @@ -9,6 +9,7 @@ touch /dev/mdev.seq
> > #sysctl -w kernel.hotplug=/sbin/mdev
> > echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> > mdev -s
> > +find /sys/ -name modalias -print0 | xargs -0 sort -u -z | xargs -0 modprobe -abq
> > #
> > # We might have mounted something over /dev, see if /dev/initctl is there.
> >
>
>
>
> Kind regards,
>
> Mike Looijmans
> System Expert
>
> TOPIC Products
> Materiaalweg 4, NL-5681 RJ Best
> Postbus 440, NL-5680 AK Best
> Telefoon: +31 (0) 499 33 69 79
> E-mail: mike.looijmans@topicproducts.com
> Website: www.topicproducts.com
>
> Please consider the environment before printing this e-mail
>
>
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-07 10:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-05 8:22 [PATCH] busybox: mdev: make mdev auto load modules at boot Quentin Schulz
2018-03-06 3:12 ` Khem Raj
2018-03-06 8:39 ` Quentin Schulz
2018-03-06 12:28 ` Mike Looijmans
2018-03-07 10:12 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox