meta-ampere: mtmitchell: Refactor obmc-console setup

This commit refactors obmc-console setup for mtmitchell

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: Ia1e6faaa4757e8f478352fd03ed977beeac15200
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init.bb b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init.bb
index dd5f599..12a5c09 100644
--- a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init.bb
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init.bb
@@ -19,6 +19,8 @@
            file://ampere_bmc_heartbeat.sh \
            file://${MACHINE}_platform_gpios_init.sh \
            file://gpio-lib.sh \
+           file://ampere_uart_console_setup.sh \
+           file://ampere_uartmux_ctrl.sh \
           "
 SYSTEMD_PACKAGES = "${PN}"
 SYSTEMD_SERVICE:${PN} = "ampere-platform-init.service ampere-bmc-heartbeat.service"
@@ -29,6 +31,8 @@
     install -m 0755 ${WORKDIR}/ampere_platform_init.sh ${D}${sbindir}/
     install -m 0755 ${WORKDIR}/ampere_bmc_heartbeat.sh ${D}${sbindir}/
     install -m 0755 ${WORKDIR}/${MACHINE}_platform_gpios_init.sh ${D}${sbindir}/platform_gpios_init.sh
+    install -m 0755 ${WORKDIR}/ampere_uart_console_setup.sh ${D}${sbindir}/
+    install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir}/
     install -d ${D}${systemd_unitdir}/system/
     install -m 0644 ${WORKDIR}/ampere-platform-init.service ${D}${systemd_unitdir}/system
 }
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh
index 9d6ca0e..cae866e 100644
--- a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_platform_init.sh
@@ -4,6 +4,7 @@
 source /usr/sbin/gpio-lib.sh
 # shellcheck source=meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/mtmitchell_platform_gpios_init.sh
 source /usr/sbin/platform_gpios_init.sh
+source /usr/sbin/ampere_uart_console_setup.sh
 
 #pre platform init function. implemented in platform_gpios_init.sh
 pre-platform-init
@@ -41,6 +42,10 @@
     gpio_name_input "$gpioName"
 done
 
+# =======================================================
+# Setting uart muxes to BMC as default
+uart_console_setup
+
 #post platform init function. implemented in platform_gpios_init.sh
 post-platform-init
 
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_uart_console_setup.sh b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_uart_console_setup.sh
new file mode 100644
index 0000000..10a1981
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_uart_console_setup.sh
@@ -0,0 +1,47 @@
+#!/bin/sh -e
+
+# shellcheck disable=SC2039
+# shellcheck disable=SC2112
+# shellcheck disable=SC3010
+# shellcheck disable=SC3030
+# shellcheck disable=SC3054
+
+export obmc_console_tty=("ttyS0" "ttyS1" "ttyS2" "ttyS3" "ttyS7" "ttyS8")
+
+function get_uart_port()
+{
+   tty=$1
+   case "${tty}" in
+   "ttyS0") uart=1
+   ;;
+   "ttyS1") uart=2
+   ;;
+   "ttyS2") uart=3
+   ;;
+   "ttyS3") uart=4
+   ;;
+   "ttyS7") uart=0
+   ;;
+   "ttyS8") uart=0
+   ;;
+   *) echo "Invalid tty passed to $0. Exiting!"
+      exit 1;
+   ;;
+   esac
+   echo $uart
+}
+
+function uart_console_setup()
+{
+   # Default the host routing through the mux to use the BMC (2)
+   # This allows the SoL console in webui, and the ssh port 2200, to work
+   # upon startup. If UART transcievers are installed on the header and required,
+   # this value should be set to 1
+   for tty in "${obmc_console_tty[@]}"; do
+      uart=$(get_uart_port "$tty")
+      if [ "${uart}" -ne 0 ]
+      then
+         /usr/sbin/ampere_uartmux_ctrl.sh "${uart}" 2
+      fi
+   done
+}
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_uartmux_ctrl.sh b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_uartmux_ctrl.sh
new file mode 100644
index 0000000..3148b61
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-platform-init/ampere_uartmux_ctrl.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# shellcheck disable=SC2046
+# This can be called to set uart mux manually
+
+if [ $# -lt 2 ]; then
+	exit 1
+fi
+
+case "$1" in
+	1) GPIO_UARTx_MODE0="uart1-mode0"
+		GPIO_UARTx_MODE1="uart1-mode1"
+	;;
+	2) GPIO_UARTx_MODE0="uart2-mode0"
+		GPIO_UARTx_MODE1="uart2-mode1"
+	;;
+	3) GPIO_UARTx_MODE0="uart3-mode0"
+		GPIO_UARTx_MODE1="uart3-mode1"
+	;;
+	4) GPIO_UARTx_MODE0="uart4-mode0"
+		GPIO_UARTx_MODE1="uart4-mode1"
+	;;
+	*) echo "Invalid UART port selection"
+		exit 1
+	;;
+esac
+
+echo "Ampere UART MUX CTRL UART port $1 to mode $2"
+
+case "$2" in
+	# To HDR
+	1) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=1
+		gpioset $(gpiofind "$GPIO_UARTx_MODE1")=0
+		exit 0
+	;;
+	# To BMC
+	2) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=0
+		gpioset $(gpiofind "$GPIO_UARTx_MODE1")=1
+		exit 0
+	;;
+	*) echo "Invalid UART mode selection"
+		exit 1
+	;;
+esac
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh
deleted file mode 100644
index 1d1fbed..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/ampere_uartmux_ctrl.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-#
-# shellcheck disable=SC2046
-
-if [ $# -lt 2 ]; then
-	exit 1
-fi
-
-case "$1" in
-	1) GPIO_UARTx_MODE0="uart1-mode0"
-		GPIO_UARTx_MODE1="uart1-mode1"
-		# CPU0 UART0 connects to BMC UART1
-		CONSOLE_PORT=0
-	;;
-	2) GPIO_UARTx_MODE0="uart2-mode0"
-		GPIO_UARTx_MODE1="uart2-mode1"
-		# CPU0 UART1 connects to BMC UART2
-		CONSOLE_PORT=1
-	;;
-	3) GPIO_UARTx_MODE0="uart3-mode0"
-		GPIO_UARTx_MODE1="uart3-mode1"
-		# CPU0 UART4 connects to BMC UART3
-		CONSOLE_PORT=2
-	;;
-	4) GPIO_UARTx_MODE0="uart4-mode0"
-		GPIO_UARTx_MODE1="uart4-mode1"
-		# CPU1 UART1 connects to BMC UART4
-		CONSOLE_PORT=3
-	;;
-	*) echo "Invalid UART port selection"
-		exit 1
-	;;
-esac
-
-# Only switch the MUX when there is no active connection. This means we only
-# switch the MUX before the first session starts and after the last session
-# closes. We do this by querying number of connected sessions to the socket
-# of requested console port.
-# Example format:  Accepted: 1; Connected: 1;
-CONNECTED=$(systemctl --no-pager status obmc-console-ttyS${CONSOLE_PORT}-ssh.socket | grep -w Connected | cut -d ':' -f 3 | tr -d ' ;')
-if [ ! "$CONNECTED" -le 1 ]; then
-	echo "Please close all connected session to ttyS${CONSOLE_PORT} !"
-	exit 0
-fi
-
-echo "Ampere UART MUX CTRL UART port $1 to mode $2"
-
-case "$2" in
-	# To HDR
-	1) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=1
-		gpioset $(gpiofind "$GPIO_UARTx_MODE1")=0
-		exit 0
-	;;
-	# To BMC
-	2) gpioset $(gpiofind "$GPIO_UARTx_MODE0")=0
-		gpioset $(gpiofind "$GPIO_UARTx_MODE1")=1
-		exit 0
-	;;
-	*) echo "Invalid UART mode selection"
-		exit 1
-	;;
-esac
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2200.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2200.conf
new file mode 100644
index 0000000..901895b
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2200.conf
@@ -0,0 +1 @@
+# socket-id is default to obmc-console
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2201.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2201.conf
new file mode 100644
index 0000000..f06d9fc
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2201.conf
@@ -0,0 +1 @@
+socket-id = ttyS1
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2202.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2202.conf
new file mode 100644
index 0000000..dba9b8d
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2202.conf
@@ -0,0 +1 @@
+socket-id = ttyS2
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2203.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2203.conf
new file mode 100644
index 0000000..0047b89
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2203.conf
@@ -0,0 +1 @@
+socket-id = ttyS3
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2204.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2204.conf
new file mode 100644
index 0000000..2b99388
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2204.conf
@@ -0,0 +1 @@
+socket-id = ttyS7
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2205.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2205.conf
new file mode 100644
index 0000000..407f84c
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/client.2205.conf
@@ -0,0 +1 @@
+socket-id = ttyS8
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-server-setup.sh b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-server-setup.sh
deleted file mode 100644
index 946c92b..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-server-setup.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh -e
-
-# shellcheck disable=SC3010
-
-tty="$1"
-uart=0
-
-case "${tty}" in
- "ttyS0") uart=1
- ;;
- "ttyS1") uart=2
- ;;
- "ttyS2") uart=3
- ;;
- "ttyS3") uart=4
- ;;
- "ttyS7") uart=0
- ;;
- "ttyS8") uart=0
- ;;
- *) echo "Invalid tty passed to $0. Exiting!"
-    exit 1;
- ;;
-esac
-
-# Default the host routing through the mux to use the BMC (2)
-# This allows the SoL console in webui, and the ssh port 2200, to work
-# upon startup. If UART transcievers are installed on the header and required,
-# this value should be set to 1
-if [[ ${uart} -ne 0 ]]
-then
-	/usr/sbin/ampere_uartmux_ctrl.sh ${uart} 2
-fi
-
-/usr/sbin/obmc-console-server --config /etc/obmc-console/server."${tty}".conf "${tty}"
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS0-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS0-ssh.socket
deleted file mode 100644
index 183a7a4..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS0-ssh.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection socket
-Wants=obmc-console@ttyS0.service
-
-[Socket]
-ListenStream=2200
-Accept=yes
-
-[Install]
-WantedBy=sockets.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS0-ssh@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS0-ssh@.service
deleted file mode 100644
index f964454..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS0-ssh@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection
-Wants=obmc-console@ttyS0.service
-
-[Service]
-Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
-EnvironmentFile=/etc/default/dropbear
-ExecStart=/usr/sbin/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/server.ttyS0.conf" -p ttyS0 -F $DROPBEAR_EXTRA_ARGS
-SyslogIdentifier=dropbear
-ExecReload=/bin/kill -HUP $MAINPID
-StandardInput=socket
-KillMode=process
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh.socket
deleted file mode 100644
index bdbf562..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection socket
-Wants=obmc-console@ttyS1.service
-
-[Socket]
-ListenStream=2201
-Accept=yes
-
-[Install]
-WantedBy=sockets.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh@.service
deleted file mode 100644
index 697c242..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection
-Wants=obmc-console@ttyS1.service
-
-[Service]
-Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
-EnvironmentFile=/etc/default/dropbear
-ExecStart=/usr/sbin/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/server.ttyS1.conf" -p ttyS1 -F $DROPBEAR_EXTRA_ARGS
-SyslogIdentifier=dropbear
-ExecReload=/bin/kill -HUP $MAINPID
-StandardInput=socket
-KillMode=process
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh.socket
deleted file mode 100644
index f8934fd..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection socket
-Wants=obmc-console@ttyS2.service
-
-[Socket]
-ListenStream=2202
-Accept=yes
-
-[Install]
-WantedBy=sockets.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh@.service
deleted file mode 100644
index 7d7f314..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection
-Wants=obmc-console@ttyS2.service
-
-[Service]
-Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
-EnvironmentFile=/etc/default/dropbear
-ExecStart=/usr/sbin/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/server.ttyS2.conf" -p ttyS2 -F $DROPBEAR_EXTRA_ARGS
-SyslogIdentifier=dropbear
-ExecReload=/bin/kill -HUP $MAINPID
-StandardInput=socket
-KillMode=process
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh.socket
deleted file mode 100644
index fd7f3e3..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection socket
-Wants=obmc-console@ttyS3.service
-
-[Socket]
-ListenStream=2203
-Accept=yes
-
-[Install]
-WantedBy=sockets.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh@.service
deleted file mode 100644
index 261f3a1..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection
-Wants=obmc-console@ttyS3.service
-
-[Service]
-Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
-EnvironmentFile=/etc/default/dropbear
-ExecStart=/usr/sbin/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/server.ttyS3.conf" -p ttyS3 -F $DROPBEAR_EXTRA_ARGS
-SyslogIdentifier=dropbear
-ExecReload=/bin/kill -HUP $MAINPID
-StandardInput=socket
-KillMode=process
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh.socket
deleted file mode 100644
index de670ba..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection socket
-Wants=obmc-console@ttyS7.service
-
-[Socket]
-ListenStream=2204
-Accept=yes
-
-[Install]
-WantedBy=sockets.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh@.service
deleted file mode 100644
index 8ce8ba0..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection
-Wants=obmc-console@ttyS7.service
-
-[Service]
-Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
-EnvironmentFile=/etc/default/dropbear
-ExecStart=/usr/sbin/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/server.ttyS7.conf" -p ttyS7 -F $DROPBEAR_EXTRA_ARGS
-SyslogIdentifier=dropbear
-ExecReload=/bin/kill -HUP $MAINPID
-StandardInput=socket
-KillMode=process
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh.socket
deleted file mode 100644
index b2ad917..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection socket
-Wants=obmc-console@ttyS8.service
-
-[Socket]
-ListenStream=2205
-Accept=yes
-
-[Install]
-WantedBy=sockets.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh@.service
deleted file mode 100644
index cd5bda3..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh@.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Phosphor Host Console SSH Per-Connection
-Wants=obmc-console@ttyS8.service
-
-[Service]
-Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
-EnvironmentFile=/etc/default/dropbear
-ExecStart=/usr/sbin/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/server.ttyS8.conf" -p ttyS8 -F $DROPBEAR_EXTRA_ARGS
-SyslogIdentifier=dropbear
-ExecReload=/bin/kill -HUP $MAINPID
-StandardInput=socket
-KillMode=process
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console@.service b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console@.service
deleted file mode 100644
index 22a5df2..0000000
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console@.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=Phosphor Console Muxer listening on device /dev/%I
-BindsTo=dev-%i.device
-After=dev-%i.device
-StartLimitBurst=3
-StartLimitIntervalSec=300
-
-[Service]
-ExecStart=/usr/sbin/obmc-console-server-setup.sh %i
-SyslogIdentifier=obmc-console-server
-Restart=always
-RestartSec=10
-TimeoutStartSec=60
-TimeoutStopSec=60
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend
index 2b7673e..3d98840 100644
--- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend
+++ b/meta-ampere/meta-mitchell/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 ttyS7 ttyS8"
+# Declare port spcific config files
+OBMC_CONSOLE_TTYS = "ttyS0 ttyS1 ttyS2 ttyS3 ttyS7 ttyS8"
+CONSOLE_CLIENT = "2200 2201 2202 2203 2204 2205"
 
-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}/
 }