[PATCH anaconda:rhel7/master] Change the string used to test for serial console (#1054951)

d.marlin dmarlin at redhat.com
Mon Jan 27 22:33:40 UTC 2014


The string used to test for serial console is a literal ("ttyS").  To support
serial consoles other than those starting with "ttyS", such as ttyAMA0 for ARM,
create a list of string values that may be used.  Add a property to test if
the console device starts with any of these strings.

Note: 64-bit ARM (aarch64) hardware may use either ttyS0 or ttyAMA0 for the
serial console.  The Foundation Model simulator currently uses ttyAMA0.

Resolves: rhbz#1054951

Signed-off-by: David A. Marlin <dmarlin at redhat.com>
---
 pyanaconda/bootloader.py |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 1fe292f..cab0c1b 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1004,6 +1004,8 @@ class GRUB(BootLoader):
 
     packages = ["grub"]
 
+    _serial_console = ["ttyS"]
+
     def __init__(self):
         super(GRUB, self).__init__()
         self.encrypted_password = ""
@@ -1055,9 +1057,18 @@ class GRUB(BootLoader):
         return GRUB._config_dir
 
     @property
+    def hasSerialConsole(self):
+        """ true if the console is a serial console. """
+        for _console in self._serial_console:
+            if self.console.startswith(_console):
+              return True
+        return False
+
+
+    @property
     def serial_command(self):
         command = ""
-        if self.console and self.console.startswith("ttyS"):
+        if self.console and self.hasSerialConsole:
             unit = self.console[-1]
             command = ["serial"]
             s = parse_serial_opt(self.console_options)
@@ -1082,7 +1093,7 @@ class GRUB(BootLoader):
         if not self.console:
             return
 
-        if self.console.startswith("ttyS"):
+        if self.hasSerialConsole:
             config.write("%s\n" % self.serial_command)
             config.write("terminal --timeout=%s serial console\n"
                          % self.timeout)
@@ -1462,7 +1473,7 @@ class GRUB2(GRUB):
         defaults.write("GRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' /etc/system-release)\"\n")
         defaults.write("GRUB_DEFAULT=saved\n")
         defaults.write("GRUB_DISABLE_SUBMENU=true\n")
-        if self.console and self.console.startswith("ttyS"):
+        if self.console and self.hasSerialConsole:
             defaults.write("GRUB_TERMINAL=\"serial console\"\n")
             defaults.write("GRUB_SERIAL_COMMAND=\"%s\"\n" % self.serial_command)
         else:
@@ -1730,6 +1741,9 @@ class EFIGRUB(GRUB2):
 class Aarch64EFIGRUB(EFIGRUB):
     packages = ["grub2-efi", "grubby"]
 
+    _serial_console = ["ttyAMA", "ttyS"]
+
+
 class MacEFIGRUB(EFIGRUB):
     def mactel_config(self):
         if os.path.exists(ROOT_PATH + "/usr/libexec/mactel-boot-setup"):
-- 
1.7.1



More information about the anaconda-patches mailing list