summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2012-01-31 17:38:56 +0000
committerKoen Kooi <koen@dominion.thruhere.net>2012-02-01 08:24:06 +0100
commit0d20039cfd748cb0d91d3f878f2256550c9feb3e (patch)
treef41366f3aeccb1c91478489b243cf1f11701aa92 /meta-oe
parentda3a1350d85db7dc33af15cd9cbccef28fbd1c91 (diff)
downloadmeta-openembedded-0d20039cfd748cb0d91d3f878f2256550c9feb3e.tar.gz
systemd-serialgetty: support machines without serial console
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-core/systemd/systemd-serialgetty.bb24
1 files changed, 16 insertions, 8 deletions
diff --git a/meta-oe/recipes-core/systemd/systemd-serialgetty.bb b/meta-oe/recipes-core/systemd/systemd-serialgetty.bb
index 2b88d0c88..5b903a08c 100644
--- a/meta-oe/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta-oe/recipes-core/systemd/systemd-serialgetty.bb
@@ -2,29 +2,37 @@ DESCRIPTION = "Systemd serial config"
2LICENSE = "GPLv2+" 2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe" 3LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe"
4 4
5PR = "r1" 5PR = "r2"
6 6
7SERIAL_CONSOLE ?= "115200 ttyS0" 7SERIAL_CONSOLE ?= "115200 ttyS0"
8 8
9SRC_URI = "file://LICENSE \ 9SRC_URI = "file://LICENSE \
10 file://serial-getty@.service" 10 file://serial-getty@.service"
11 11
12def get_baudrate(bb, d): 12def get_serial_console_value(d, index):
13 return bb.data.getVar('SERIAL_CONSOLE', d, 1).split()[0] 13 c = d.getVar('SERIAL_CONSOLE', True)
14 14
15def get_console(bb, d): 15 if len(c):
16 return bb.data.getVar('SERIAL_CONSOLE', d, 1).split()[1] 16 return c.split()[index]
17
18 return ""
19
20def get_baudrate(d):
21 return get_serial_console_value(d, 0)
22
23def get_console(d):
24 return get_serial_console_value(d, 1)
17 25
18do_install() { 26do_install() {
19 if [ ! ${@get_baudrate(bb, d)} = "" ]; then 27 if [ ! ${@get_baudrate(d)} = "" ]; then
20 sed -i -e s/\@BAUDRATE\@/${@get_baudrate(bb, d)}/g ${WORKDIR}/serial-getty@.service 28 sed -i -e s/\@BAUDRATE\@/${@get_baudrate(d)}/g ${WORKDIR}/serial-getty@.service
21 install -d ${D}${base_libdir}/systemd/system/ 29 install -d ${D}${base_libdir}/systemd/system/
22 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ 30 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
23 install ${WORKDIR}/serial-getty@.service ${D}${base_libdir}/systemd/system/ 31 install ${WORKDIR}/serial-getty@.service ${D}${base_libdir}/systemd/system/
24 32
25 # enable the service 33 # enable the service
26 ln -sf ${base_libdir}/systemd/system/serial-getty@.service \ 34 ln -sf ${base_libdir}/systemd/system/serial-getty@.service \
27 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(bb, d)}.service 35 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(d)}.service
28 fi 36 fi
29} 37}
30 38