From patchwork Thu Feb 13 20:02:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 57289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2813AC021A6 for ; Thu, 13 Feb 2025 20:02:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.3752.1739476938619937869 for ; Thu, 13 Feb 2025 12:02:18 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 830DF113E for ; Thu, 13 Feb 2025 12:02:38 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 87CB13F58B for ; Thu, 13 Feb 2025 12:02:17 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/4] systemd: if getty generator is disabled remove the generator, not the units Date: Thu, 13 Feb 2025 20:02:09 +0000 Message-ID: <20250213200212.1694055-1-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 13 Feb 2025 20:02:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/211365 If the getty generator is disabled then it's neater to remove just the generator tool instead of the unit files as the unit files are still useful. Signed-off-by: Ross Burton --- meta/recipes-core/systemd/systemd_257.1.bb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_257.1.bb b/meta/recipes-core/systemd/systemd_257.1.bb index cdf72a50157..b9f17849671 100644 --- a/meta/recipes-core/systemd/systemd_257.1.bb +++ b/meta/recipes-core/systemd/systemd_257.1.bb @@ -287,9 +287,11 @@ 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 - rm ${D}${systemd_system_unitdir}/serial-getty* -f + + if ! ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'true', 'false', d)}; then + # Remove the serial-getty generator and instead use explicit services + # created by the systemd-serialgetty recipe + find ${D} -name \*getty-generator\* -delete fi # Provide support for initramfs From patchwork Thu Feb 13 20:02:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 57291 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29A8CC021A9 for ; Thu, 13 Feb 2025 20:02:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.3753.1739476938939129083 for ; Thu, 13 Feb 2025 12:02:19 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 27BAC1682 for ; Thu, 13 Feb 2025 12:02:39 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 37BD23F58B for ; Thu, 13 Feb 2025 12:02:18 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/4] systemd-serialgetty: use existing unit files in systemd Date: Thu, 13 Feb 2025 20:02:10 +0000 Message-ID: <20250213200212.1694055-2-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250213200212.1694055-1-ross.burton@arm.com> References: <20250213200212.1694055-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 13 Feb 2025 20:02:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/211366 Now that systemd isn't deleting the serial-getty@.service unit template files, we can simply symlink to the files provided by systemd instead of shipping a copy of them in this recipe. Signed-off-by: Ross Burton --- .../systemd/systemd-serialgetty.bb | 12 +---- .../systemd-serialgetty/serial-getty@.service | 45 ------------------- 2 files changed, 1 insertion(+), 56 deletions(-) delete mode 100644 meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index 7b525b10f0c..3798b07b1a8 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -10,12 +10,6 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;m # should only be used if the generator is not appropriate. SERIAL_CONSOLES ?= "115200;ttyS0" -SERIAL_TERM ?= "linux" - -SRC_URI = "file://serial-getty@.service" - -S = "${WORKDIR}/sources" -UNPACKDIR = "${S}" # As this package is tied to systemd, only build it when we're also building systemd. inherit features_check @@ -25,11 +19,7 @@ REQUIRED_DISTRO_FEATURES += "usrmerge" do_install() { if [ ! -z "${SERIAL_CONSOLES}" ] ; then default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` - install -d ${D}${systemd_system_unitdir}/ install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ - install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/ - sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service - sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service tmp="${SERIAL_CONSOLES}" for entry in $tmp ; do @@ -52,7 +42,7 @@ do_install() { } # This is a machine specific file -FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}" PACKAGE_ARCH = "${MACHINE_ARCH}" +FILES:${PN} = "${sysconfdir}" ALLOW_EMPTY:${PN} = "1" diff --git a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service b/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service deleted file mode 100644 index b16fe1188e7..00000000000 --- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service +++ /dev/null @@ -1,45 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1+ -# -# This file is part of systemd. -# -# systemd is free software; you can redistribute it and/or modify it -# under the terms of the GNU Lesser General Public License as published by -# the Free Software Foundation; either version 2.1 of the License, or -# (at your option) any later version. - -[Unit] -Description=Serial Getty on %I -Documentation=man:agetty(8) man:systemd-getty-generator(8) -Documentation=http://0pointer.de/blog/projects/serial-console.html -PartOf=dev-%i.device -ConditionPathExists=/dev/%i -After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target -After=rc-local.service - -# If additional gettys are spawned during boot then we should make -# sure that this is synchronized before getty.target, even though -# getty.target didn't actually pull it in. -Before=getty.target -IgnoreOnIsolate=yes - -# IgnoreOnIsolate causes issues with sulogin, if someone isolates -# rescue.target or starts rescue.service from multi-user.target or -# graphical.target. -Conflicts=rescue.service -Before=rescue.service - -[Service] -Environment="TERM=@TERM@" -ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM -Type=idle -Restart=always -UtmpIdentifier=%I -TTYPath=/dev/%I -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes - -[Install] -WantedBy=getty.target From patchwork Thu Feb 13 20:02:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 57288 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 248ACC021A7 for ; Thu, 13 Feb 2025 20:02:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.3557.1739476939811748634 for ; Thu, 13 Feb 2025 12:02:20 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CBABB113E for ; Thu, 13 Feb 2025 12:02:39 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D2B163F58B for ; Thu, 13 Feb 2025 12:02:18 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/4] systemd-serialgetty: don't set a default SERIAL_CONSOLES Date: Thu, 13 Feb 2025 20:02:11 +0000 Message-ID: <20250213200212.1694055-3-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250213200212.1694055-1-ross.burton@arm.com> References: <20250213200212.1694055-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 13 Feb 2025 20:02:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/211367 bitbake.conf defines a default value, so there's no value in setting another default here that doesn't match the rest of the system. Signed-off-by: Ross Burton --- meta/recipes-core/systemd/systemd-serialgetty.bb | 2 -- 1 file changed, 2 deletions(-) diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index 3798b07b1a8..c3fe9d5b6d4 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -9,8 +9,6 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;m # required. This recipe (enabled via disabling serial-getty-generator in systemd) # should only be used if the generator is not appropriate. -SERIAL_CONSOLES ?= "115200;ttyS0" - # As this package is tied to systemd, only build it when we're also building systemd. inherit features_check REQUIRED_DISTRO_FEATURES += "systemd" From patchwork Thu Feb 13 20:02:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 57290 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3389DC021A8 for ; Thu, 13 Feb 2025 20:02:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.3558.1739476940205723530 for ; Thu, 13 Feb 2025 12:02:20 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7B8361682 for ; Thu, 13 Feb 2025 12:02:40 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8294D3F58B for ; Thu, 13 Feb 2025 12:02:19 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH 4/4] sysvinit-inittab: exec getty from the wrapper Date: Thu, 13 Feb 2025 20:02:12 +0000 Message-ID: <20250213200212.1694055-4-ross.burton@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250213200212.1694055-1-ross.burton@arm.com> References: <20250213200212.1694055-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 13 Feb 2025 20:02:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/211368 Instead of forking, the start_getty wrapper can use exec to replace itself. This results in one less process in ps per getty. Signed-off-by: Ross Burton --- meta/recipes-core/sysvinit/sysvinit-inittab/start_getty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty index f5671ee53d2..f6a41428f76 100644 --- a/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty +++ b/meta/recipes-core/sysvinit/sysvinit-inittab/start_getty @@ -17,4 +17,4 @@ case $(readlink -f "${getty}") in ;; esac -${setsid:-} ${getty} ${options:-} -L $SPEED $DEVICE $TERM +exec ${setsid:-} ${getty} ${options:-} -L $SPEED $DEVICE $TERM