meta-ampere: mtjade: Refactor obmc-console setup

This commit refactors obmc-console setup for mtjade

Tested:
1. Successfully connects to host consoles via ssh sol
   $ ssh root@${bmc} -p 220*
2. Successfully connects host consoles via ipmi sol
   $ ipmitool -I lanplus -H ${bmc} -U root -P 0penBmc \
     -C 17 sol activate
3. All the host console logs are in /var/log/

Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: Ie01361139644f5836646d1d98934cda52828ec70
diff --git a/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend
index 655a446..60a26ce 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/console/obmc-console_%.bbappend
@@ -3,52 +3,26 @@
 
 # Remove what installed by common recipe
 OBMC_CONSOLE_HOST_TTY = ""
-SYSTEMD_SUBSTITUTIONS:remove = "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh@.service"
 SYSTEMD_SUBSTITUTIONS:remove = "OBMC_CONSOLE_HOST_TTY:${OBMC_CONSOLE_HOST_TTY}:${PN}-ssh.socket"
-SYSTEMD_SERVICE:${PN}:remove = " \
-                          ${PN}-ssh.socket \
-                          ${PN}-ssh@.service \
-                        "
 
-# Declare port spcific conf and service files
-HOST_CONSOLE_TTY = "ttyS0 ttyS1 ttyS2 ttyS3"
+# Declare port spcific config files
+OBMC_CONSOLE_TTYS = "ttyS0 ttyS1 ttyS2 ttyS3"
+CONSOLE_CLIENT = "2200 2201 2202 2203"
 
-CONSOLE_CONF_FMT = "file://server.{0}.conf"
-SRC_URI += "${@compose_list(d, 'CONSOLE_CONF_FMT', 'HOST_CONSOLE_TTY')}"
-SRC_URI += "file://${BPN}-server-setup.sh"
-SRC_URI += "file://${BPN}@.service"
-SRC_URI += "file://ampere_uartmux_ctrl.sh"
+CONSOLE_SERVER_CONF_FMT = "file://server.{0}.conf"
+CONSOLE_CLIENT_CONF_FMT = "file://client.{0}.conf"
 
-CONSOLE_SSH_SOCKET_FILE_FMT = "file://${PN}-{0}-ssh.socket"
-CONSOLE_SSH_SERVICE_FILE_FMT = "file://${PN}-{0}-ssh@.service"
-SRC_URI += "${@compose_list(d, 'CONSOLE_SSH_SOCKET_FILE_FMT', 'HOST_CONSOLE_TTY')}"
-SRC_URI += "${@compose_list(d, 'CONSOLE_SSH_SERVICE_FILE_FMT', 'HOST_CONSOLE_TTY')}"
+SRC_URI += " ${@compose_list(d, 'CONSOLE_SERVER_CONF_FMT', 'OBMC_CONSOLE_TTYS')} \
+             ${@compose_list(d, 'CONSOLE_CLIENT_CONF_FMT', 'CONSOLE_CLIENT')} \
+           "
 
-CONSOLE_SSH_SOCKET_FMT = "${PN}-{0}-ssh.socket"
-CONSOLE_SSH_SERVICE_FMT = "${PN}-{0}-ssh@.service"
+SYSTEMD_SERVICE:${PN}:remove = "obmc-console-ssh.socket"
 
-SYSTEMD_SERVICE:${PN} = " \
-                          ${PN}@.service \
-                          ${@compose_list(d, 'CONSOLE_SSH_SOCKET_FMT', 'HOST_CONSOLE_TTY')} \
-                          ${@compose_list(d, 'CONSOLE_SSH_SERVICE_FMT', 'HOST_CONSOLE_TTY')} \
-                        "
+FILES:${PN}:remove = "${systemd_system_unitdir}/obmc-console-ssh@.service.d/use-socket.conf"
+
+EXTRA_OECONF:append = " --enable-concurrent-servers"
+
 do_install:append() {
-    for i in ${HOST_CONSOLE_TTY}
-    do
-        install -m 0644 ${WORKDIR}/server.${i}.conf ${D}${sysconfdir}/${BPN}/server.${i}.conf
-        install -m 0644 ${WORKDIR}/${BPN}-${i}-ssh.socket ${D}${systemd_unitdir}/system/${BPN}-${i}-ssh.socket
-        install -m 0644 ${WORKDIR}/${BPN}-${i}-ssh@.service ${D}${systemd_unitdir}/system/${BPN}-${i}-ssh@.service
-    done
-    install -m 0755 ${WORKDIR}/${BPN}-server-setup.sh ${D}${sbindir}/${BPN}-server-setup.sh
-
-    # Deal with files installed by the base package's .bb install function
-    rm -f ${D}${sysconfdir}/${BPN}.conf
-    rm -f ${D}${sysconfdir}/${BPN}/server.ttyVUART0.conf
-    rm -rf ${D}${systemd_unitdir}/system/${BPN}-ssh@.service.d/
-    rm -f ${D}${systemd_unitdir}/system/${BPN}-ssh@.service
-    rm -f ${D}${systemd_unitdir}/system/${BPN}-ssh.socket
-    # Overwrite base package's obmc-console@.service with our own
-    install -m 0644 ${WORKDIR}/${BPN}@.service ${D}${systemd_unitdir}/system/${BPN}@.service
-    install -d ${D}/usr/sbin
-    install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir}/ampere_uartmux_ctrl.sh
+    # Install the console client configurations
+    install -m 0644 ${WORKDIR}/client.*.conf ${D}${sysconfdir}/${BPN}/
 }