]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
autologin: add dropin for ttyAMA0 on arm64
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Thu, 16 Nov 2023 09:38:53 +0000 (10:38 +0100)
committerJoerg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 17 Nov 2023 15:24:28 +0000 (16:24 +0100)
ARM64 hardware uses the PL011 driver, which exposes serial terminals as
ttyAMA0.

Fixes: #2068
mkosi/__init__.py

index 6900d453be7d2106c2d7d42f13bd3e6155f40b86..ad1302260b5f1adcf198679ab2bade4193d5444b 100644 (file)
@@ -286,6 +286,21 @@ def configure_autologin(state: MkosiState) -> None:
                 """  # noqa: E501
             )
 
+        if state.config.architecture == Architecture.arm64:
+            dropin = state.root / "usr/lib/systemd/system/serial-getty@ttyAMA0.service.d/autologin.conf"
+            with umask(~0o755):
+                dropin.parent.mkdir(parents=True, exist_ok=True)
+            with umask(~0o644):
+                dropin.write_text(
+                    """\
+                    [Service]
+                    ExecStart=
+                    ExecStart=-/sbin/agetty -o '-f -p -- \\\\u' --autologin root --keep-baud 115200,57600,38400,9600 - $TERM
+                    StandardInput=tty
+                    StandardOutput=tty
+                    """  # noqa: E501
+                )
+
 
 @contextlib.contextmanager
 def mount_cache_overlay(state: MkosiState) -> Iterator[None]: