Skip to contentSkip to conversation

Update Busybox to 1.31 and use mdev daemon mode

PATCH New Titouan Christophe 4 participants 12 messages Jun 19, 2019 – Jun 23, 2019

lore
Share & tools
lore
#0 lore raw

cover Update Busybox to 1.31 and use mdev daemon mode

The latest Busybox release introduces the daemon mode for mdev, which can be used as a replacement for the uevent+mdev setup, or the old kernel hotplug mechanism.

This new mode prevent race conditions in mdev invocations, but on the other hand it requires CONFIG_NET to be enabled in the kernel.

In this patchset, Busybox is bumped to the latest version, the default configuration is updated to support the mdev daemon mode, and the mdev init script is updated accordingly

Titouan Christophe (3):
package/busybox: bump version to 1.31.0
package/busybox: convert S10mdev to the canonical init script format package/busybox: run mdev in daemon mode

 ...-scripted_main-as-externally-visible.patch | 53 -------------------
 package/busybox/S10mdev                       | 42 ++++++++++-----
 package/busybox/busybox.config                |  1 +
 package/busybox/busybox.hash                  |  4 +-
 package/busybox/busybox.mk                    |  2 +-
 5 files changed, 34 insertions(+), 68 deletions(-)
 delete mode 100644 package/busybox/0003-libbb-mark-scripted_main-as-externally-visible.patch
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/3 package/busybox: bump version to 1.31.0

Remove 0003-libbb-mark-scripted_main-as-externally-visible.patch as it was committed upstream in 3193cb56d6

---
 ...-scripted_main-as-externally-visible.patch | 53 -------------------
 package/busybox/busybox.hash                  |  4 +-
 package/busybox/busybox.mk                    |  2 +-
 3 files changed, 3 insertions(+), 56 deletions(-)
 delete mode 100644 package/busybox/0003-libbb-mark-scripted_main-as-externally-visible.patch
package/busybox/0003-libbb-mark-scripted_main-as-externally-visible.patch deleted +0 -53
deleted file mode 100644
index d3b174dd4a..0000000000
@@ -1,53 +0,0 @@
-From eb5830223d452944b96e526b2f44158bda5c5c56 Mon Sep 17 00:00:00 2001
-From: Ron Yorston <[email protected]>
-Date: Sat, 30 Mar 2019 07:47:12 +0000
-Subject: [PATCH] libbb: mark scripted_main() as externally visible
-
-Building with individual binaries enabled fails when embedded
-script applets are included:
-
-   /tmp/ccIvMFZg.o: In function `main':
-   applet.c:(.text.main+0x20): undefined reference to `scripted_main'
-
-Mark scripted_main() as externally visible.
-
-Reported-by: Yann E. MORIN <[email protected]>
-Signed-off-by: Ron Yorston <[email protected]>
-Signed-off-by: "Yann E. MORIN" <[email protected]>
----
-Upstream status: reported, patch pending;
-    http://lists.busybox.net/pipermail/busybox/2019-March/087148.html
-    http://lists.busybox.net/pipermail/busybox/2019-March/087149.html
----
- include/libbb.h   | 2 +-
- libbb/appletlib.c | 1 +
- 2 files changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/include/libbb.h b/include/libbb.h
-index e0d5521e4..a20d5e403 100644
---- a/include/libbb.h
-+++ b/include/libbb.h
-@@ -1347,7 +1347,7 @@ void bb_logenv_override(void) FAST_FUNC;
- 
- /* Embedded script support */
- char *get_script_content(unsigned n) FAST_FUNC;
--int scripted_main(int argc, char** argv);
-+int scripted_main(int argc, char** argv) MAIN_EXTERNALLY_VISIBLE;
- 
- /* Applets which are useful from another applets */
- int bb_cat(char** argv) FAST_FUNC;
-diff --git a/libbb/appletlib.c b/libbb/appletlib.c
-index c15014a34..fa19e8488 100644
---- a/libbb/appletlib.c
-+++ b/libbb/appletlib.c
-@@ -770,6 +770,7 @@ static int find_script_by_name(const char *name)
- 	return -1;
- }
- 
-+int scripted_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE;
- int scripted_main(int argc UNUSED_PARAM, char **argv)
- {
- 	int script = find_script_by_name(applet_name);
--- 
-2.14.1
-
package/busybox/busybox.hash +2 -2
index c6804dc1fe..2b346e685d 100644
@@ -1,3 +1,3 @@
-# From https://busybox.net/downloads/busybox-1.30.1.tar.bz2.sha256
-sha256 3d1d04a4dbd34048f4794815a5c48ebb9eb53c5277e09ffffc060323b95dfbdc  busybox-1.30.1.tar.bz2
+# From https://busybox.net/downloads/busybox-1.31.0.tar.bz2.sha256
+sha256 0e4925392fd9f3743cc517e031b68b012b24a63b0cf6c1ff03cce7bb3846cc99  busybox-1.31.0.tar.bz2
 sha256 bbfc9843646d483c334664f651c208b9839626891d8f17604db2146962f43548  LICENSE
package/busybox/busybox.mk +1 -1
index e606068a90..7a5a37a05d 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-BUSYBOX_VERSION = 1.30.1
+BUSYBOX_VERSION = 1.31.0
 BUSYBOX_SITE = http://www.busybox.net/downloads
 BUSYBOX_SOURCE = busybox-$(BUSYBOX_VERSION).tar.bz2
 BUSYBOX_LICENSE = GPL-2.0
Signature · 1 line
2.21.0
#2 lore raw

PATCH 2/3 package/busybox: convert S10mdev to the canonical init script format

In reply to Titouan Christophe
---
 package/busybox/S10mdev | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
package/busybox/S10mdev +12 -9
index 7075b77016..efef4290ba 100644
@@ -3,21 +3,24 @@
 # Start mdev....
 #
 
-case "$1" in
-  start)
+
+start() {
 	echo "Starting mdev..."
 	echo /sbin/mdev >/proc/sys/kernel/hotplug
 	/sbin/mdev -s
 	# coldplug modules
-	find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
-	    xargs -0 modprobe -abq
-	;;
-  stop)
-	;;
-  restart|reload)
+	find /sys/ -name modalias -print0 | \
+		xargs -0 sort -u | \
+		tr '\n' '\0' | \
+		xargs -0 modprobe -abq
+}
+
+case "$1" in
+  start)
+	"$1"
 	;;
   *)
-	echo "Usage: $0 {start|stop|restart}"
+	echo "Usage: $0 start"
 	exit 1
 esac
 
Signature · 1 line
2.21.0
#3 lore raw

PATCH 2/3 package/busybox: convert S10mdev to the canonical init script format

package/busybox/S10mdev line 15

Quoted 9 lines · Titouan Christophe
package/busybox/S10mdev +4 -2
-	find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
-	    xargs -0 modprobe -abq
 
+	find /sys/ -name modalias -print0 | \
+		xargs -0 sort -u | \
+		tr '\n' '\0' | \
+		xargs -0 modprobe -abq

How this indentation change related to the topic?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH 2/3 package/busybox: convert S10mdev to the canonical init script format

Hello Andy,

Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Titouan Christophe
package/busybox/S10mdev +0 -2
-	find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
-	    xargs -0 modprobe -abq
Quoted 7 lines

package/busybox/S10mdev line 15

Quoted 4 lines
package/busybox/S10mdev +4 -0
+	find /sys/ -name modalias -print0 | \
+		xargs -0 sort -u | \
+		tr '\n' '\0' | \
+		xargs -0 modprobe -abq

How this indentation change related to the topic?

This is a preparatory patch to convert this script to the canonical init script format, as suggested by Arnout (see
http://lists.busybox.net/pipermail/buildroot/2019-May/251199.html)

Regards,

Titouan

#5 lore raw

PATCH 2/3 package/busybox: convert S10mdev to the canonical init script format

Hi again,

Quoted 15 lines · Titouan Christophe

Hello Andy,

Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Titouan Christophe

-??? find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
-??????? xargs -0 modprobe -abq

+??? find /sys/ -name modalias -print0 | \
+??????? xargs -0 sort -u | \
+??????? tr '\n' '\0' | \
+??????? xargs -0 modprobe -abq

Quoted 6 lines
Quoted 2 lines

How this indentation change related to the topic?

This is a preparatory patch to convert this script to the canonical init script format, as suggested by Arnout (see
http://lists.busybox.net/pipermail/buildroot/2019-May/251199.html)

sorry I did not pay attention to the fact that you were only commenting on this particular hunk. I did reindent this command chain for better readability (in my opinion); I can rework that part to better suit the codestyle, if any.

Regards,

Titouan

#6 lore raw

PATCH 2/3 package/busybox: convert S10mdev to the canonical init script format

Quoted 24 lines · Titouan Christophe
Quoted 15 lines · Titouan Christophe

Hello Andy,

Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Titouan Christophe

-??? find /sys/ -name modalias -print0 | xargs -0 sort -u | tr '\n' '\0' | \
-??????? xargs -0 modprobe -abq

+??? find /sys/ -name modalias -print0 | \
+??????? xargs -0 sort -u | \
+??????? tr '\n' '\0' | \
+??????? xargs -0 modprobe -abq

Quoted 6 lines
Quoted 2 lines

How this indentation change related to the topic?

This is a preparatory patch to convert this script to the canonical init script format, as suggested by Arnout (see
http://lists.busybox.net/pipermail/buildroot/2019-May/251199.html)

Quoted 4 lines

sorry I did not pay attention to the fact that you were only commenting on this particular hunk. I did reindent this command chain for better readability (in my opinion); I can rework that part to better suit the codestyle, if any.

It should be a separate patch explaining why you are doing that, but not in this one.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

PATCH 3/3 package/busybox: run mdev in daemon mode

In reply to Titouan Christophe

- Enable the mdev daemon mode in Busybox default config
- Update the S10mdev init script to use the daemon mode

---
 package/busybox/S10mdev        | 27 +++++++++++++++++++++------
 package/busybox/busybox.config |  1 +
 2 files changed, 22 insertions(+), 6 deletions(-)
package/busybox/S10mdev +21 -6
index efef4290ba..3c6f47c18c 100644
@@ -1,13 +1,17 @@
 #!/bin/sh
 #
-# Start mdev....
+# Run the mdev daemon
 #
 
+DAEMON="mdev"
+PIDFILE="/var/run/$DAEMON.pid"
+
 
 start() {
-	echo "Starting mdev..."
-	echo /sbin/mdev >/proc/sys/kernel/hotplug
-	/sbin/mdev -s
+	echo -n "Starting $DAEMON... "
+	start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
+	[ $? -eq 0 ] && echo "OK" || echo "ERROR"
+
 	# coldplug modules
 	find /sys/ -name modalias -print0 | \
 		xargs -0 sort -u | \
@@ -15,12 +19,23 @@ start() {
 		xargs -0 modprobe -abq
 }
 
+stop() {
+	echo -n "Stopping $DAEMON... "
+	start-stop-daemon -K -p $PIDFILE
+	[ $? -eq 0 ] && echo "OK" || echo "ERROR"
+}
+
+restart() {
+	stop
+	start
+}
+
 case "$1" in
-  start)
+  start|stop|restart)
 	"$1"
 	;;
   *)
-	echo "Usage: $0 start"
+	echo "Usage: $0 {start|stop|restart}"
 	exit 1
 esac
 
package/busybox/busybox.config +1 -0
index 1d9560d655..c28718a725 100644
@@ -628,6 +628,7 @@ CONFIG_FEATURE_MDEV_RENAME=y
 # CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
 CONFIG_FEATURE_MDEV_EXEC=y
 # CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
+CONFIG_FEATURE_MDEV_DAEMON=y
 CONFIG_MESG=y
 CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y
 CONFIG_MKE2FS=y
Signature · 1 line
2.21.0
#8 lore raw

cover Update Busybox to 1.31 and use mdev daemon mode

In reply to Titouan Christophe
Quoted 4 lines · On Wed, 19 Jun 2019 18:42:54 +0200 Titouan Christophe…

Titouan Christophe (3):
package/busybox: bump version to 1.31.0
package/busybox: convert S10mdev to the canonical init script format package/busybox: run mdev in daemon mode

Series applied. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

cover Update Busybox to 1.31 and use mdev daemon mode

Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Quoted 4 lines · On Wed, 19 Jun 2019 18:42:54 +0200 Titouan Christophe…

Titouan Christophe (3):
package/busybox: bump version to 1.31.0
package/busybox: convert S10mdev to the canonical init script format package/busybox: run mdev in daemon mode

Series applied. Thanks!

Yes, thanks. We still need to force CONFIG_NET=y in the Linux kernel if mdev is enabled, right?

Signature · 1 line
Bye, Peter Korsgaard
#10 lore raw

cover Update Busybox to 1.31 and use mdev daemon mode

Hello all,

Quoted 10 lines · Peter Korsgaard
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Quoted 4 lines · On Wed, 19 Jun 2019 18:42:54 +0200 Titouan Christophe…

Titouan Christophe (3):
package/busybox: bump version to 1.31.0
package/busybox: convert S10mdev to the canonical init script format package/busybox: run mdev in daemon mode

Quoted 5 lines
Quoted 1 line

Series applied. Thanks!

Yes, thanks. We still need to force CONFIG_NET=y in the Linux kernel if mdev is enabled, right?

Yes, since mdev is now launched in daemon mode CONFIG_NET is now needed. Didn't think of enforcing that in the kernel config, I'm preparing a patch right now.

Regards,

Titouan

#11 lore raw

cover Update Busybox to 1.31 and use mdev daemon mode

Hi all,

Quoted 7 lines · Titouan Christophe

Hello all,

Quoted 3 lines · Peter Korsgaard

Yes, thanks. We still need to force CONFIG_NET=y in the Linux kernel if mdev is enabled, right?

Quoted 7 lines

Yes, since mdev is now launched in daemon mode CONFIG_NET is now needed. Didn't think of enforcing that in the kernel config, I'm preparing a patch right now.

Regards,

Titouan

The patch has been submitted here
http://patchwork.ozlabs.org/patch/1119590/.

Titouan