summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-10-06 12:22:01 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-09 15:50:43 +0100
commit6c655441ff5cd0d8877891ff37f8cfa983363a2a (patch)
treebfdd1dba1754efe9b55e6c0744b343ca0620548b /meta/recipes-core
parent8e48297621311116d3edd7e3aa0de1b8ef2431b1 (diff)
downloadopenembedded-core-contrib-6c655441ff5cd0d8877891ff37f8cfa983363a2a.tar.gz
busybox: 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: 950ecaabc04836efc346be0ac7e0331e2378872b) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/busybox/busybox-inittab_1.36.1.bb46
1 files changed, 12 insertions, 34 deletions
diff --git a/meta/recipes-core/busybox/busybox-inittab_1.36.1.bb b/meta/recipes-core/busybox/busybox-inittab_1.36.1.bb
index 868d7a230f..462c9bb9c5 100644
--- a/meta/recipes-core/busybox/busybox-inittab_1.36.1.bb
+++ b/meta/recipes-core/busybox/busybox-inittab_1.36.1.bb
@@ -15,14 +15,17 @@ do_compile() {
do_install() {
install -d ${D}${sysconfdir}
install -D -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
- tmp="${SERIAL_CONSOLES}"
- [ -n "$tmp" ] && echo >> ${D}${sysconfdir}/inittab
- for i in $tmp
- do
- j=`echo ${i} | sed s/\;/\ /g`
- id=`echo ${i} | sed -e 's/^.*;//' -e 's/;.*//'`
- echo "$id::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
- done
+
+ CONSOLES="${SERIAL_CONSOLES}"
+ for s in $CONSOLES
+ do
+ speed=$(echo $s | cut -d\; -f 1)
+ device=$(echo $s | cut -d\; -f 2)
+ label=$(echo $device | sed -e 's/tty//' | tail --bytes=5)
+
+ echo "$label::respawn:${sbindir}/ttyrun $device ${base_bindir}/start_getty $speed $device vt102" >> ${D}${sysconfdir}/inittab
+ done
+
if [ "${USE_VT}" = "1" ]; then
cat <<EOF >>${D}${sysconfdir}/inittab
# ${base_sbindir}/getty invocations for the runlevels.
@@ -45,32 +48,6 @@ EOF
}
-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
-}
# SERIAL_CONSOLES is generally defined by the MACHINE .conf.
# Set PACKAGE_ARCH appropriately.
@@ -79,6 +56,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
FILES:${PN} = "${sysconfdir}/inittab"
CONFFILES:${PN} = "${sysconfdir}/inittab"
+RDEPENDS:${PN} = "ttyrun"
RCONFLICTS:${PN} = "sysvinit-inittab"
USE_VT ?= "1"