diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2012-01-31 17:38:56 +0000 |
---|---|---|
committer | Koen Kooi <koen@dominion.thruhere.net> | 2012-02-01 08:24:06 +0100 |
commit | 0d20039cfd748cb0d91d3f878f2256550c9feb3e (patch) | |
tree | f41366f3aeccb1c91478489b243cf1f11701aa92 /meta-oe | |
parent | da3a1350d85db7dc33af15cd9cbccef28fbd1c91 (diff) | |
download | meta-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.bb | 24 |
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" | |||
2 | LICENSE = "GPLv2+" | 2 | LICENSE = "GPLv2+" |
3 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe" | 3 | LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe" |
4 | 4 | ||
5 | PR = "r1" | 5 | PR = "r2" |
6 | 6 | ||
7 | SERIAL_CONSOLE ?= "115200 ttyS0" | 7 | SERIAL_CONSOLE ?= "115200 ttyS0" |
8 | 8 | ||
9 | SRC_URI = "file://LICENSE \ | 9 | SRC_URI = "file://LICENSE \ |
10 | file://serial-getty@.service" | 10 | file://serial-getty@.service" |
11 | 11 | ||
12 | def get_baudrate(bb, d): | 12 | def 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 | ||
15 | def 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 | |||
20 | def get_baudrate(d): | ||
21 | return get_serial_console_value(d, 0) | ||
22 | |||
23 | def get_console(d): | ||
24 | return get_serial_console_value(d, 1) | ||
17 | 25 | ||
18 | do_install() { | 26 | do_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 | ||