summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/sysvinit
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-10-06 12:22:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-09 15:50:43 +0100
commit8e48297621311116d3edd7e3aa0de1b8ef2431b1 (patch)
tree3b5a3d9b73d71c30ddbb683b5ca79fc81cfe4d72 /meta/recipes-core/sysvinit
parent41a8a2e0817c7f73d3a4514fd158141ee5627ad8 (diff)
downloadopenembedded-core-8e48297621311116d3edd7e3aa0de1b8ef2431b1.tar.gz
sysvinit-inittab: use ttyrun to run getty only if the terminal exists
Wrap calls to start_getty with ttyrun, so that getty isn't started if the device doesn't exist. As we know start_getty is only called when the device exists we can remove the partial workaround for this problem in that scripts too. This neatly obsoletes SERIAL_CONSOLES_CHECK, whose sole purpose was to check what terminals are present at boot and rewrite inittab. Notably, this meant that SERIAL_CONSOLES_CHECK made using a read-only rootfs impossible. (From OE-Core rev: f4fd17d5a5e4eaa31995d3ca52c871cfbdc0df68) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/sysvinit')
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab/start_getty11
-rw-r--r--meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb30
2 files changed, 7 insertions, 34 deletions
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
index f60409eae3..f5671ee53d 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -1,5 +1,9 @@
#!/bin/sh
+SPEED=$1
+DEVICE=$2
+TERM=$3
+
# busybox' getty does this itself, util-linux' agetty needs extra help
getty="/sbin/getty"
case $(readlink -f "${getty}") in
@@ -13,9 +17,4 @@ case $(readlink -f "${getty}") in
;;
esac
-if [ -e /sys/class/tty/$2 -a -c /dev/$2 ]; then
- ${setsid:-} ${getty} ${options:-} -L $1 $2 $3
-else
- # Prevent respawning to fast error if /dev entry does not exist
- sleep 1000
-fi
+${setsid:-} ${getty} ${options:-} -L $SPEED $DEVICE $TERM
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index e70dc705c0..6bbe517df1 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -28,7 +28,7 @@ do_install() {
device=$(echo $s | cut -d\; -f 2)
label=$(echo $device | sed -e 's/tty//' | tail --bytes=5)
- echo "$label:12345:respawn:${base_bindir}/start_getty $speed $device vt102" >> ${D}${sysconfdir}/inittab
+ echo "$label:12345:respawn:${sbindir}/ttyrun $device ${base_bindir}/start_getty $speed $device vt102" >> ${D}${sysconfdir}/inittab
done
if [ "${USE_VT}" = "1" ]; then
@@ -52,33 +52,6 @@ EOF
fi
}
-pkg_postinst:${PN} () {
-# run this on host and on target
-if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
- exit 0
-fi
-}
-
-pkg_postinst_ontarget:${PN} () {
-# run this on the target
-if [ -e /proc/consoles ]; then
- tmp="${SERIAL_CONSOLES_CHECK}"
- for i in $tmp
- do
- j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
- k=`echo ${i} | sed s/^.*\://g`
- if [ -z "`grep ${j} /proc/consoles`" ]; then
- if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
- sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
- fi
- fi
- done
- kill -HUP 1
-else
- exit 1
-fi
-}
-
# USE_VT and SERIAL_CONSOLES are generally defined by the MACHINE .conf.
# Set PACKAGE_ARCH appropriately.
PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -89,4 +62,5 @@ CONFFILES:${PN} = "${sysconfdir}/inittab"
USE_VT ?= "1"
SYSVINIT_ENABLED_GETTYS ?= "1"
+RDEPENDS:${PN} = "ttyrun"
RCONFLICTS:${PN} = "busybox-inittab"