Initial commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2020 Ampere Computing LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Ampere Computing LLC mtjade: UART MUX/DEMUX for CPU0 UART0,1,4 and CPU1 UART1
|
||||
# Usage: ampere_uartmux_ctrl.sh <CPU UART port number> <UARTx_MODE>
|
||||
# <UARTx_MODE> of 1 sets CPU To BSP
|
||||
# <UARTx_MODE> of 2 sets SCP1 to SI2
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
|
||||
source /usr/libexec/kudo-fw/kudo-lib.sh
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ampere UART MUX CTRL UART port $1 to mode" > /dev/ttyS0
|
||||
|
||||
case "$1" in
|
||||
ttyS1)
|
||||
set_gpio_ctrl S0_UART0_BMC_SEL 1
|
||||
;;
|
||||
ttyS3)
|
||||
set_gpio_ctrl S0_UART1_BMC_SEL 1
|
||||
set_gpio_ctrl S1_UART1_BMC_SEL 0
|
||||
;;
|
||||
*)
|
||||
echo "Invalid tty passed to $0. Exiting!" > /dev/ttyS0
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description=Phosphor Console Muxer listening on device /dev/%I
|
||||
BindsTo=dev-%i.device
|
||||
After=dev-%i.device
|
||||
StartLimitBurst=3
|
||||
StartLimitIntervalSec=300
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/usr/libexec/obmc-console/kudo_uart_mux_ctrl.sh %i
|
||||
ExecStart=/usr/sbin/obmc-console-server --config /etc/obmc-console/server.%i.conf %i
|
||||
SyslogIdentifier=obmc-console-server
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
TimeoutStartSec=60
|
||||
TimeoutStopSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,3 @@
|
||||
baud = 115200
|
||||
logfile = /var/log/obmc-console-cpu.log
|
||||
logsize = 1M
|
||||
@@ -0,0 +1,4 @@
|
||||
baud = 115200
|
||||
console-id = ttyS3
|
||||
logfile = /var/log/obmc-console-scp.log
|
||||
logsize = 1M
|
||||
@@ -0,0 +1,27 @@
|
||||
FILESEXTRAPATHS:prepend:kudo := "${THISDIR}/${PN}:"
|
||||
RDEPENDS:${PN}:append:kudo = " bash"
|
||||
|
||||
OBMC_CONSOLE_TTYS = "ttyS1 ttyS3"
|
||||
|
||||
SRC_URI:append:kudo = " file://${BPN}@.service \
|
||||
file://kudo_uart_mux_ctrl.sh \
|
||||
file://server.ttyS1.conf \
|
||||
file://server.ttyS3.conf \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN}:append:kudo = " \
|
||||
${BPN}@.service \
|
||||
"
|
||||
|
||||
do_install:append() {
|
||||
# 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}${libexecdir}/${PN}
|
||||
install -m 0755 ${WORKDIR}/kudo_uart_mux_ctrl.sh ${D}${libexecdir}/${PN}/kudo_uart_mux_ctrl.sh
|
||||
}
|
||||
|
||||
pkg_postinst:${PN}:append () {
|
||||
systemctl --root=$D enable obmc-console@ttyS1.service
|
||||
systemctl --root=$D enable obmc-console@ttyS3.service
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user