"--noclear --keep-baud console 115200,38400,9600")
configure_autologin_service(context, "getty@tty1.service",
"--noclear -")
- configure_autologin_service(context, "serial-getty@ttyS0.service",
+ configure_autologin_service(context,
+ "serial-getty@hvc0.service",
"--keep-baud 115200,57600,38400,9600 -")
- if context.config.architecture.default_serial_tty() != "ttyS0":
- configure_autologin_service(context,
- f"serial-getty@{context.config.architecture.default_serial_tty()}.service",
- "--keep-baud 115200,57600,38400,9600 -")
-
@contextlib.contextmanager
def mount_cache_overlay(context: Context, cached: bool) -> Iterator[None]:
return a
- def default_serial_tty(self) -> str:
- return {
- Architecture.arm : "ttyAMA0",
- Architecture.arm64 : "ttyAMA0",
- Architecture.s390 : "ttysclp0",
- Architecture.s390x : "ttysclp0",
- Architecture.ppc : "hvc0",
- Architecture.ppc64 : "hvc0",
- Architecture.ppc64_le : "hvc0",
- }.get(self, "ttyS0")
-
def supports_smbios(self, firmware: QemuFirmware) -> bool:
if self.is_x86_variant():
return True
def load_kernel_command_line_extra(args: argparse.Namespace) -> list[str]:
- tty = args.architecture.default_serial_tty()
columns, lines = shutil.get_terminal_size()
term = finalize_term()
"systemd.wants=network.target",
# Make sure we don't load vmw_vmci which messes with virtio vsock.
"module_blacklist=vmw_vmci",
- f"systemd.tty.term.{tty}={term}",
- f"systemd.tty.columns.{tty}={columns}",
- f"systemd.tty.rows.{tty}={lines}",
+ f"systemd.tty.term.hvc0={term}",
+ f"systemd.tty.columns.hvc0={columns}",
+ f"systemd.tty.rows.hvc0={lines}",
]
if not any(s.startswith("ip=") for s in args.kernel_command_line_extra):
f"systemd.tty.term.console={term}",
f"systemd.tty.columns.console={columns}",
f"systemd.tty.rows.console={lines}",
- f"console={tty}",
+ "console=hvc0",
f"TERM={term}",
]
"-nographic",
"-nodefaults",
"-chardev", "stdio,mux=on,id=console,signal=off",
- "-serial", "chardev:console",
+ "-device", "virtio-serial-pci,id=mkosi-virtio-serial-pci",
+ "-device", "virtconsole,chardev=console",
"-mon", "console",
]
`Autologin=`, `--autologin`
: Enable autologin for the `root` user on `/dev/pts/0` (nspawn),
- `/dev/tty1` and `/dev/ttyS0`.
+ `/dev/tty1` and `/dev/hvc0`.
`MakeInitrd=`, `--make-initrd`
: Add `/etc/initrd-release` and `/init` to the image so that it can be
import pytest
-from mkosi.config import Architecture, finalize_term
+from mkosi.config import finalize_term
from mkosi.distributions import Distribution
from mkosi.run import run
from mkosi.types import _FILE, CompletedProcess, PathString
check: bool = True,
) -> CompletedProcess:
kcl = [
- f"console={Architecture.native().default_serial_tty()}",
f"TERM={finalize_term()}",
"loglevel=6",
"systemd.crash_shell",