[OE-core] [PATCH] sysvinit-inittab: Add wrapper script to verify console exists

Saul Wold sgw at linux.intel.com
Tue Nov 24 21:33:02 UTC 2015


Add a wrapper script around getty to check if a given console exists, this
allows for multiple Console ttys to be specified for various boards without
having additional BSP types just for different console types.

[YOCTO #8689]

Signed-off-by: Saul Wold <sgw at linux.intel.com>
---
 meta/recipes-core/sysvinit/sysvinit-inittab/start_getty |  5 +++++
 meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb  | 11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 meta/recipes-core/sysvinit/sysvinit-inittab/start_getty

diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
new file mode 100644
index 0000000..6eaeb7a
--- /dev/null
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty
@@ -0,0 +1,5 @@
+#!/bin/sh
+if [ -c /dev/$2 ]
+then 
+	/sbin/getty -L $1 $2
+fi
diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index 49b1326..f539da8 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -4,7 +4,8 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=80
 
 PR = "r10"
 
-SRC_URI = "file://inittab"
+SRC_URI = "file://inittab \
+           file://start_getty"
 
 S = "${WORKDIR}"
 
@@ -15,8 +16,10 @@ do_compile() {
 }
 
 do_install() {
-	install -d ${D}${sysconfdir}
+    install -d ${D}${sysconfdir}
+    install -d ${D}${sysconfdir}/init.d
     install -m 0644 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
+    install -m 0755 ${WORKDIR}/start_getty ${D}${sysconfdir}/init.d/start_getty
 
     set -x
     tmp="${SERIAL_CONSOLES}"
@@ -24,7 +27,7 @@ do_install() {
     do
 	j=`echo ${i} | sed s/\;/\ /g`
 	label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
-	echo "$label:12345:respawn:${base_sbindir}/getty -L ${j}" >> ${D}${sysconfdir}/inittab
+	echo "$label:12345:respawn:${sysconfdir}/init.d/start_getty ${j}" >> ${D}${sysconfdir}/inittab
     done
 
     if [ "${USE_VT}" = "1" ]; then
@@ -73,7 +76,7 @@ fi
 # Set PACKAGE_ARCH appropriately.
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-FILES_${PN} = "${sysconfdir}/inittab"
+FILES_${PN} = "${sysconfdir}/inittab ${sysconfdir}/init.d/start_getty"
 CONFFILES_${PN} = "${sysconfdir}/inittab"
 
 USE_VT ?= "1"
-- 
2.1.4




More information about the Openembedded-core mailing list