summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core/dropbear
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-core/dropbear')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend22
-rw-r--r--meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch43
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh33
3 files changed, 57 insertions, 41 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend b/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend
index 9d5dcf6b0..029defb67 100644
--- a/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/dropbear_%.bbappend
@@ -1,22 +1,12 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
-SRC_URI += "file://enable-ssh.sh"
-
-add_manual_ssh_enable() {
- install -d ${D}/usr/share/misc
- install -m 0755 ${D}/${systemd_unitdir}/system/dropbear@.service ${D}/usr/share/misc/dropbear@.service
- install -m 0755 ${D}/${systemd_unitdir}/system/dropbear.socket ${D}/usr/share/misc/dropbear.socket
- install -m 0755 ${WORKDIR}/enable-ssh.sh ${D}${bindir}/enable-ssh.sh
- # Remove dropbear service and socket by default, if debug-tweaks is disabled
- rm ${D}/${systemd_unitdir}/system/dropbear@.service
- rm ${D}/${systemd_unitdir}/system/dropbear.socket
-}
+SRC_URI += "file://enable-ssh.sh \
+ file://0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch \
+ "
do_install:append() {
- # Add manual ssh enable script if debug-tweaks is disabled
- ${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', '', 'add_manual_ssh_enable', d)}
+ install -m 0755 ${WORKDIR}/enable-ssh.sh ${D}${bindir}/
}
-FILES:${PN} += "/usr/share/misc"
-SYSTEMD_SERVICE:${PN} += "dropbearkey.service"
-SYSTEMD_SERVICE:${PN}:remove += " ${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', '', 'dropbear.socket', d)}"
+# Enable dropbear.socket and dropbearkey.service only for debug-tweaks
+SYSTEMD_AUTO_ENABLE:${PN} = "${@bb.utils.contains('EXTRA_IMAGE_FEATURES', 'debug-tweaks', 'enable', 'disable', d)}"
diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch
new file mode 100644
index 000000000..22aed3a07
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/0001-Enable-UART-mux-setting-before-SOL-activation-via-SS.patch
@@ -0,0 +1,43 @@
+From 41a43e4b149af0bbfa82ca1b9479dd7dfb2455de Mon Sep 17 00:00:00 2001
+From: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
+Date: Wed, 13 Oct 2021 22:52:34 +0000
+Subject: [PATCH] Enable UART mux setting before SOL activation via SSH
+
+Switching UART routing when starting obmc-service introduces garbled
+character printing out on physical host serial output and it's
+inevitable so this commit moves the routing logic into host console
+connection flow in SSH SOL to avoid the issue until SOL is actually
+activated.
+
+Tested: SOL activation is working fine via SSH
+
+Signed-off-by: Chalapathi Venkataramashetty <chalapathix.venkataramashetty@intel.com>
+---
+ svr-runopts.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/svr-runopts.c b/svr-runopts.c
+index 2c905dd..6fc25e8 100644
+--- a/svr-runopts.c
++++ b/svr-runopts.c
+@@ -414,6 +414,17 @@ void svr_getopts(int argc, char ** argv) {
+ }
+
+ if (svr_opts.forced_command) {
++ if (strcmp(svr_opts.forced_command, "/usr/bin/obmc-console-client") == 0) {
++ FILE *fp;
++ fp = fopen("/sys/bus/platform/drivers/aspeed-uart-routing/"
++ "1e789098.uart-routing/hicra",
++ "w");
++ if (fp != NULL) {
++ char *uartMuxCtrlVal = "0x03450003";
++ fprintf(fp, "%s", uartMuxCtrlVal);
++ fclose(fp);
++ }
++ }
+ dropbear_log(LOG_INFO, "Forced command set to '%s'", svr_opts.forced_command);
+ }
+ #if DROPBEAR_PLUGIN
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh
index 922aa09f5..01ebe098f 100755
--- a/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh
+++ b/meta-openbmc-mods/meta-common/recipes-core/dropbear/files/enable-ssh.sh
@@ -1,38 +1,21 @@
#!/bin/sh
-usage="$(basename "$0") [-h] [-d] -- Enable/Disable ssh for root user
+usage="$(basename $0) [-h] [-d] -- Enable/Disable ssh for root user
where:
-h help
-d disable ssh and remove priv-admin permission for root user"
enable_ssh() {
- if [ -e /etc/systemd/system/dropbear@.service ] &&
- [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]; then
- echo "SSH is already enabled"
- else
- cp /usr/share/misc/dropbear@.service /etc/systemd/system/dropbear@.service
- cp /usr/share/misc/dropbear.socket /etc/systemd/system/dropbear.socket
- ln -s /etc/systemd/system/dropbear.socket /etc/systemd/system/sockets.target.wants/dropbear.socket
- groupmems -g priv-admin -a root
- systemctl daemon-reload
- systemctl restart dropbear.socket
- echo "Enabled SSH service for root user successful"
- fi
+ systemctl enable --now dropbear.socket
+ groupmems -g priv-admin -a root
+ echo "Enabled SSH service for root user successful"
}
disable_ssh() {
- if [ -e /etc/systemd/system/dropbear@.service ] &&
- [ -e /etc/systemd/system/sockets.target.wants/dropbear.socket ]; then
- systemctl stop dropbear.socket
- systemctl stop dropbear@*.service
- rm -rf /etc/systemd/system/sockets.target.wants/dropbear.socket
- rm -rf /etc/systemd/system/dropbear.socket
- rm -rf /etc/systemd/system/dropbear@.service
- groupmems -g priv-admin -d root
- echo "SSH disabled"
- else
- echo "SSH is already disabled"
- fi
+ systemctl disable --now dropbear.socket
+ systemctl stop dropbear@*.service
+ groupmems -g priv-admin -d root
+ echo "Disabled SSH service"
}
case "$1" in