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 | |
parent | da3a1350d85db7dc33af15cd9cbccef28fbd1c91 (diff) | |
download | meta-openembedded-contrib-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>
-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 2b88d0c880..5b903a08c0 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" LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe" -PR = "r1" +PR = "r2" SERIAL_CONSOLE ?= "115200 ttyS0" SRC_URI = "file://LICENSE \ file://serial-getty@.service" -def get_baudrate(bb, d): - return bb.data.getVar('SERIAL_CONSOLE', d, 1).split()[0] +def get_serial_console_value(d, index): + c = d.getVar('SERIAL_CONSOLE', True) -def get_console(bb, d): - return bb.data.getVar('SERIAL_CONSOLE', d, 1).split()[1] + if len(c): + return c.split()[index] + + return "" + +def get_baudrate(d): + return get_serial_console_value(d, 0) + +def get_console(d): + return get_serial_console_value(d, 1) do_install() { - if [ ! ${@get_baudrate(bb, d)} = "" ]; then - sed -i -e s/\@BAUDRATE\@/${@get_baudrate(bb, d)}/g ${WORKDIR}/serial-getty@.service + if [ ! ${@get_baudrate(d)} = "" ]; then + sed -i -e s/\@BAUDRATE\@/${@get_baudrate(d)}/g ${WORKDIR}/serial-getty@.service install -d ${D}${base_libdir}/systemd/system/ install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ install ${WORKDIR}/serial-getty@.service ${D}${base_libdir}/systemd/system/ # enable the service ln -sf ${base_libdir}/systemd/system/serial-getty@.service \ - ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(bb, d)}.service + ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(d)}.service fi } |