summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd-serialgetty.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd-serialgetty.bb')
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
new file mode 100644
index 0000000000..7e7368b875
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -0,0 +1,45 @@
1DESCRIPTION = "Systemd serial config"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
4
5PR = "r3"
6
7SERIAL_CONSOLE ?= "115200 ttyS0"
8
9SRC_URI = "file://serial-getty@.service"
10
11def get_serial_console_value(d, index):
12 c = d.getVar('SERIAL_CONSOLE', True)
13
14 if len(c):
15 return c.split()[index]
16
17 return ""
18
19def get_baudrate(d):
20 return get_serial_console_value(d, 0)
21
22def get_console(d):
23 return get_serial_console_value(d, 1)
24
25do_install() {
26 if [ ! ${@get_baudrate(d)} = "" ]; then
27 sed -i -e s/\@BAUDRATE\@/${@get_baudrate(d)}/g ${WORKDIR}/serial-getty@.service
28 install -d ${D}${systemd_unitdir}/system/
29 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
30 install ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
31
32 # enable the service
33 ln -sf ${systemd_unitdir}/system/serial-getty@.service \
34 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(d)}.service
35 fi
36}
37
38PACKAGES = "${PN} ${PN}-dbg ${PN}-dev ${PN}-doc"
39
40RRECOMMENDS_${PN} = ""
41RDEPENDS_${PN} = "systemd"
42
43# This is a machine specific file
44FILES_${PN} = "${systemd_unitdir}/system/serial-getty@.service ${sysconfdir}"
45PACKAGE_ARCH = "${MACHINE_ARCH}"