Skip to contentSkip to conversation

rcS: Define identifier for init system used

PATCH In review Khem Raj 2 participants 4 messages Dec 19, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 rcS: Define identifier for init system used

This will help in defining init system specific portions of initscripts which are shared

---
 meta/recipes-core/busybox/files/rcS.default     | 3 ++-
 meta/recipes-core/sysvinit/sysvinit/rcS-default | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/busybox/files/rcS.default +2 -1
index 262cad7d2a..66513daf2d 100644
@@ -1 +1,2 @@
-# SULOGIN = "yes"
+# Indicate init system type
+INIT_SYSTEM=busybox
meta/recipes-core/sysvinit/sysvinit/rcS-default +3 -0
index 709cdf6ec5..e608a77c75 100644
@@ -27,3 +27,6 @@ VOLATILE_ENABLE_CACHE=yes
 # Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
 # Normally you should not change this value.
 ROOTFS_READ_ONLY=no
+# rcS is also used when using busybox init and shares initscripts, some initscripts
+# need to have specific behavior depending on init system
+INIT_SYSTEM=sysvinit
Signature · 1 line
2.29.2
author
#1 lore raw

PATCH v2 2/3 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

---
v2: Use INIT_SYSTEM to identify init system

 .../initscripts/initscripts-1.0/mountall.sh   | 22 ++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +14 -8
index c719be5d9a..2839d57cbe 100755
@@ -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" ] && [ "${INIT_SYSTEM}" = "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
Signature · 1 line
2.29.2
author
#2 lore raw

PATCH 3/3 busybox: Sync rcS.default with sysvinit

In reply to Khem Raj
---
 meta/recipes-core/busybox/files/rcS.default | 29 +++++++++++++++++++++
 1 file changed, 29 insertions(+)
meta/recipes-core/busybox/files/rcS.default +29 -0
index 66513daf2d..44c9747e34 100644
@@ -1,2 +1,31 @@
+#
+#	Defaults for the boot scripts in /etc/rcS.d
+#
+
+# Time files in /tmp are kept in days.
+TMPTIME=0
+# Set to yes if you want sulogin to be spawned on bootup
+SULOGIN=no
+# Set to no if you want to be able to login over telnet/rlogin
+# before system startup is complete (as soon as inetd is started)
+DELAYLOGIN=no
+# Assume that the BIOS clock is set to UTC time (recommended)
+UTC=yes
+# Set VERBOSE to "no" if you would like a more quiet bootup.
+VERBOSE=no
+# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically
+EDITMOTD=no
+# Whether to fsck root on boot
+ENABLE_ROOTFS_FSCK=no
+# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
+FSCKFIX=yes
+# Set TICKADJ to the correct tick value for this specific machine
+#TICKADJ=10000
+# Enable caching in populate-volatile.sh
+VOLATILE_ENABLE_CACHE=yes
+# Indicate whether the rootfs is intended to be read-only or not.
+# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
+# Normally you should not change this value.
+ROOTFS_READ_ONLY=no
 # Indicate init system type
 INIT_SYSTEM=busybox
Signature · 1 line
2.29.2