[OE-core] [PATCH] busybox: mdev: make mdev auto load modules at boot

Quentin Schulz quentin.schulz at bootlin.com
Tue Mar 6 08:39:15 UTC 2018


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 at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180306/cf1ecd1e/attachment-0002.sig>


More information about the Openembedded-core mailing list