Skip to contentSkip to conversation

package/busybox: support spaces in module aliases in mdev

PATCH Superseded Andy Shevchenko 3 participants 5 messages Jul 1, 2016 – Jul 2, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/busybox: support spaces in module aliases in mdev

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")
---
 package/busybox/S10mdev | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/busybox/S10mdev +3 -1
index 4cb31de..f72c43f 100644
@@ -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)
 	;;
Signature · 1 line
2.8.1
#1 lore raw

PATCH 1/1 package/busybox: support spaces in module aliases in mdev

Hello,

Quoted 7 lines · Andy Shevchenko

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

Quoted 6 lines

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")

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

package/busybox/S10mdev case "$1" in · line 12

Quoted 2 lines
package/busybox/S10mdev +1 -1
-	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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package/busybox: support spaces in module aliases in mdev

Andy, Thomas, All,

On 2016-07-01 22:54 +0200, Thomas Petazzoni spake thusly:

Quoted 17 lines · Andy Shevchenko
Quoted 7 lines

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

Quoted 6 lines

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")

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

Quoted 8 lines

package/busybox/S10mdev case "$1" in · line 12

Quoted 2 lines
package/busybox/S10mdev +1 -1
-	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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 package/busybox: support spaces in module aliases in mdev

In reply to Andy Shevchenko

Hello,

Quoted 9 lines · Andy Shevchenko

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".

Quoted 7 lines

Amend the script to support above like cases.

Fixes 07f46c2b6dae ("package/busybox: support automatic module loading with mdev")
---
 package/busybox/S10mdev | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH 1/1 package/busybox: support spaces in module aliases in mdev

In reply to Yann E. MORIN
Quoted 34 lines · Yann E. MORIN

Andy, Thomas, All,

On 2016-07-01 22:54 +0200, Thomas Petazzoni spake thusly:

Quoted 27 lines · Andy Shevchenko
Quoted 9 lines

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

Quoted 7 lines

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")

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

Quoted 4 lines
(quoted diff) +0 -1
-	find /sys/ -name modalias | xargs sort -u | xargs

modprobe -abq

(quoted diff) +1 -0
+	find /sys -name modalias -print0 | xargs -0 sort -u |

while read ma; do

Why is /sys/ changed to /sys ?

Quoted 3 lines

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) ?

Quoted 6 lines

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.

Quoted 7 lines

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.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy