aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb45
1 files changed, 23 insertions, 22 deletions
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index 96cbf31470..37c49b12d7 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -8,37 +8,38 @@ SERIAL_CONSOLE ?= "115200 ttyS0"
SRC_URI = "file://serial-getty@.service"
-def get_serial_console_value(d, index):
- c = d.getVar('SERIAL_CONSOLE', True)
-
- 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(d)} = "" ]; then
- sed -i -e s/\@BAUDRATE\@/${@get_baudrate(d)}/g ${WORKDIR}/serial-getty@.service
+ if [ ! -z "${SERIAL_CONSOLES}" ] ; then
+ default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
install -d ${D}${systemd_unitdir}/system/
install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
- install ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
-
- # enable the service
- ln -sf ${systemd_unitdir}/system/serial-getty@.service \
- ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@${@get_console(d)}.service
+ install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/
+ sed -i -e s/\@BAUDRATE\@/$default_baudrate/g ${D}${systemd_unitdir}/system/serial-getty@.service
+
+ tmp="${SERIAL_CONSOLES}"
+ for entry in $tmp ; do
+ baudrate=`echo $entry | sed 's/\;.*//'`
+ ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
+ if [ "$baudrate" = "$default_baudrate" ] ; then
+ # enable the service
+ ln -sf ${systemd_unitdir}/system/serial-getty@.service \
+ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
+ else
+ # install custom service file for the non-default baudrate
+ install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
+ sed -i -e s/\@BAUDRATE\@/$baudrate/g ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service
+ # enable the service
+ ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \
+ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
+ fi
+ done
fi
}
RDEPENDS_${PN} = "systemd"
# This is a machine specific file
-FILES_${PN} = "${systemd_unitdir}/system/serial-getty@.service ${sysconfdir}"
+FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
# As this package is tied to systemd, only build it when we're also building systemd.