]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Only add console=ttyS0 and tty sizes when QemuGui= is disabled
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 2 Oct 2023 08:24:19 +0000 (10:24 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 2 Oct 2023 08:46:14 +0000 (10:46 +0200)
With console=ttyS0, we don't get any boot logs when running qemu
in GUI mode. The tty sizes don't matter either when booting in GUI
mode as Linux can figure it out itself in that scenario.

mkosi/config.py

index 8c58d8dd05a0c8592cb2f715ada45194c8b01df6..03d3698da030555c76a8c1240286eda87a47ad86 100644 (file)
@@ -2260,16 +2260,7 @@ def load_credentials(args: argparse.Namespace) -> dict[str, str]:
 
 
 def load_kernel_command_line_extra(args: argparse.Namespace) -> list[str]:
-    columns, lines = shutil.get_terminal_size()
-
     cmdline = [
-        f"systemd.tty.term.console={os.getenv('TERM', 'vt220')}",
-        f"systemd.tty.columns.console={columns}",
-        f"systemd.tty.rows.console={lines}",
-        f"systemd.tty.term.ttyS0={os.getenv('TERM', 'vt220')}",
-        f"systemd.tty.columns.ttyS0={columns}",
-        f"systemd.tty.rows.ttyS0={lines}",
-        "console=ttyS0",
         # Make sure we set up networking in the VM/container.
         "systemd.wants=network.target",
         # Make sure we don't load vmw_vmci which messes with virtio vsock.
@@ -2289,6 +2280,18 @@ def load_kernel_command_line_extra(args: argparse.Namespace) -> list[str]:
         # CD-ROMs are read-only so tell systemd to boot in volatile mode.
         cmdline += ["systemd.volatile=yes"]
 
+    if not args.qemu_gui:
+        columns, lines = shutil.get_terminal_size()
+        cmdline += [
+            f"systemd.tty.term.console={os.getenv('TERM', 'vt220')}",
+            f"systemd.tty.columns.console={columns}",
+            f"systemd.tty.rows.console={lines}",
+            f"systemd.tty.term.ttyS0={os.getenv('TERM', 'vt220')}",
+            f"systemd.tty.columns.ttyS0={columns}",
+            f"systemd.tty.rows.ttyS0={lines}",
+            "console=ttyS0",
+        ]
+
     for s in args.kernel_command_line_extra:
         key, sep, value = s.partition("=")
         if " " in value: