65878a
From 39456b9f6e692a2385bf1288a53d02dd9abac8d5 Mon Sep 17 00:00:00 2001
65878a
From: Hendrik Brueckner <brueckner@redhat.com>
65878a
Date: Tue, 11 Mar 2014 18:41:09 +0100
65878a
Subject: [PATCH] getty: Start getty on 3270 terminals available on Linux on
65878a
 System z
65878a
65878a
Add the first 3270 terminal device that is associated with the Linux preferred
65878a
console to the list of virtualization consoles.  This is required to
65878a
automatically start a getty if the conmode=3270 kernel parameter is specified
65878a
for Linux on z/VM instances.  Note that a queued upstream patch also enable
65878a
the 3270 terminal device if it is associated with the Linux preferred console.
65878a
How
65878a
65878a
To successfully start agetty on a 3270 terminal, a change in the agetty
65878a
parameter order is required.  Previously, agetty would started like this:
65878a
65878a
    /sbin/agetty --keep-baud 3270/tty1 115200,38400,9600 TERM
65878a
65878a
The agetty program interprets the "3270/tty1" as baud rate and fails to start
65878a
with the "bad speed: 3270/tty1" error message.  Fixing this in agetty is more
65878a
complex rather than reordering the command line parameters like this:
65878a
65878a
    /sbin/agetty --keep-baud 115200,38400,9600 3270/tty1 TERM
65878a
65878a
According to agetty sources and "agetty --help", agetty accepts the "tty",
65878a
"baudrate tty", and "tty baudrate" specifications.
65878a
65878a
P.S. The "tty: Set correct tty name in 'active' sysfs attribute" introduces
65878a
     a change to display the terminal device which is associated with the
65878a
     Linux preferred console.  This change helps to let systemd handle this
65878a
     particular case only.  Without the changes of this commit, no additional
65878a
     3270 terminal device can be managed by systemd.
65878a
65878a
     https://git.kernel.org/cgit/linux/kernel/git/gregkh/tty.git/commit/?id=723abd87f6e536f1353c8f64f621520bc29523a3
65878a
65878a
(cherry picked from commit fc6c7fe9becdd70ae6b671c396f2ad2db0b71cd7)
65878a
65878a
Resolves: #1075729
65878a
---
65878a
 rules/99-systemd.rules.in             | 2 +-
65878a
 src/getty-generator/getty-generator.c | 3 ++-
65878a
 units/serial-getty@.service.m4        | 2 +-
65878a
 3 files changed, 4 insertions(+), 3 deletions(-)
65878a
65878a
diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
65878a
index 0471719..308a074 100644
65878a
--- a/rules/99-systemd.rules.in
65878a
+++ b/rules/99-systemd.rules.in
65878a
@@ -7,7 +7,7 @@
65878a
 
65878a
 ACTION=="remove", GOTO="systemd_end"
65878a
 
65878a
-SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*", TAG+="systemd"
65878a
+SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*", TAG+="systemd"
65878a
 
65878a
 KERNEL=="vport*", TAG+="systemd"
65878a
 
65878a
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
65878a
index 40374b5..5a1997f 100644
65878a
--- a/src/getty-generator/getty-generator.c
65878a
+++ b/src/getty-generator/getty-generator.c
65878a
@@ -93,7 +93,8 @@ int main(int argc, char *argv[]) {
65878a
                 "xvc0\0"
65878a
                 "hvsi0\0"
65878a
                 "sclp_line0\0"
65878a
-                "ttysclp0\0";
65878a
+                "ttysclp0\0"
65878a
+                "3270!tty1\0";
65878a
 
65878a
         int r = EXIT_SUCCESS;
65878a
         char *active;
65878a
diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
65878a
index e94cdb4..4ac51e7 100644
65878a
--- a/units/serial-getty@.service.m4
65878a
+++ b/units/serial-getty@.service.m4
65878a
@@ -22,7 +22,7 @@ Before=getty.target
65878a
 IgnoreOnIsolate=yes
65878a
 
65878a
 [Service]
65878a
-ExecStart=-/sbin/agetty --keep-baud %I 115200,38400,9600 $TERM
65878a
+ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
65878a
 Type=idle
65878a
 Restart=always
65878a
 RestartSec=0