mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-05 02:50:46 +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:
committed by
Koen Kooi
parent
da3a1350d8
commit
0d20039cfd
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user