Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@arm.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 2/2] systemd: use getty generators by default
Date: Thu, 30 Jan 2025 17:59:01 +0000	[thread overview]
Message-ID: <20250130175901.938043-2-ross.burton@arm.com> (raw)
In-Reply-To: <20250130175901.938043-1-ross.burton@arm.com>

systemd can automatically create getty service units at boot time by
probing the hardware: if will check for a list of known hypervisor
consoles and also spawn a getty on every active console.

However in a historical attempt to change as little behaviour as
possible, we disabled this and instead wrote hard-coded units at build
time that respect the SERIAL_CONSOLES variable.

This variable may be acceptable for fixed known platforms, but is not
usable for generic machines. The genericarm64 machine for example lists
a number of potential consoles:

- ttyAMA0: physical ARM PL011 uarts
- hvc0: hypervisor virtual console
- ttyS0-2: physical uarts

We have to list multiple ttyS? names because different platforms use
different devices: specifically on the BeaglePlay the Linux console is
ttyS2, with S0 and S1 being the uarts connecting the expansion port.

However, it's not ideal to randomly open ports and hope for the best:
with kernel 6.7 onwards a power management/tty bug results in system
hangs if a getty is sitting on ttyS1 (see #15704).

A better solution is to just use the getty generator in systemd: this
will automatically spawn gettys on any hypervisor consoles found and all
of the consoles that Linux is aware of. On the BeaglePlay this means
it puts a getty on just ttyS2, as expected.

The fixed configuration recipe is still present for people who wish to
have absolute control by simply disabling the serial-getty-generator
PACKAGECONFIG.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/systemd/systemd_257.1.bb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_257.1.bb b/meta/recipes-core/systemd/systemd_257.1.bb
index cdf72a50157..f464b979b07 100644
--- a/meta/recipes-core/systemd/systemd_257.1.bb
+++ b/meta/recipes-core/systemd/systemd_257.1.bb
@@ -92,6 +92,7 @@ PACKAGECONFIG ??= " \
     quotacheck \
     randomseed \
     resolved \
+    serial-getty-generator \
     set-time-epoch \
     sysusers \
     timedated \
@@ -126,7 +127,7 @@ TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"
 
 # Use the upstream systemd serial-getty@.service and rely on
 # systemd-getty-generator instead of using the OE-core specific
-# systemd-serialgetty.bb - not enabled by default.
+# systemd-serialgetty.bb
 PACKAGECONFIG[serial-getty-generator] = ""
 
 PACKAGECONFIG[acl] = "-Dacl=enabled,-Dacl=disabled,acl"
@@ -287,8 +288,10 @@ do_install() {
 		fi
 	fi
 	install -d ${D}/${base_sbindir}
+
 	if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
-		# Provided by a separate recipe
+		# Remove the serial-getty generator and instead use explicit services
+		# created by the systemd-serialgetty recipe
 		rm ${D}${systemd_system_unitdir}/serial-getty* -f
 	fi
 
-- 
2.43.0



  reply	other threads:[~2025-01-30 17:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30 17:59 [PATCH 1/2] systemd-serialgetty: add comments explaining use Ross Burton
2025-01-30 17:59 ` Ross Burton [this message]
2025-01-31  7:25   ` [OE-core] [PATCH 2/2] systemd: use getty generators by default Mikko Rapeli
2025-01-31 16:21     ` Ross Burton
2025-01-31 14:16 ` [OE-core] [PATCH 1/2] systemd-serialgetty: add comments explaining use Mathieu Dubois-Briand
2025-01-31 15:06   ` Ross Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250130175901.938043-2-ross.burton@arm.com \
    --to=ross.burton@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox