mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-09-15 02:54:03 +00:00
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>
This commit is contained in:
parent
da3a1350d8
commit
0d20039cfd
@ -2,29 +2,37 @@ DESCRIPTION = "Systemd serial config"
|
|||||||
LICENSE = "GPLv2+"
|
LICENSE = "GPLv2+"
|
||||||
LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe"
|
LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=751419260aa954499f7abaabaa882bbe"
|
||||||
|
|
||||||
PR = "r1"
|
PR = "r2"
|
||||||
|
|
||||||
SERIAL_CONSOLE ?= "115200 ttyS0"
|
SERIAL_CONSOLE ?= "115200 ttyS0"
|
||||||
|
|
||||||
SRC_URI = "file://LICENSE \
|
SRC_URI = "file://LICENSE \
|
||||||
file://serial-getty@.service"
|
file://serial-getty@.service"
|
||||||
|
|
||||||
def get_baudrate(bb, d):
|
def get_serial_console_value(d, index):
|
||||||
return bb.data.getVar('SERIAL_CONSOLE', d, 1).split()[0]
|
c = d.getVar('SERIAL_CONSOLE', True)
|
||||||
|
|
||||||
def get_console(bb, d):
|
if len(c):
|
||||||
return bb.data.getVar('SERIAL_CONSOLE', d, 1).split()[1]
|
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() {
|
do_install() {
|
||||||
if [ ! ${@get_baudrate(bb, d)} = "" ]; then
|
if [ ! ${@get_baudrate(d)} = "" ]; then
|
||||||
sed -i -e s/\@BAUDRATE\@/${@get_baudrate(bb, d)}/g ${WORKDIR}/serial-getty@.service
|
sed -i -e s/\@BAUDRATE\@/${@get_baudrate(d)}/g ${WORKDIR}/serial-getty@.service
|
||||||
install -d ${D}${base_libdir}/systemd/system/
|
install -d ${D}${base_libdir}/systemd/system/
|
||||||
install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
|
install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
|
||||||
install ${WORKDIR}/serial-getty@.service ${D}${base_libdir}/systemd/system/
|
install ${WORKDIR}/serial-getty@.service ${D}${base_libdir}/systemd/system/
|
||||||
|
|
||||||
# enable the service
|
# enable the service
|
||||||
ln -sf ${base_libdir}/systemd/system/serial-getty@.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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user