meta-ampere: console: refactor configuration

Refactor console configuration for Mt.Jade and Mt.Mitchell to avoid
duplication and make the configuration files simpler.

Tested:
1. IPMI sol on Mt.Jade and Mt.Mitchell works
2. SOL SSH on Mt.Jade and Mt.Mitchell work for all console ports

Change-Id: I68d1a3c6be530ca93f8adc1dd61906ba8b206dc5
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
diff --git a/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend
new file mode 100644
index 0000000..dd857f2
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/console/obmc-console_%.bbappend
@@ -0,0 +1,27 @@
+FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
+RDEPENDS:${PN} += "bash"
+
+CONSOLE_CLIENT_SERVICE_FMT = "obmc-console-ssh@{0}.service"
+CONSOLE_SERVER_CONF_FMT = "file://server.{0}.conf"
+CONSOLE_CLIENT_CONF_FMT = "file://client.{0}.conf"
+
+SRC_URI += " \
+             file://ampere_uartmux_ctrl.sh \
+             file://obmc-console@.service \
+           "
+
+SYSTEMD_SERVICE:${PN}:remove = "obmc-console-ssh.socket"
+
+FILES:${PN}:remove = "${systemd_system_unitdir}/obmc-console-ssh@.service.d/use-socket.conf"
+
+PACKAGECONFIG:append = " concurrent-servers"
+
+do_install:append() {
+    # Script to switch host's uart muxes by GPIOs
+    install -d ${D}${sbindir}
+    install -m 0755 ${WORKDIR}/ampere_uartmux_ctrl.sh ${D}/${sbindir}
+
+    # Overriding service to call ampere_uart_console_setup.sh at ExecStartPre
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/obmc-console@.service ${D}${systemd_system_unitdir}
+}