Commit 752165840c601470ecb93abd155117ebe7caf7b6

Authored by Eric Lee
1 parent 1296777faf

Remove Redundant console port

Showing 3 changed files with 70 additions and 0 deletions Side-by-side Diff

recipes-core/systemd/systemd-serialgetty.bbappend
  1 +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
  2 +
  3 +SRC_URI_append_smarcimx8mm2g = " \
  4 + file://disable-serialgetty.sh \
  5 + file://disable-serialgetty.service \
  6 +"
  7 +FILES_${PN}_append_smarcimx8mm2g = " \
  8 + /lib/systemd/system/* \
  9 + /etc/systemd/system/* \
  10 +"
  11 +
  12 +do_install_append_smarcimx8mm2g() {
  13 + install -d ${D}${systemd_unitdir}/system
  14 + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants
  15 + install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system
  16 + install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system
  17 +
  18 + ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \
  19 + ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service
  20 +}
  21 +
  22 +SRC_URI_append_smarcimx8mm4g = " \
  23 + file://disable-serialgetty.sh \
  24 + file://disable-serialgetty.service \
  25 +"
  26 +FILES_${PN}_append_smarcimx8mm4g = " \
  27 + /lib/systemd/system/* \
  28 + /etc/systemd/system/* \
  29 +"
  30 +
  31 +do_install_append_smarcimx8mm4g() {
  32 + install -d ${D}${systemd_unitdir}/system
  33 + install -d ${D}${sysconfdir}/systemd/system/sysinit.target.wants
  34 + install -m 0644 ${WORKDIR}/disable-serialgetty.service ${D}${systemd_unitdir}/system
  35 + install -m 0755 ${WORKDIR}/disable-serialgetty.sh ${D}${systemd_unitdir}/system
  36 +
  37 + ln -sf ${systemd_unitdir}/system/disable-serialgetty.service \
  38 + ${D}${sysconfdir}/systemd/system/sysinit.target.wants/disable-serialgetty.service
  39 +}
recipes-core/systemd/systemd-serialgetty/disable-serialgetty.service
  1 +[Unit]
  2 +Description=Disable redundant serial getty service
  3 +After=systemd-remount-fs.service
  4 +ConditionPathIsReadWrite=/etc
  5 +
  6 +[Service]
  7 +Type=oneshot
  8 +ExecStart=/lib/systemd/system/disable-serialgetty.sh
  9 +
  10 +[Install]
  11 +WantedBy=sysinit.target
recipes-core/systemd/systemd-serialgetty/disable-serialgetty.sh
  1 +#!/bin/sh
  2 +
  3 +UART0_SERVICE=serial-getty@ttymxc0.service
  4 +UART1_SERVICE=serial-getty@ttymxc1.service
  5 +UART2_SERVICE=serial-getty@ttymxc2.service
  6 +UART3_SERVICE=serial-getty@ttymxc3.service
  7 +
  8 +tty_service_enabled()
  9 +{
  10 + test -f /etc/systemd/system/getty.target.wants/$1
  11 +}
  12 +
  13 +if tty_service_enabled ${UART0_SERVICE}; then
  14 + systemctl stop ${UART0_SERVICE}
  15 + systemctl disable ${UART0_SERVICE}
  16 + systemctl enable ${UART1_SERVICE}
  17 +fi