From 76f7c12ca5e19df68fa78659e15fafc6a13d9aba Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 15 Apr 2020 16:50:33 -0400 Subject: [PATCH] Incorporate autocons This should permit skipping it on kernel command line. --- misc/autocons.c | 8 ++++++-- misc/confluent-cmdline.sh.rh8 | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/misc/autocons.c b/misc/autocons.c index 1280d4d9..1d555149 100644 --- a/misc/autocons.c +++ b/misc/autocons.c @@ -25,6 +25,7 @@ int main(int argc, char* argv[]) { int currspeed; speed_t cspeed; char buff[128]; + char* offset; uint64_t address; spcr = open("/sys/firmware/acpi/tables/SPCR", O_RDONLY); if (spcr < 0) { @@ -38,6 +39,7 @@ int main(int argc, char* argv[]) { if (buff[40] != 1) exit(0); //IO only address = *(uint64_t *)(buff + 44); currspeed = buff[58]; + offset = buff + 10; if (address == COM1) { strncpy(buff, "/dev/ttyS0", 128); } else if (address == COM2) { @@ -51,14 +53,16 @@ int main(int argc, char* argv[]) { } if (currspeed == SPEED9600) { cspeed = B9600; + strcpy(offset, ",9600"); } else if (currspeed == SPEED19200) { cspeed = B19200; + strcpy(offset, ",19200"); } else if (currspeed == SPEED57600) { cspeed = B57600; + strcpy(offset, ",57600"); } else if (currspeed == SPEED115200) { cspeed = B115200; - } else if (currspeed == SPEED115200) { - cspeed = 0; + strcpy(offset, ",115200"); } else { exit(0); } diff --git a/misc/confluent-cmdline.sh.rh8 b/misc/confluent-cmdline.sh.rh8 index 517382ef..451ac884 100644 --- a/misc/confluent-cmdline.sh.rh8 +++ b/misc/confluent-cmdline.sh.rh8 @@ -1,5 +1,9 @@ #!/bin/bash echo -n "" >> /tmp/net.ifaces cat /tls/*.pem >> /etc/pki/tls/certs/ca-bundle.crt +autocons=$(/opt/confluent/bin/autocons) +if [ -n "$autocons" ]; then + echo console=$autocons >> /etc/cmdline.d/01-autocons +fi . /lib/anaconda-lib.sh wait_for_kickstart