diff options
author | Chau Ly <chaul@amperecomputing.com> | 2023-01-13 07:18:51 +0300 |
---|---|---|
committer | Chau Ly <chaul@amperecomputing.com> | 2023-01-13 09:57:41 +0300 |
commit | 23148bd56ea408b6ee4a7fb53b8405c738db2055 (patch) | |
tree | 65c1490195dbf58ed6e653994adf905a74b7abfc /meta-ampere/meta-mitchell/recipes-phosphor | |
parent | 74946010ffb0b679bdf4341d8e1f012b61181ccc (diff) | |
download | openbmc-23148bd56ea408b6ee4a7fb53b8405c738db2055.tar.xz |
meta-ampere: mtmitchell: Support host consoles logger
This commit supports phosphor-hostlogger in STREAM mode, to forward
the byte stream from obmc-console to rsyslog via the imuxsock module.
The logs can be obtained in /var/log/. The logs are rotated by
logrotate. The size threshold of cpu console is 256KB and the others are
64KB. Each log is polled every 1 minute to check if its file size
exceeds the threshold to rotate it to the new file. Each console can be
saved in up to 2 log files.
Tested (CPU console):
1. Change the mux of CPU console to BMC
$ ampere_uartmux_ctrl.sh 1 2
2. Connect to CPU SOL console
$ ssh root@<BMC_IP> -p 2200
3. Execute commands in the CPU SOL console
=> The console output on CPU SOL console will all be logged to
/var/log/obmc-console-cpu.log
=> The log will be rotated to /var/log/obmc-console-cpu.log.1 if the
original log file size exceeds 256KB every 1min poll
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: I336bde09c4ef61ea68e05bef2c0b4e4298ea7959
Diffstat (limited to 'meta-ampere/meta-mitchell/recipes-phosphor')
26 files changed, 186 insertions, 4 deletions
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 index 387cfcf92c..1d1fbed121 100644 --- 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 @@ -12,6 +12,21 @@ case "$1" in # 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 ;; 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 index 763161a24c..946c92bc3c 100644 --- 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 @@ -1,5 +1,6 @@ #!/bin/sh -e +# shellcheck disable=SC3010 tty="$1" uart=0 @@ -13,6 +14,10 @@ case "${tty}" in ;; "ttyS3") uart=4 ;; + "ttyS7") uart=0 + ;; + "ttyS8") uart=0 + ;; *) echo "Invalid tty passed to $0. Exiting!" exit 1; ;; @@ -22,6 +27,9 @@ esac # 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 -/usr/sbin/ampere_uartmux_ctrl.sh ${uart} 2 +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-ttyS1-ssh.socket b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh.socket new file mode 100644 index 0000000000..bdbf562585 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh.socket @@ -0,0 +1,10 @@ +[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 new file mode 100644 index 0000000000..697c242711 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS1-ssh@.service @@ -0,0 +1,12 @@ +[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 new file mode 100644 index 0000000000..f8934fd41c --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh.socket @@ -0,0 +1,10 @@ +[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 new file mode 100644 index 0000000000..7d7f31490a --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS2-ssh@.service @@ -0,0 +1,12 @@ +[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 new file mode 100644 index 0000000000..fd7f3e3f97 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh.socket @@ -0,0 +1,10 @@ +[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 new file mode 100644 index 0000000000..261f3a12ef --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS3-ssh@.service @@ -0,0 +1,12 @@ +[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 new file mode 100644 index 0000000000..de670bafb6 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh.socket @@ -0,0 +1,10 @@ +[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 new file mode 100644 index 0000000000..8ce8ba0b39 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS7-ssh@.service @@ -0,0 +1,12 @@ +[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 new file mode 100644 index 0000000000..b2ad91799d --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh.socket @@ -0,0 +1,10 @@ +[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 new file mode 100644 index 0000000000..cd5bda3f26 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/obmc-console-ttyS8-ssh@.service @@ -0,0 +1,12 @@ +[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/server.ttyS0.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS0.conf index 4025be341d..2d80850416 100644 --- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS0.conf +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS0.conf @@ -1,3 +1,3 @@ +# socket-id is default to obmc-console local-tty = ttyS0 local-tty-baud = 115200 -logfile = /var/log/obmc-console-boot.log diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS1.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS1.conf index 086ff94a84..6421f93397 100644 --- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS1.conf +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS1.conf @@ -1,4 +1,3 @@ local-tty = ttyS1 local-tty-baud = 115200 socket-id = ttyS1 -logfile = /var/log/obmc-console-mpro0.log diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS2.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS2.conf new file mode 100644 index 0000000000..f8be872f25 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS2.conf @@ -0,0 +1,3 @@ +local-tty = ttyS2 +local-tty-baud = 115200 +socket-id = ttyS2 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS3.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS3.conf new file mode 100644 index 0000000000..8f1ebbac73 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS3.conf @@ -0,0 +1,3 @@ +local-tty = ttyS3 +local-tty-baud = 115200 +socket-id = ttyS3 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS7.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS7.conf new file mode 100644 index 0000000000..decc72f293 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS7.conf @@ -0,0 +1,3 @@ +local-tty = ttyS7 +local-tty-baud = 115200 +socket-id = ttyS7 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS8.conf b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS8.conf new file mode 100644 index 0000000000..df56992ad9 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console/server.ttyS8.conf @@ -0,0 +1,3 @@ +local-tty = ttyS8 +local-tty-baud = 115200 +socket-id = ttyS8 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 2e0ac98034..2b7673ef38 100644 --- a/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend +++ b/meta-ampere/meta-mitchell/recipes-phosphor/console/obmc-console_%.bbappend @@ -11,7 +11,7 @@ SYSTEMD_SERVICE:${PN}:remove = " \ " # Declare port spcific conf and service files -HOST_CONSOLE_TTY = "ttyS0" +HOST_CONSOLE_TTY = "ttyS0 ttyS1 ttyS2 ttyS3 ttyS7 ttyS8" CONSOLE_CONF_FMT = "file://server.{0}.conf" SRC_URI += "${@compose_list(d, 'CONSOLE_CONF_FMT', 'HOST_CONSOLE_TTY')}" diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS0.conf b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS0.conf new file mode 100644 index 0000000000..e0c10a42ed --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS0.conf @@ -0,0 +1,3 @@ +# SOCKET-ID is default to obmc-console +MODE=stream +STREAM_DST=/run/rsyslog/console/cpu diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS1.conf b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS1.conf new file mode 100644 index 0000000000..c2218e5eb0 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS1.conf @@ -0,0 +1,3 @@ +SOCKET_ID=ttyS1 +MODE=stream +STREAM_DST=/run/rsyslog/console/mpro0 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS2.conf b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS2.conf new file mode 100644 index 0000000000..5d3cfb6828 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS2.conf @@ -0,0 +1,3 @@ +SOCKET_ID=ttyS2 +MODE=stream +STREAM_DST=/run/rsyslog/console/atf diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS3.conf b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS3.conf new file mode 100644 index 0000000000..7c4f5e98f0 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS3.conf @@ -0,0 +1,3 @@ +SOCKET_ID=ttyS3 +MODE=stream +STREAM_DST=/run/rsyslog/console/secpro0 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS7.conf b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS7.conf new file mode 100644 index 0000000000..b811dcf031 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS7.conf @@ -0,0 +1,3 @@ +SOCKET_ID=ttyS7 +MODE=stream +STREAM_DST=/run/rsyslog/console/mpro1 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS8.conf b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS8.conf new file mode 100644 index 0000000000..dfe25d3f01 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger/ttyS8.conf @@ -0,0 +1,3 @@ +SOCKET_ID=ttyS8 +MODE=stream +STREAM_DST=/run/rsyslog/console/secpro1 diff --git a/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger_%.bbappend b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger_%.bbappend new file mode 100644 index 0000000000..977f7cc819 --- /dev/null +++ b/meta-ampere/meta-mitchell/recipes-phosphor/hostlogger/phosphor-hostlogger_%.bbappend @@ -0,0 +1,20 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" + +SRC_URI:append = " \ + file://ttyS0.conf \ + file://ttyS1.conf \ + file://ttyS2.conf \ + file://ttyS3.conf \ + file://ttyS7.conf \ + file://ttyS8.conf \ + " + +do_install:append() { + + # Install the configurations + install -m 0755 -d ${D}${sysconfdir}/${BPN} + install -m 0644 ${WORKDIR}/*.conf ${D}${sysconfdir}/${BPN}/ + + # Remove upstream-provided default configuration + rm -f ${D}${sysconfdir}/${BPN}/ttyVUART0.conf +} |