diff options
author | Ross Burton <ross.burton@arm.com> | 2023-10-06 12:22:01 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-09 15:51:13 +0100 |
commit | cedd01f57ec3ffd4b543cae819e7cde28915b164 (patch) | |
tree | a34de53f2c6f8c2331b4bb12cccbace81dff8eb3 /meta/recipes-core | |
parent | 42d35e89a343eb28d85f8c4ab4da486bed8ae160 (diff) | |
download | poky-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>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/busybox/busybox-inittab_1.36.1.bb | 46 |
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() { | |||
15 | do_install() { | 15 | do_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 | ||
48 | pkg_postinst:${PN} () { | ||
49 | # run this on host and on target | ||
50 | if [ "${SERIAL_CONSOLES_CHECK}" = "" ]; then | ||
51 | exit 0 | ||
52 | fi | ||
53 | } | ||
54 | |||
55 | pkg_postinst_ontarget:${PN} () { | ||
56 | # run this on the target | ||
57 | if [ -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 | ||
70 | else | ||
71 | exit 1 | ||
72 | fi | ||
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}" | |||
79 | FILES:${PN} = "${sysconfdir}/inittab" | 56 | FILES:${PN} = "${sysconfdir}/inittab" |
80 | CONFFILES:${PN} = "${sysconfdir}/inittab" | 57 | CONFFILES:${PN} = "${sysconfdir}/inittab" |
81 | 58 | ||
59 | RDEPENDS:${PN} = "ttyrun" | ||
82 | RCONFLICTS:${PN} = "sysvinit-inittab" | 60 | RCONFLICTS:${PN} = "sysvinit-inittab" |
83 | 61 | ||
84 | USE_VT ?= "1" | 62 | USE_VT ?= "1" |