aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/runit/runit-serialgetty.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/runit/runit-serialgetty.bb')
-rw-r--r--meta/recipes-core/runit/runit-serialgetty.bb43
1 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-core/runit/runit-serialgetty.bb b/meta/recipes-core/runit/runit-serialgetty.bb
new file mode 100644
index 0000000000..cd9715bfc6
--- /dev/null
+++ b/meta/recipes-core/runit/runit-serialgetty.bb
@@ -0,0 +1,43 @@
+# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Serial terminal support for runit"
+
+SECTION = "base utils"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+SRC_URI = "\
+ file://run \
+ file://finish \
+"
+
+S = "${WORKDIR}"
+
+SERIAL_CONSOLES ?= "115200;ttyS0"
+
+do_install() {
+ install -d ${D}${sysconfdir}/service ${D}${sysconfdir}/runit/runsvdir/default
+ tmp="${SERIAL_CONSOLES}"
+ for i in $tmp
+ do
+ baudrate=`echo $i | sed 's/\;.*//'`
+ ttydev=`echo $i | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
+ install -d ${D}${sysconfdir}/sv/getty-${ttydev}
+ install -m 755 ${WORKDIR}/run ${D}${sysconfdir}/sv/getty-${ttydev}
+ install -m 755 ${WORKDIR}/finish ${D}${sysconfdir}/sv/getty-${ttydev}
+ sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${sysconfdir}/sv/getty-${ttydev}/run
+ sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${sysconfdir}/sv/getty-${ttydev}/finish
+ sed -i -e s/\@TTY\@/$ttydev/g ${D}${sysconfdir}/sv/getty-${ttydev}/run
+ sed -i -e s/\@TTY\@/$ttydev/g ${D}${sysconfdir}/sv/getty-${ttydev}/finish
+ ln -s ${localstatedir}/run/sv.getty-${ttydev} ${D}${sysconfdir}/sv/getty-${ttydev}/supervise
+ ln -s ${sysconfdir}/sv/getty-${ttydev} ${D}${sysconfdir}/service/getty-${ttydev}
+ ln -s ${sysconfdir}/sv/getty-${ttydev} ${D}${sysconfdir}/runit/runsvdir/default/getty-${ttydev}
+ done
+}
+# Since SERIAL_CONSOLES is likely to be set from the machine configuration
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+FILES_${PN} = "${sysconfdir}"