summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/busybox
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-12-13 22:01:26 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-18 22:52:13 +0000
commit7dddda7a00108f9a61da4a869514a32b9f42d16a (patch)
tree1d436ec92a999e81a58f5067555597532ec93123 /meta/recipes-core/busybox
parent8a6559f1561ca6b7719bb46fc446db46d8086ea3 (diff)
downloadopenembedded-core-7dddda7a00108f9a61da4a869514a32b9f42d16a.tar.gz
busybox-inittab: Implement SYSVINIT_ENABLED_GETTYS and USE_VT
This ensures that busybox init can generate matching tty's in inittab as system defines, secondly resepcts USE_VT for creating virtual ttys Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/busybox')
-rw-r--r--meta/recipes-core/busybox/busybox-inittab_1.32.0.bb50
1 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb b/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb
index 61fb8cbad1..8d0f419f4d 100644
--- a/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb
+++ b/meta/recipes-core/busybox/busybox-inittab_1.32.0.bb
@@ -23,6 +23,53 @@ do_install() {
id=`echo ${i} | sed -e 's/^.*;//' -e 's/;.*//'`
echo "$id::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
done
+ if [ "${USE_VT}" = "1" ]; then
+ cat <<EOF >>${D}${sysconfdir}/inittab
+# ${base_sbindir}/getty invocations for the runlevels.
+#
+# The "id" field MUST be the same as the last
+# characters of the device (after "tty").
+#
+# Format:
+# <id>:<runlevels>:<action>:<process>
+#
+
+EOF
+
+ for n in ${SYSVINIT_ENABLED_GETTYS}
+ do
+ echo "tty$n:12345:respawn:${base_sbindir}/getty 38400 tty$n" >> ${D}${sysconfdir}/inittab
+ done
+ echo "" >> ${D}${sysconfdir}/inittab
+ 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
}
# SERIAL_CONSOLES is generally defined by the MACHINE .conf.
@@ -33,3 +80,6 @@ FILES_${PN} = "${sysconfdir}/inittab"
CONFFILES_${PN} = "${sysconfdir}/inittab"
RCONFLICTS_${PN} = "sysvinit-inittab"
+
+USE_VT ?= "1"
+SYSVINIT_ENABLED_GETTYS ?= "1"