diff --git a/recipes-core/systemd/systemd-serialgetty.bbappend b/recipes-core/systemd/systemd-serialgetty.bbappend new file mode 100644 index 0000000..fdb94d8 --- /dev/null +++ b/recipes-core/systemd/systemd-serialgetty.bbappend @@ -0,0 +1,39 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append_smarcimx8mm2g = " \ + file://disable-serialgetty.sh \ + file://disable-serialgetty.service \ +" +FILES_${PN}_append_smarcimx8mm2g = " \ + /lib/systemd/system/* \ + /etc/systemd/system/* \ +" + +do_install_append_smarcimx8mm2g() { + install -d ${D}${systemd_unitdir}/system + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants + install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system + install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system + + ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \ + ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service +} + +SRC_URI_append_smarcimx8mm4g = " \ + file://disable-serialgetty.sh \ + file://disable-serialgetty.service \ +" +FILES_${PN}_append_smarcimx8mm4g = " \ + /lib/systemd/system/* \ + /etc/systemd/system/* \ +" + +do_install_append_smarcimx8mm4g() { + install -d ${D}${systemd_unitdir}/system + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants + install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system + install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system + + ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \ + ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service +} diff --git a/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service new file mode 100644 index 0000000..4c98261 --- /dev/null +++ b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service @@ -0,0 +1,11 @@ +[Unit] +Description=Disable redundant serial getty service +After=systemd-remount-fs.service +ConditionPathIsReadWrite=/etc + +[Service] +Type=oneshot +ExecStart=/lib/systemd/system/disable-serialgetty.sh + +[Install] +WantedBy=sysinit.target diff --git a/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh new file mode 100755 index 0000000..6dbc806 --- /dev/null +++ b/recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +UART0_SERVICE=serial-getty@ttymxc0.service +UART1_SERVICE=serial-getty@ttymxc1.service +UART2_SERVICE=serial-getty@ttymxc2.service +UART3_SERVICE=serial-getty@ttymxc3.service + +tty_service_enabled() +{ + test -f /etc/systemd/system/getty.target.wants/$1 +} + +if tty_service_enabled ${UART0_SERVICE}; then + systemctl stop ${UART0_SERVICE} + systemctl disable ${UART0_SERVICE} + systemctl enable ${UART1_SERVICE} +fi + + +