1SUMMARY = "Serial terminal support for systemd" 2HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/" 3LICENSE = "GPL-2.0-or-later" 4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" 5 6PR = "r5" 7 8SERIAL_CONSOLES ?= "115200;ttyS0" 9SERIAL_TERM ?= "linux" 10 11SRC_URI = "file://serial-getty@.service" 12 13S = "${WORKDIR}" 14 15# As this package is tied to systemd, only build it when we're also building systemd. 16inherit features_check 17REQUIRED_DISTRO_FEATURES = "systemd" 18 19do_install() { 20 if [ ! -z "${SERIAL_CONSOLES}" ] ; then 21 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` 22 install -d ${D}${systemd_system_unitdir}/ 23 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ 24 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/ 25 sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service 26 sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service 27 28 tmp="${SERIAL_CONSOLES}" 29 for entry in $tmp ; do 30 baudrate=`echo $entry | sed 's/\;.*//'` 31 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` 32 if [ "$baudrate" = "$default_baudrate" ] ; then 33 # enable the service 34 ln -sf ${systemd_system_unitdir}/serial-getty@.service \ 35 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service 36 else 37 # install custom service file for the non-default baudrate 38 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service 39 sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service 40 # enable the service 41 ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \ 42 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service 43 fi 44 done 45 fi 46} 47 48# This is a machine specific file 49FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}" 50PACKAGE_ARCH = "${MACHINE_ARCH}" 51 52ALLOW_EMPTY:${PN} = "1" 53