summaryrefslogtreecommitdiffstats
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:51:13 +0100
commitcedd01f57ec3ffd4b543cae819e7cde28915b164 (patch)
treea34de53f2c6f8c2331b4bb12cccbace81dff8eb3
parent42d35e89a343eb28d85f8c4ab4da486bed8ae160 (diff)
downloadpoky-cedd01f57ec3ffd4b543cae819e7cde28915b164.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) (From OE-Core rev: 6c655441ff5cd0d8877891ff37f8cfa983363a2a) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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() {
15do_install() { 15do_install() {
16 install -d ${D}${sysconfdir} 16 install -d ${D}${sysconfdir}
17 install -D -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab 17 install -D -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
18 tmp="${SERIAL_CONSOLES}" 18
19 [ -n "$tmp" ] && echo >> ${D}${sysconfdir}/inittab 19 CONSOLES="${SERIAL_CONSOLES}"
20 for i in $tmp 20 for s in $CONSOLES
21 do 21 do
22 j=`echo ${i} | sed s/\;/\ /g` 22 speed=$(echo $s | cut -d\; -f 1)
23 id=`echo ${i} | sed -e 's/^.*;//' -e 's/;.*//'` 23 device=$(echo $s | cut -d\; -f 2)
24 echo "$id::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab 24 label=$(echo $device | sed -e 's/tty//' | tail --bytes=5)
25 done 25
26 echo "$label::respawn:${sbindir}/ttyrun $device ${base_bindir}/start_getty $speed $device vt102" >> ${D}${sysconfdir}/inittab
27 done
28
26 if [ "${USE_VT}" = "1" ]; then 29 if [ "${USE_VT}" = "1" ]; then
27 cat <<EOF >>${D}${sysconfdir}/inittab 30 cat <<EOF >>${D}${sysconfdir}/inittab
28# ${base_sbindir}/getty invocations for the runlevels. 31# ${base_sbindir}/getty invocations for the runlevels.
@@ -45,32 +48,6 @@ EOF
45 48
46} 49}
47 50
48pkg_postinst:${PN} () {
49# run this on host and on target
50if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then
51 exit 0
52fi
53}
54
55pkg_postinst_ontarget:${PN} () {
56# run this on the target
57if [ -e /proc/consoles ]; then
58 tmp="${SERIAL_CONSOLES_CHECK}"
59 for i in $tmp
60 do
61 j=`echo ${i} | sed -e s/^.*\;//g -e s/\:.*//g`
62 k=`echo ${i} | sed s/^.*\://g`
63 if [ -z "`grep ${j} /proc/consoles`" ]; then
64 if [ -z "${k}" ] || [ -z "`grep ${k} /proc/consoles`" ] || [ ! -e /dev/${j} ]; then
65 sed -i -e /^.*${j}\ /d -e /^.*${j}$/d /etc/inittab
66 fi
67 fi
68 done
69 kill -HUP 1
70else
71 exit 1
72fi
73}
74 51
75# SERIAL_CONSOLES is generally defined by the MACHINE .conf. 52# SERIAL_CONSOLES is generally defined by the MACHINE .conf.
76# Set PACKAGE_ARCH appropriately. 53# Set PACKAGE_ARCH appropriately.
@@ -79,6 +56,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
79FILES:${PN} = "${sysconfdir}/inittab" 56FILES:${PN} = "${sysconfdir}/inittab"
80CONFFILES:${PN} = "${sysconfdir}/inittab" 57CONFFILES:${PN} = "${sysconfdir}/inittab"
81 58
59RDEPENDS:${PN} = "ttyrun"
82RCONFLICTS:${PN} = "sysvinit-inittab" 60RCONFLICTS:${PN} = "sysvinit-inittab"
83 61
84USE_VT ?= "1" 62USE_VT ?= "1"