All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] initscripts: use quotes for shell variable comparision
@ 2020-12-17 22:54 Khem Raj
  2020-12-17 22:54 ` [PATCH 2/4] busybox: Install /etc/default/rcS when used as init system Khem Raj
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Khem Raj @ 2020-12-17 22:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

Helps to execute it with busybox shell

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
index 02f0351fcb..a63e71b780 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap"
 #
 # Check the root filesystem.
 #
-if test -f /fastboot || test $rootcheck = no
+if test -f /fastboot || test "$rootcheck" = "no"
 then
   test $rootcheck = yes && echo "Fast boot, no filesystem check"
 else
-- 
2.29.2


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

* [PATCH 2/4] busybox: Install /etc/default/rcS when used as init system
  2020-12-17 22:54 [PATCH 1/4] initscripts: use quotes for shell variable comparision Khem Raj
@ 2020-12-17 22:54 ` Khem Raj
  2020-12-17 22:54 ` [PATCH 3/4] busybox: Run mdev as daemon Khem Raj
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Khem Raj @ 2020-12-17 22:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This helps in using sysvinit scripts with busybox init system as well

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/busybox/busybox.inc       | 1 +
 meta/recipes-core/busybox/busybox_1.32.0.bb | 1 +
 meta/recipes-core/busybox/files/rcS.default | 1 +
 3 files changed, 3 insertions(+)
 create mode 100644 meta/recipes-core/busybox/files/rcS.default

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index e0522be729..c3a97261d5 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -312,6 +312,7 @@ do_install () {
 	if grep -q "CONFIG_INIT=y" ${B}/.config; then
 		install -D -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS
 		install -D -m 0755 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK
+		install -D -m 0755 ${WORKDIR}/rcS.default ${D}${sysconfdir}/default/rcS
 	fi
 
 	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
diff --git a/meta/recipes-core/busybox/busybox_1.32.0.bb b/meta/recipes-core/busybox/busybox_1.32.0.bb
index 8e23b0d4a2..3a669444dd 100644
--- a/meta/recipes-core/busybox/busybox_1.32.0.bb
+++ b/meta/recipes-core/busybox/busybox_1.32.0.bb
@@ -33,6 +33,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://getopts.cfg \
            file://resize.cfg \
            ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
+           ${@["", "file://rcS.default"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \
            ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager') == 'busybox-mdev')]} \
            file://syslog.cfg \
            file://unicode.cfg \
diff --git a/meta/recipes-core/busybox/files/rcS.default b/meta/recipes-core/busybox/files/rcS.default
new file mode 100644
index 0000000000..262cad7d2a
--- /dev/null
+++ b/meta/recipes-core/busybox/files/rcS.default
@@ -0,0 +1 @@
+# SULOGIN = "yes"
-- 
2.29.2


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

* [PATCH 3/4] busybox: Run mdev as daemon
  2020-12-17 22:54 [PATCH 1/4] initscripts: use quotes for shell variable comparision Khem Raj
  2020-12-17 22:54 ` [PATCH 2/4] busybox: Install /etc/default/rcS when used as init system Khem Raj
@ 2020-12-17 22:54 ` Khem Raj
  2020-12-17 23:59   ` [OE-core] " Andre McCurdy
  2020-12-17 22:54 ` [PATCH 4/4] initscripts: Use initctl on sysvinit only Khem Raj
  2020-12-17 23:51 ` [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision Andre McCurdy
  3 siblings, 1 reply; 18+ messages in thread
From: Khem Raj @ 2020-12-17 22:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

When busybox is used for device management, kernel needs to support
older/obsolete mechanism via CONFIG_UEVENT_HELPER and
CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
would require kernel defconfig change and will always be needed when
mdev is used, intead run it in daemon mode

Update mdev init script to run mdev in daemon mode

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/busybox/busybox/mdev.cfg |  2 +
 meta/recipes-core/busybox/files/mdev       | 56 +++++++++++++++-------
 2 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
index 6aefe90e43..143e6097cb 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
+CONFIG_FEATURE_MDEV_DAEMON=y
diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index 8c9c06e96c..2fbdfb073e 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -1,21 +1,43 @@
 #!/bin/sh
-mount -t proc proc /proc
-mount -t sysfs sysfs /sys
-mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
-mkdir /dev/pts /dev/shm
-chmod 777 /dev/shm
-mount -t devpts devpts /dev/pts
-touch /dev/mdev.seq
-#sysctl -w kernel.hotplug=/sbin/mdev
-echo "/sbin/mdev" > /proc/sys/kernel/hotplug
-mdev -s
-
 #
-# We might have mounted something over /dev, see if /dev/initctl is there.
+# Run the mdev daemon
 #
-if test ! -p /dev/initctl
-then
-        rm -f /dev/initctl
-        mknod -m 600 /dev/initctl p
-fi
+
+DAEMON="mdev"
+PIDFILE="/var/run/$DAEMON.pid"
+
+
+start() {
+  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 | \
+    tr '\n' '\0' | \
+    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|stop|restart)
+  "$1"
+  ;;
+  *)
+  echo "Usage: $0 {start|stop|restart}"
+  exit 1
+esac
+
+exit $?
 
-- 
2.29.2


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

* [PATCH 4/4] initscripts: Use initctl on sysvinit only
  2020-12-17 22:54 [PATCH 1/4] initscripts: use quotes for shell variable comparision Khem Raj
  2020-12-17 22:54 ` [PATCH 2/4] busybox: Install /etc/default/rcS when used as init system Khem Raj
  2020-12-17 22:54 ` [PATCH 3/4] busybox: Run mdev as daemon Khem Raj
@ 2020-12-17 22:54 ` Khem Raj
  2020-12-18 18:29   ` [OE-core] " Sinan Kaya
  2020-12-18 18:49   ` Peter Kjellerstedt
  2020-12-17 23:51 ` [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision Andre McCurdy
  3 siblings, 2 replies; 18+ messages in thread
From: Khem Raj @ 2020-12-17 22:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

Check if init system is sysvinit to recreate initctl, this ensures that
it can be used with busybox init system as well

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../initscripts/initscripts-1.0/mountall.sh   | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
index c719be5d9a..ead4dba46d 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
@@ -19,15 +19,21 @@
 test "$VERBOSE" != no && echo "Mounting local filesystems..."
 mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
 
-#
-# We might have mounted something over /dev, see if /dev/initctl is there.
-#
-if test ! -p /dev/initctl
-then
-	rm -f /dev/initctl
-	mknod -m 600 /dev/initctl p
+
+# We might have mounted something over /run; see if
+# /dev/initctl is present.  Look for
+# /sbin/init.sysvinit to verify that sysvinit (and
+# not busybox or systemd) is installed as default init).
+INITCTL="/dev/initctl"
+if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; then
+    # Create new control channel
+		rm -f "$INITCTL"
+		mknod -m 600 "$INITCTL" p
+
+		# Reopen control channel.
+		PID="$(pidof -s /sbin/init || echo 1)"
+		[ -n "$PID" ] && kill -s USR1 "$PID"
 fi
-kill -USR1 1
 
 #
 # Execute swapon command again, in case we want to swap to
-- 
2.29.2


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

* Re: [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision
  2020-12-17 22:54 [PATCH 1/4] initscripts: use quotes for shell variable comparision Khem Raj
                   ` (2 preceding siblings ...)
  2020-12-17 22:54 ` [PATCH 4/4] initscripts: Use initctl on sysvinit only Khem Raj
@ 2020-12-17 23:51 ` Andre McCurdy
  2020-12-17 23:53   ` Khem Raj
  3 siblings, 1 reply; 18+ messages in thread
From: Andre McCurdy @ 2020-12-17 23:51 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> Helps to execute it with busybox shell

How does it help? Adding quotes would help if $rootcheck is an empty
string, but that's not specific to busybox.

> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> index 02f0351fcb..a63e71b780 100755
> --- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> @@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap"
>  #
>  # Check the root filesystem.
>  #
> -if test -f /fastboot || test $rootcheck = no
> +if test -f /fastboot || test "$rootcheck" = "no"
>  then
>    test $rootcheck = yes && echo "Fast boot, no filesystem check"

Doesn't this instance need to be quoted too?

>  else
> --
> 2.29.2
>
>
> 
>

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

* Re: [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision
  2020-12-17 23:51 ` [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision Andre McCurdy
@ 2020-12-17 23:53   ` Khem Raj
  2020-12-18  0:02     ` Andre McCurdy
  0 siblings, 1 reply; 18+ messages in thread
From: Khem Raj @ 2020-12-17 23:53 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 3:51 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>
> On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > Helps to execute it with busybox shell
>
> How does it help? Adding quotes would help if $rootcheck is an empty
> string, but that's not specific to busybox.
>
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > index 02f0351fcb..a63e71b780 100755
> > --- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > @@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap"
> >  #
> >  # Check the root filesystem.
> >  #
> > -if test -f /fastboot || test $rootcheck = no
> > +if test -f /fastboot || test "$rootcheck" = "no"
> >  then
> >    test $rootcheck = yes && echo "Fast boot, no filesystem check"
>
> Doesn't this instance need to be quoted too?

yes infact there are more cleanup to follow, this series just fixed
default boot errors on reference images.

>
> >  else
> > --
> > 2.29.2
> >
> >
> > 
> >

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

* Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
  2020-12-17 22:54 ` [PATCH 3/4] busybox: Run mdev as daemon Khem Raj
@ 2020-12-17 23:59   ` Andre McCurdy
  2020-12-18  2:45     ` Christopher Larson
  2020-12-18  3:52     ` Khem Raj
  0 siblings, 2 replies; 18+ messages in thread
From: Andre McCurdy @ 2020-12-17 23:59 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> When busybox is used for device management, kernel needs to support
> older/obsolete mechanism via CONFIG_UEVENT_HELPER and
> CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
> would require kernel defconfig change and will always be needed when
> mdev is used, intead run it in daemon mode
>
> Update mdev init script to run mdev in daemon mode
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-core/busybox/busybox/mdev.cfg |  2 +
>  meta/recipes-core/busybox/files/mdev       | 56 +++++++++++++++-------
>  2 files changed, 41 insertions(+), 17 deletions(-)
>
> diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> index 6aefe90e43..143e6097cb 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
> +CONFIG_FEATURE_MDEV_DAEMON=y
> diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> index 8c9c06e96c..2fbdfb073e 100755
> --- a/meta/recipes-core/busybox/files/mdev
> +++ b/meta/recipes-core/busybox/files/mdev
> @@ -1,21 +1,43 @@
>  #!/bin/sh
> -mount -t proc proc /proc
> -mount -t sysfs sysfs /sys
> -mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
> -mkdir /dev/pts /dev/shm
> -chmod 777 /dev/shm
> -mount -t devpts devpts /dev/pts
> -touch /dev/mdev.seq
> -#sysctl -w kernel.hotplug=/sbin/mdev
> -echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> -mdev -s
> -
>  #
> -# We might have mounted something over /dev, see if /dev/initctl is there.
> +# Run the mdev daemon
>  #
> -if test ! -p /dev/initctl
> -then
> -        rm -f /dev/initctl
> -        mknod -m 600 /dev/initctl p
> -fi
> +
> +DAEMON="mdev"
> +PIDFILE="/var/run/$DAEMON.pid"
> +
> +
> +start() {
> +  echo -n "Starting $DAEMON... "
> +  start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df

Where do these start-stop-daemon options come from? Using -b for an
application which is designed to run as a daemon (and deliberately
telling that app to run in the foreground) looks odd, etc.

Are there bugs or limitations in mdev which you are trying to workaround?

> +  [ $? -eq 0 ] && echo "OK" || echo "ERROR"
> +
> +  # coldplug modules
> +  find /sys/ -name modalias -print0 | \
> +    xargs -0 sort -u | \
> +    tr '\n' '\0' | \
> +    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|stop|restart)
> +  "$1"
> +  ;;
> +  *)
> +  echo "Usage: $0 {start|stop|restart}"
> +  exit 1
> +esac
> +
> +exit $?
>
> --
> 2.29.2
>
>
> 
>

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

* Re: [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision
  2020-12-17 23:53   ` Khem Raj
@ 2020-12-18  0:02     ` Andre McCurdy
  2020-12-18  3:53       ` Khem Raj
  0 siblings, 1 reply; 18+ messages in thread
From: Andre McCurdy @ 2020-12-18  0:02 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 3:54 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Thu, Dec 17, 2020 at 3:51 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> >
> > On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > > Helps to execute it with busybox shell
> >
> > How does it help? Adding quotes would help if $rootcheck is an empty
> > string, but that's not specific to busybox.
> >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > ---
> > >  meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > > index 02f0351fcb..a63e71b780 100755
> > > --- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > > +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > > @@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap"
> > >  #
> > >  # Check the root filesystem.
> > >  #
> > > -if test -f /fastboot || test $rootcheck = no
> > > +if test -f /fastboot || test "$rootcheck" = "no"
> > >  then
> > >    test $rootcheck = yes && echo "Fast boot, no filesystem check"
> >
> > Doesn't this instance need to be quoted too?
>
> yes infact there are more cleanup to follow, this series just fixed
> default boot errors on reference images.

Adding quotes around a variable should probably be done consistently,
so maybe it makes sense to hold off on this one until you've finished
the cleanup?

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

* Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
  2020-12-17 23:59   ` [OE-core] " Andre McCurdy
@ 2020-12-18  2:45     ` Christopher Larson
  2020-12-18  3:52     ` Khem Raj
  1 sibling, 0 replies; 18+ messages in thread
From: Christopher Larson @ 2020-12-18  2:45 UTC (permalink / raw)
  To: Khem Raj, Andre McCurdy; +Cc: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 3826 bytes --]

Afaik, running a daemon in foreground mode and instructing start-stop-daemon to background it is common practice if the daemon doesn’t support writing a pidfile itself, so start-stop-daemon can handle it itself. Without using foregrounded process + -b, it wouldn’t know the resulting process id. If busybox mdev supports a pidfile, this wouldn’t be necessary.

--
Christopher “kergoth” Larson
chris_larson@mentor.com, chris.larson@siemens.com, kergoth@gmail.com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics, a Siemens Business
On Dec 17, 2020, 4:59 PM -0700, Andre McCurdy <armccurdy@gmail.com>, wrote:
> On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > When busybox is used for device management, kernel needs to support
> > older/obsolete mechanism via CONFIG_UEVENT_HELPER and
> > CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
> > would require kernel defconfig change and will always be needed when
> > mdev is used, intead run it in daemon mode
> >
> > Update mdev init script to run mdev in daemon mode
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> > meta/recipes-core/busybox/busybox/mdev.cfg | 2 +
> > meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++-------
> > 2 files changed, 41 insertions(+), 17 deletions(-)
> >
> > diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> > index 6aefe90e43..143e6097cb 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
> > +CONFIG_FEATURE_MDEV_DAEMON=y
> > diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> > index 8c9c06e96c..2fbdfb073e 100755
> > --- a/meta/recipes-core/busybox/files/mdev
> > +++ b/meta/recipes-core/busybox/files/mdev
> > @@ -1,21 +1,43 @@
> > #!/bin/sh
> > -mount -t proc proc /proc
> > -mount -t sysfs sysfs /sys
> > -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
> > -mkdir /dev/pts /dev/shm
> > -chmod 777 /dev/shm
> > -mount -t devpts devpts /dev/pts
> > -touch /dev/mdev.seq
> > -#sysctl -w kernel.hotplug=/sbin/mdev
> > -echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> > -mdev -s
> > -
> > #
> > -# We might have mounted something over /dev, see if /dev/initctl is there.
> > +# Run the mdev daemon
> > #
> > -if test ! -p /dev/initctl
> > -then
> > - rm -f /dev/initctl
> > - mknod -m 600 /dev/initctl p
> > -fi
> > +
> > +DAEMON="mdev"
> > +PIDFILE="/var/run/$DAEMON.pid"
> > +
> > +
> > +start() {
> > + echo -n "Starting $DAEMON... "
> > + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
>
> Where do these start-stop-daemon options come from? Using -b for an
> application which is designed to run as a daemon (and deliberately
> telling that app to run in the foreground) looks odd, etc.
>
> Are there bugs or limitations in mdev which you are trying to workaround?
>
> > + [ $? -eq 0 ] && echo "OK" || echo "ERROR"
> > +
> > + # coldplug modules
> > + find /sys/ -name modalias -print0 | \
> > + xargs -0 sort -u | \
> > + tr '\n' '\0' | \
> > + 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|stop|restart)
> > + "$1"
> > + ;;
> > + *)
> > + echo "Usage: $0 {start|stop|restart}"
> > + exit 1
> > +esac
> > +
> > +exit $?
> >
> > --
> > 2.29.2
> >
> >
> >
> >
>
>
> 
>

[-- Attachment #2: Type: text/html, Size: 4757 bytes --]

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

* Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
  2020-12-17 23:59   ` [OE-core] " Andre McCurdy
  2020-12-18  2:45     ` Christopher Larson
@ 2020-12-18  3:52     ` Khem Raj
  2020-12-18  6:07       ` Andre McCurdy
  1 sibling, 1 reply; 18+ messages in thread
From: Khem Raj @ 2020-12-18  3:52 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 3:59 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>
> On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > When busybox is used for device management, kernel needs to support
> > older/obsolete mechanism via CONFIG_UEVENT_HELPER and
> > CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
> > would require kernel defconfig change and will always be needed when
> > mdev is used, intead run it in daemon mode
> >
> > Update mdev init script to run mdev in daemon mode
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-core/busybox/busybox/mdev.cfg |  2 +
> >  meta/recipes-core/busybox/files/mdev       | 56 +++++++++++++++-------
> >  2 files changed, 41 insertions(+), 17 deletions(-)
> >
> > diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> > index 6aefe90e43..143e6097cb 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
> > +CONFIG_FEATURE_MDEV_DAEMON=y
> > diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> > index 8c9c06e96c..2fbdfb073e 100755
> > --- a/meta/recipes-core/busybox/files/mdev
> > +++ b/meta/recipes-core/busybox/files/mdev
> > @@ -1,21 +1,43 @@
> >  #!/bin/sh
> > -mount -t proc proc /proc
> > -mount -t sysfs sysfs /sys
> > -mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
> > -mkdir /dev/pts /dev/shm
> > -chmod 777 /dev/shm
> > -mount -t devpts devpts /dev/pts
> > -touch /dev/mdev.seq
> > -#sysctl -w kernel.hotplug=/sbin/mdev
> > -echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> > -mdev -s
> > -
> >  #
> > -# We might have mounted something over /dev, see if /dev/initctl is there.
> > +# Run the mdev daemon
> >  #
> > -if test ! -p /dev/initctl
> > -then
> > -        rm -f /dev/initctl
> > -        mknod -m 600 /dev/initctl p
> > -fi
> > +
> > +DAEMON="mdev"
> > +PIDFILE="/var/run/$DAEMON.pid"
> > +
> > +
> > +start() {
> > +  echo -n "Starting $DAEMON... "
> > +  start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
>
> Where do these start-stop-daemon options come from? Using -b for an
> application which is designed to run as a daemon (and deliberately
> telling that app to run in the foreground) looks odd, etc.
>
> Are there bugs or limitations in mdev which you are trying to workaround?
>

its using start-stop-daemon applet from busybox which does have these options
implemented, its so that start-stop-daemon takes the control of the daemon

> > +  [ $? -eq 0 ] && echo "OK" || echo "ERROR"
> > +
> > +  # coldplug modules
> > +  find /sys/ -name modalias -print0 | \
> > +    xargs -0 sort -u | \
> > +    tr '\n' '\0' | \
> > +    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|stop|restart)
> > +  "$1"
> > +  ;;
> > +  *)
> > +  echo "Usage: $0 {start|stop|restart}"
> > +  exit 1
> > +esac
> > +
> > +exit $?
> >
> > --
> > 2.29.2
> >
> >
> > 
> >

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

* Re: [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision
  2020-12-18  0:02     ` Andre McCurdy
@ 2020-12-18  3:53       ` Khem Raj
  0 siblings, 0 replies; 18+ messages in thread
From: Khem Raj @ 2020-12-18  3:53 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 4:02 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>
> On Thu, Dec 17, 2020 at 3:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > On Thu, Dec 17, 2020 at 3:51 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> > >
> > > On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> > > >
> > > > Helps to execute it with busybox shell
> > >
> > > How does it help? Adding quotes would help if $rootcheck is an empty
> > > string, but that's not specific to busybox.
> > >
> > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > ---
> > > >  meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > > > index 02f0351fcb..a63e71b780 100755
> > > > --- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > > > +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh
> > > > @@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap"
> > > >  #
> > > >  # Check the root filesystem.
> > > >  #
> > > > -if test -f /fastboot || test $rootcheck = no
> > > > +if test -f /fastboot || test "$rootcheck" = "no"
> > > >  then
> > > >    test $rootcheck = yes && echo "Fast boot, no filesystem check"
> > >
> > > Doesn't this instance need to be quoted too?
> >
> > yes infact there are more cleanup to follow, this series just fixed
> > default boot errors on reference images.
>
> Adding quotes around a variable should probably be done consistently,
> so maybe it makes sense to hold off on this one until you've finished
> the cleanup?

it doesn't matter, I would be creating per package patches.

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

* Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
  2020-12-18  3:52     ` Khem Raj
@ 2020-12-18  6:07       ` Andre McCurdy
  2020-12-18 16:33         ` Khem Raj
  0 siblings, 1 reply; 18+ messages in thread
From: Andre McCurdy @ 2020-12-18  6:07 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Thu, Dec 17, 2020 at 7:52 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Thu, Dec 17, 2020 at 3:59 PM Andre McCurdy <armccurdy@gmail.com> wrote:
> >
> > On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > > When busybox is used for device management, kernel needs to support
> > > older/obsolete mechanism via CONFIG_UEVENT_HELPER and
> > > CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
> > > would require kernel defconfig change and will always be needed when
> > > mdev is used, intead run it in daemon mode
> > >
> > > Update mdev init script to run mdev in daemon mode
> > >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > ---
> > >  meta/recipes-core/busybox/busybox/mdev.cfg |  2 +
> > >  meta/recipes-core/busybox/files/mdev       | 56 +++++++++++++++-------
> > >  2 files changed, 41 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
> > > index 6aefe90e43..143e6097cb 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
> > > +CONFIG_FEATURE_MDEV_DAEMON=y
> > > diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
> > > index 8c9c06e96c..2fbdfb073e 100755
> > > --- a/meta/recipes-core/busybox/files/mdev
> > > +++ b/meta/recipes-core/busybox/files/mdev
> > > @@ -1,21 +1,43 @@
> > >  #!/bin/sh
> > > -mount -t proc proc /proc
> > > -mount -t sysfs sysfs /sys
> > > -mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
> > > -mkdir /dev/pts /dev/shm
> > > -chmod 777 /dev/shm
> > > -mount -t devpts devpts /dev/pts
> > > -touch /dev/mdev.seq
> > > -#sysctl -w kernel.hotplug=/sbin/mdev
> > > -echo "/sbin/mdev" > /proc/sys/kernel/hotplug
> > > -mdev -s
> > > -
> > >  #
> > > -# We might have mounted something over /dev, see if /dev/initctl is there.
> > > +# Run the mdev daemon
> > >  #
> > > -if test ! -p /dev/initctl
> > > -then
> > > -        rm -f /dev/initctl
> > > -        mknod -m 600 /dev/initctl p
> > > -fi
> > > +
> > > +DAEMON="mdev"
> > > +PIDFILE="/var/run/$DAEMON.pid"
> > > +
> > > +
> > > +start() {
> > > +  echo -n "Starting $DAEMON... "
> > > +  start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
> >
> > Where do these start-stop-daemon options come from? Using -b for an
> > application which is designed to run as a daemon (and deliberately
> > telling that app to run in the foreground) looks odd, etc.
> >
> > Are there bugs or limitations in mdev which you are trying to workaround?
>
> its using start-stop-daemon applet from busybox which does have these options
> implemented, its so that start-stop-daemon takes the control of the daemon

The question is not whether start-stop-daemon supports using PID files
but whether the busybox mdev application supports creating them.

It looks like although most of the busybox daemons do, mdev does not:

.../busybox-1.32.0 $ grep -r write_pidfile *
debianutils/start_stop_daemon.c:        write_pidfile(pidfile);
include/libbb.h:void write_pidfile(const char *path) FAST_FUNC;
include/libbb.h:void write_pidfile_std_path_and_ext(const char *path) FAST_FUNC;
include/libbb.h:#define write_pidfile_std_path_and_ext(path)  ((void)0)
include/libbb.h:#define write_pidfile(path)  ((void)0)
libbb/pidfile.c:void FAST_FUNC write_pidfile(const char *path)
libbb/pidfile.c:void FAST_FUNC write_pidfile_std_path_and_ext(const char *name)
libbb/pidfile.c:    write_pidfile(buf);
miscutils/watchdog.c:    write_pidfile_std_path_and_ext("watchdog");
miscutils/crond.c:    write_pidfile_std_path_and_ext("crond");
networking/ifplugd.c:    write_pidfile(pidfile_name);
networking/ntpd.c:        write_pidfile_std_path_and_ext("ntpd");
networking/inetd.c:    write_pidfile_std_path_and_ext("inetd");
networking/udhcp/dhcpc.c:    write_pidfile(client_data.pidfile);
networking/udhcp/dhcpc.c:    write_pidfile(client_data.pidfile);
networking/udhcp/dhcpd.c:    write_pidfile(server_data.pidfile);
networking/udhcp/d6_dhcpc.c:    write_pidfile(client_data.pidfile);
networking/udhcp/d6_dhcpc.c:    write_pidfile(client_data.pidfile);
sysklogd/syslogd.c:    write_pidfile_std_path_and_ext("syslogd");
sysklogd/klogd.c:    write_pidfile_std_path_and_ext("klogd");
util-linux/acpid.c:    write_pidfile(opt_pidfile);

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

* Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
  2020-12-18  6:07       ` Andre McCurdy
@ 2020-12-18 16:33         ` Khem Raj
  0 siblings, 0 replies; 18+ messages in thread
From: Khem Raj @ 2020-12-18 16:33 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list



On 12/17/20 10:07 PM, Andre McCurdy wrote:
> On Thu, Dec 17, 2020 at 7:52 PM Khem Raj <raj.khem@gmail.com> wrote:
>>
>> On Thu, Dec 17, 2020 at 3:59 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>>>
>>> On Thu, Dec 17, 2020 at 2:54 PM Khem Raj <raj.khem@gmail.com> wrote:
>>>>
>>>> When busybox is used for device management, kernel needs to support
>>>> older/obsolete mechanism via CONFIG_UEVENT_HELPER and
>>>> CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this
>>>> would require kernel defconfig change and will always be needed when
>>>> mdev is used, intead run it in daemon mode
>>>>
>>>> Update mdev init script to run mdev in daemon mode
>>>>
>>>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>>>> ---
>>>>   meta/recipes-core/busybox/busybox/mdev.cfg |  2 +
>>>>   meta/recipes-core/busybox/files/mdev       | 56 +++++++++++++++-------
>>>>   2 files changed, 41 insertions(+), 17 deletions(-)
>>>>
>>>> diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
>>>> index 6aefe90e43..143e6097cb 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
>>>> +CONFIG_FEATURE_MDEV_DAEMON=y
>>>> diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
>>>> index 8c9c06e96c..2fbdfb073e 100755
>>>> --- a/meta/recipes-core/busybox/files/mdev
>>>> +++ b/meta/recipes-core/busybox/files/mdev
>>>> @@ -1,21 +1,43 @@
>>>>   #!/bin/sh
>>>> -mount -t proc proc /proc
>>>> -mount -t sysfs sysfs /sys
>>>> -mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
>>>> -mkdir /dev/pts /dev/shm
>>>> -chmod 777 /dev/shm
>>>> -mount -t devpts devpts /dev/pts
>>>> -touch /dev/mdev.seq
>>>> -#sysctl -w kernel.hotplug=/sbin/mdev
>>>> -echo "/sbin/mdev" > /proc/sys/kernel/hotplug
>>>> -mdev -s
>>>> -
>>>>   #
>>>> -# We might have mounted something over /dev, see if /dev/initctl is there.
>>>> +# Run the mdev daemon
>>>>   #
>>>> -if test ! -p /dev/initctl
>>>> -then
>>>> -        rm -f /dev/initctl
>>>> -        mknod -m 600 /dev/initctl p
>>>> -fi
>>>> +
>>>> +DAEMON="mdev"
>>>> +PIDFILE="/var/run/$DAEMON.pid"
>>>> +
>>>> +
>>>> +start() {
>>>> +  echo -n "Starting $DAEMON... "
>>>> +  start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
>>>
>>> Where do these start-stop-daemon options come from? Using -b for an
>>> application which is designed to run as a daemon (and deliberately
>>> telling that app to run in the foreground) looks odd, etc.
>>>
>>> Are there bugs or limitations in mdev which you are trying to workaround?
>>
>> its using start-stop-daemon applet from busybox which does have these options
>> implemented, its so that start-stop-daemon takes the control of the daemon
> 
> The question is not whether start-stop-daemon supports using PID files
> but whether the busybox mdev application supports creating them.
> 
> It looks like although most of the busybox daemons do, mdev does not:
> 

right it does not, letting start-stop-daemon works well though and is 
used in lot of places

> .../busybox-1.32.0 $ grep -r write_pidfile *
> debianutils/start_stop_daemon.c:        write_pidfile(pidfile);
> include/libbb.h:void write_pidfile(const char *path) FAST_FUNC;
> include/libbb.h:void write_pidfile_std_path_and_ext(const char *path) FAST_FUNC;
> include/libbb.h:#define write_pidfile_std_path_and_ext(path)  ((void)0)
> include/libbb.h:#define write_pidfile(path)  ((void)0)
> libbb/pidfile.c:void FAST_FUNC write_pidfile(const char *path)
> libbb/pidfile.c:void FAST_FUNC write_pidfile_std_path_and_ext(const char *name)
> libbb/pidfile.c:    write_pidfile(buf);
> miscutils/watchdog.c:    write_pidfile_std_path_and_ext("watchdog");
> miscutils/crond.c:    write_pidfile_std_path_and_ext("crond");
> networking/ifplugd.c:    write_pidfile(pidfile_name);
> networking/ntpd.c:        write_pidfile_std_path_and_ext("ntpd");
> networking/inetd.c:    write_pidfile_std_path_and_ext("inetd");
> networking/udhcp/dhcpc.c:    write_pidfile(client_data.pidfile);
> networking/udhcp/dhcpc.c:    write_pidfile(client_data.pidfile);
> networking/udhcp/dhcpd.c:    write_pidfile(server_data.pidfile);
> networking/udhcp/d6_dhcpc.c:    write_pidfile(client_data.pidfile);
> networking/udhcp/d6_dhcpc.c:    write_pidfile(client_data.pidfile);
> sysklogd/syslogd.c:    write_pidfile_std_path_and_ext("syslogd");
> sysklogd/klogd.c:    write_pidfile_std_path_and_ext("klogd");
> util-linux/acpid.c:    write_pidfile(opt_pidfile);
> 

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

* Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
  2020-12-17 22:54 ` [PATCH 4/4] initscripts: Use initctl on sysvinit only Khem Raj
@ 2020-12-18 18:29   ` Sinan Kaya
  2020-12-18 18:46     ` Khem Raj
  2020-12-18 18:49   ` Peter Kjellerstedt
  1 sibling, 1 reply; 18+ messages in thread
From: Sinan Kaya @ 2020-12-18 18:29 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

On 12/17/2020 5:54 PM, Khem Raj wrote:
> +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; then

Can this be done at build time for targets using sysvinit only?

> +    # Create new control channel
> +		rm -f "$INITCTL"
> +		mknod -m 600 "$INITCTL" p
> +
> +		# Reopen control channel.
> +		PID="$(pidof -s /sbin/init || echo 1)"
> +		[ -n "$PID" ] && kill -s USR1 "$PID"
>  fi
> -kill -USR1 1


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

* Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
  2020-12-18 18:29   ` [OE-core] " Sinan Kaya
@ 2020-12-18 18:46     ` Khem Raj
  2020-12-18 19:18       ` Sinan Kaya
  0 siblings, 1 reply; 18+ messages in thread
From: Khem Raj @ 2020-12-18 18:46 UTC (permalink / raw)
  To: Sinan Kaya; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

On Fri, Dec 18, 2020 at 10:29 AM Sinan Kaya <okaya@kernel.org> wrote:

> On 12/17/2020 5:54 PM, Khem Raj wrote:
> > +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" =
> "/sbin/init.sysvinit" ]; then
>
> Can this be done at build time for targets using sysvinit only?
>

Yes however It will be lot more obscure
Hard to read and harder to maintain

>
> > +    # Create new control channel
> > +             rm -f "$INITCTL"
> > +             mknod -m 600 "$INITCTL" p
> > +
> > +             # Reopen control channel.
> > +             PID="$(pidof -s /sbin/init || echo 1)"
> > +             [ -n "$PID" ] && kill -s USR1 "$PID"
> >  fi
> > -kill -USR1 1
>
>

[-- Attachment #2: Type: text/html, Size: 1333 bytes --]

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

* Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
  2020-12-17 22:54 ` [PATCH 4/4] initscripts: Use initctl on sysvinit only Khem Raj
  2020-12-18 18:29   ` [OE-core] " Sinan Kaya
@ 2020-12-18 18:49   ` Peter Kjellerstedt
  1 sibling, 0 replies; 18+ messages in thread
From: Peter Kjellerstedt @ 2020-12-18 18:49 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-
> core@lists.openembedded.org> On Behalf Of Khem Raj
> Sent: den 17 december 2020 23:55
> To: openembedded-core@lists.openembedded.org
> Cc: Khem Raj <raj.khem@gmail.com>
> Subject: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
> 
> Check if init system is sysvinit to recreate initctl, this ensures that
> it can be used with busybox init system as well
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  .../initscripts/initscripts-1.0/mountall.sh   | 22 ++++++++++++-------
>  1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
> index c719be5d9a..ead4dba46d 100755
> --- a/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
> +++ b/meta/recipes-core/initscripts/initscripts-1.0/mountall.sh
> @@ -19,15 +19,21 @@
>  test "$VERBOSE" != no && echo "Mounting local filesystems..."
>  mount -at nonfs,nosmbfs,noncpfs 2>/dev/null
> 
> -#
> -# We might have mounted something over /dev, see if /dev/initctl is there.
> -#
> -if test ! -p /dev/initctl
> -then
> -	rm -f /dev/initctl
> -	mknod -m 600 /dev/initctl p
> +
> +# We might have mounted something over /run; see if
> +# /dev/initctl is present.  Look for
> +# /sbin/init.sysvinit to verify that sysvinit (and
> +# not busybox or systemd) is installed as default init).
> +INITCTL="/dev/initctl"
> +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; then
> +    # Create new control channel
> +		rm -f "$INITCTL"
> +		mknod -m 600 "$INITCTL" p
> +
> +		# Reopen control channel.
> +		PID="$(pidof -s /sbin/init || echo 1)"
> +		[ -n "$PID" ] && kill -s USR1 "$PID"

Change all references for "/sbin" to "${base_sbindir}" to make it correct 
if usrmerge is used.

>  fi
> -kill -USR1 1
> 
>  #
>  # Execute swapon command again, in case we want to swap to
> --
> 2.29.2

//Peter


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

* Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
  2020-12-18 18:46     ` Khem Raj
@ 2020-12-18 19:18       ` Sinan Kaya
  2020-12-19  1:56         ` Khem Raj
  0 siblings, 1 reply; 18+ messages in thread
From: Sinan Kaya @ 2020-12-18 19:18 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

On 12/18/2020 1:46 PM, Khem Raj wrote:
> On Fri, Dec 18, 2020 at 10:29 AM Sinan Kaya <okaya@kernel.org
> <mailto:okaya@kernel.org>> wrote:
> 
>     On 12/17/2020 5:54 PM, Khem Raj wrote:
>     > +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" =
>     "/sbin/init.sysvinit" ]; then
> 
>     Can this be done at build time for targets using sysvinit only?
> 
> 
> Yes however It will be lot more obscure 
> Hard to read and harder to maintain 

I see your point. I think having a flag in the /etc/default/rcS file and
using that for comparison seems more plausible here as opposed to
init.sysvinit check. (this looked very fragile to me for some reason)

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

* Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
  2020-12-18 19:18       ` Sinan Kaya
@ 2020-12-19  1:56         ` Khem Raj
  0 siblings, 0 replies; 18+ messages in thread
From: Khem Raj @ 2020-12-19  1:56 UTC (permalink / raw)
  To: Sinan Kaya; +Cc: Patches and discussions about the oe-core layer

On Fri, Dec 18, 2020 at 11:18 AM Sinan Kaya <okaya@kernel.org> wrote:
>
> On 12/18/2020 1:46 PM, Khem Raj wrote:
> > On Fri, Dec 18, 2020 at 10:29 AM Sinan Kaya <okaya@kernel.org
> > <mailto:okaya@kernel.org>> wrote:
> >
> >     On 12/17/2020 5:54 PM, Khem Raj wrote:
> >     > +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" =
> >     "/sbin/init.sysvinit" ]; then
> >
> >     Can this be done at build time for targets using sysvinit only?
> >
> >
> > Yes however It will be lot more obscure
> > Hard to read and harder to maintain
>
> I see your point. I think having a flag in the /etc/default/rcS file and
> using that for comparison seems more plausible here as opposed to
> init.sysvinit check. (this looked very fragile to me for some reason)

that sounds reasonable I will send a revised patch for this

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

end of thread, other threads:[~2020-12-19  1:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 22:54 [PATCH 1/4] initscripts: use quotes for shell variable comparision Khem Raj
2020-12-17 22:54 ` [PATCH 2/4] busybox: Install /etc/default/rcS when used as init system Khem Raj
2020-12-17 22:54 ` [PATCH 3/4] busybox: Run mdev as daemon Khem Raj
2020-12-17 23:59   ` [OE-core] " Andre McCurdy
2020-12-18  2:45     ` Christopher Larson
2020-12-18  3:52     ` Khem Raj
2020-12-18  6:07       ` Andre McCurdy
2020-12-18 16:33         ` Khem Raj
2020-12-17 22:54 ` [PATCH 4/4] initscripts: Use initctl on sysvinit only Khem Raj
2020-12-18 18:29   ` [OE-core] " Sinan Kaya
2020-12-18 18:46     ` Khem Raj
2020-12-18 19:18       ` Sinan Kaya
2020-12-19  1:56         ` Khem Raj
2020-12-18 18:49   ` Peter Kjellerstedt
2020-12-17 23:51 ` [OE-core] [PATCH 1/4] initscripts: use quotes for shell variable comparision Andre McCurdy
2020-12-17 23:53   ` Khem Raj
2020-12-18  0:02     ` Andre McCurdy
2020-12-18  3:53       ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.