Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev
@ 2016-07-01 18:56 Andy Shevchenko
  2016-07-01 20:54 ` Thomas Petazzoni
  2016-07-02 11:16 ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2016-07-01 18:56 UTC (permalink / raw)
  To: buildroot

The new change which enabled automatic module loading on boot does not handle
the cases when module alias includes spaces. It prevents modules to be loaded
since script fails:

  % find /sys/ -name modalias | xargs sort -u
  sort: /sys/devices/platform/Fixed: No such file or directory

First alias in question is "platform:Fixed MDIO bus".

Amend the script to support above like cases.

Fixes: 07f46c2b6dae ("package/busybox: support automatic module loading with mdev")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 package/busybox/S10mdev | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/busybox/S10mdev b/package/busybox/S10mdev
index 4cb31de..f72c43f 100644
--- a/package/busybox/S10mdev
+++ b/package/busybox/S10mdev
@@ -9,7 +9,9 @@ case "$1" in
 	echo /sbin/mdev >/proc/sys/kernel/hotplug
 	/sbin/mdev -s
 	# coldplug modules
-	find /sys/ -name modalias | xargs sort -u | xargs modprobe -abq
+	find /sys -name modalias -print0 | xargs -0 sort -u | while read ma; do
+		modprobe -bq "$ma"
+	done
 	;;
   stop)
 	;;
-- 
2.8.1

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

* [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev
  2016-07-01 18:56 [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev Andy Shevchenko
@ 2016-07-01 20:54 ` Thomas Petazzoni
  2016-07-01 21:53   ` Yann E. MORIN
  2016-07-02 11:16 ` Thomas Petazzoni
  1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2016-07-01 20:54 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri,  1 Jul 2016 21:56:19 +0300, Andy Shevchenko wrote:
> The new change which enabled automatic module loading on boot does not handle
> the cases when module alias includes spaces. It prevents modules to be loaded
> since script fails:
> 
>   % find /sys/ -name modalias | xargs sort -u
>   sort: /sys/devices/platform/Fixed: No such file or directory
> 
> First alias in question is "platform:Fixed MDIO bus".
> 
> Amend the script to support above like cases.
> 
> Fixes: 07f46c2b6dae ("package/busybox: support automatic module loading with mdev")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks for this patch. However, I have one question below.

> -	find /sys/ -name modalias | xargs sort -u | xargs modprobe -abq
> +	find /sys -name modalias -print0 | xargs -0 sort -u | while read ma; do

Why is /sys/ changed to /sys ?

Is it because of the sort -u that you cannot do another xargs -0 for
the modprobe (which would look nice that the "while read ... done"
loop) ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev
  2016-07-01 20:54 ` Thomas Petazzoni
@ 2016-07-01 21:53   ` Yann E. MORIN
  2016-07-02 11:43     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2016-07-01 21:53 UTC (permalink / raw)
  To: buildroot

Andy, Thomas, All,

On 2016-07-01 22:54 +0200, Thomas Petazzoni spake thusly:
> On Fri,  1 Jul 2016 21:56:19 +0300, Andy Shevchenko wrote:
> > The new change which enabled automatic module loading on boot does not handle
> > the cases when module alias includes spaces. It prevents modules to be loaded
> > since script fails:
> > 
> >   % find /sys/ -name modalias | xargs sort -u
> >   sort: /sys/devices/platform/Fixed: No such file or directory
> > 
> > First alias in question is "platform:Fixed MDIO bus".
> > 
> > Amend the script to support above like cases.
> > 
> > Fixes: 07f46c2b6dae ("package/busybox: support automatic module loading with mdev")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thanks for this patch. However, I have one question below.
> 
> > -	find /sys/ -name modalias | xargs sort -u | xargs modprobe -abq
> > +	find /sys -name modalias -print0 | xargs -0 sort -u | while read ma; do
> 
> Why is /sys/ changed to /sys ?
> 
> Is it because of the sort -u that you cannot do another xargs -0 for
> the modprobe (which would look nice that the "while read ... done"
> loop) ?

sort has a -z option to output with zero-teminated lines instead of \n.
So we could do (almost untested):

    find /sys/ -name modalias -print0 |xargs -0 sort -u -z |xargs -0 modprobe -abq

Note: the -z option to sort in Busybox depends on SORT_BIG, which is
enabled in out busybox bundled configuration, so we can use it.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev
  2016-07-01 18:56 [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev Andy Shevchenko
  2016-07-01 20:54 ` Thomas Petazzoni
@ 2016-07-02 11:16 ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2016-07-02 11:16 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri,  1 Jul 2016 21:56:19 +0300, Andy Shevchenko wrote:
> The new change which enabled automatic module loading on boot does not handle
> the cases when module alias includes spaces. It prevents modules to be loaded
> since script fails:
> 
>   % find /sys/ -name modalias | xargs sort -u
>   sort: /sys/devices/platform/Fixed: No such file or directory
> 
> First alias in question is "platform:Fixed MDIO bus".
> 
> Amend the script to support above like cases.
> 
> Fixes: 07f46c2b6dae ("package/busybox: support automatic module loading with mdev")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  package/busybox/S10mdev | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Applied to master with the change suggested by Yann. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev
  2016-07-01 21:53   ` Yann E. MORIN
@ 2016-07-02 11:43     ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2016-07-02 11:43 UTC (permalink / raw)
  To: buildroot

On Fri, 2016-07-01 at 23:53 +0200, Yann E. MORIN wrote:
> Andy, Thomas, All,
> 
> On 2016-07-01 22:54 +0200, Thomas Petazzoni spake thusly:
> > On Fri,??1 Jul 2016 21:56:19 +0300, Andy Shevchenko wrote:
> > > The new change which enabled automatic module loading on boot does
> > > not handle
> > > the cases when module alias includes spaces. It prevents modules
> > > to be loaded
> > > since script fails:
> > > 
> > > ? % find /sys/ -name modalias | xargs sort -u
> > > ? sort: /sys/devices/platform/Fixed: No such file or directory
> > > 
> > > First alias in question is "platform:Fixed MDIO bus".
> > > 
> > > Amend the script to support above like cases.
> > > 
> > > Fixes: 07f46c2b6dae ("package/busybox: support automatic module
> > > loading with mdev")
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > Thanks for this patch. However, I have one question below.
> > 
> > > -	find /sys/ -name modalias | xargs sort -u | xargs
> > > modprobe -abq
> > > +	find /sys -name modalias -print0 | xargs -0 sort -u |
> > > while read ma; do
> > 
> > Why is /sys/ changed to /sys ?
> > 
> > Is it because of the sort -u that you cannot do another xargs -0 for
> > the modprobe (which would look nice that the "while read ... done"
> > loop) ?
> 
> sort has a -z option to output with zero-teminated lines instead of
> \n.
> So we could do (almost untested):
> 
> ????find /sys/ -name modalias -print0 |xargs -0 sort -u -z |xargs -0
> modprobe -abq

Rough test shows it's working. I will prepare an updated version of the
patch, test it and then send to the list soon.

> 
> Note: the -z option to sort in Busybox depends on SORT_BIG, which is
> enabled in out busybox bundled configuration, so we can use it.
> 
> Regards,
> Yann E. MORIN.
> 

-- 

Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

end of thread, other threads:[~2016-07-02 11:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-01 18:56 [Buildroot] [PATCH v1 1/1] package/busybox: support spaces in module aliases in mdev Andy Shevchenko
2016-07-01 20:54 ` Thomas Petazzoni
2016-07-01 21:53   ` Yann E. MORIN
2016-07-02 11:43     ` Andy Shevchenko
2016-07-02 11:16 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox