summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-03-03 16:15:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-06 11:16:46 +0000
commitd1eaffbd6bde845c3fcd81660b694e1ea1f46ab2 (patch)
tree15aa7d739adafe7d8cc3ca05f325542d03a960aa
parent5935e0ab576b812109421ace647e635adb4f49dc (diff)
downloadpoky-d1eaffbd6bde845c3fcd81660b694e1ea1f46ab2.tar.gz
systemd-serialgetty: use existing unit files in systemd
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. This ensures that the getty units triggered by the systemd are identical, be them via SERIAL_CONSOLES or the generator. (From OE-Core rev: b6a7617145c3acf9f79888e7555e7706cd55a350) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb13
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service45
2 files changed, 1 insertions, 57 deletions
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index daac7f4198..c3fe9d5b6d 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -9,13 +9,6 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;m
9# required. This recipe (enabled via disabling serial-getty-generator in systemd) 9# required. This recipe (enabled via disabling serial-getty-generator in systemd)
10# should only be used if the generator is not appropriate. 10# should only be used if the generator is not appropriate.
11 11
12SERIAL_TERM ?= "linux"
13
14SRC_URI = "file://serial-getty@.service"
15
16S = "${WORKDIR}/sources"
17UNPACKDIR = "${S}"
18
19# As this package is tied to systemd, only build it when we're also building systemd. 12# As this package is tied to systemd, only build it when we're also building systemd.
20inherit features_check 13inherit features_check
21REQUIRED_DISTRO_FEATURES += "systemd" 14REQUIRED_DISTRO_FEATURES += "systemd"
@@ -24,11 +17,7 @@ REQUIRED_DISTRO_FEATURES += "usrmerge"
24do_install() { 17do_install() {
25 if [ ! -z "${SERIAL_CONSOLES}" ] ; then 18 if [ ! -z "${SERIAL_CONSOLES}" ] ; then
26 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` 19 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
27 install -d ${D}${systemd_system_unitdir}/
28 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ 20 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
29 install -m 0644 ${S}/serial-getty@.service ${D}${systemd_system_unitdir}/
30 sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service
31 sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service
32 21
33 tmp="${SERIAL_CONSOLES}" 22 tmp="${SERIAL_CONSOLES}"
34 for entry in $tmp ; do 23 for entry in $tmp ; do
@@ -51,7 +40,7 @@ do_install() {
51} 40}
52 41
53# This is a machine specific file 42# This is a machine specific file
54FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}"
55PACKAGE_ARCH = "${MACHINE_ARCH}" 43PACKAGE_ARCH = "${MACHINE_ARCH}"
44FILES:${PN} = "${sysconfdir}"
56 45
57ALLOW_EMPTY:${PN} = "1" 46ALLOW_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 b16fe1188e..0000000000
--- a/meta/recipes-core/systemd/systemd-serialgetty/serial-getty@.service
+++ /dev/null
@@ -1,45 +0,0 @@
1# SPDX-License-Identifier: LGPL-2.1+
2#
3# This file is part of systemd.
4#
5# systemd is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; either version 2.1 of the License, or
8# (at your option) any later version.
9
10[Unit]
11Description=Serial Getty on %I
12Documentation=man:agetty(8) man:systemd-getty-generator(8)
13Documentation=http://0pointer.de/blog/projects/serial-console.html
14PartOf=dev-%i.device
15ConditionPathExists=/dev/%i
16After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
17After=rc-local.service
18
19# If additional gettys are spawned during boot then we should make
20# sure that this is synchronized before getty.target, even though
21# getty.target didn't actually pull it in.
22Before=getty.target
23IgnoreOnIsolate=yes
24
25# IgnoreOnIsolate causes issues with sulogin, if someone isolates
26# rescue.target or starts rescue.service from multi-user.target or
27# graphical.target.
28Conflicts=rescue.service
29Before=rescue.service
30
31[Service]
32Environment="TERM=@TERM@"
33ExecStart=-/sbin/agetty -8 -L %I @BAUDRATE@ $TERM
34Type=idle
35Restart=always
36UtmpIdentifier=%I
37TTYPath=/dev/%I
38TTYReset=yes
39TTYVHangup=yes
40KillMode=process
41IgnoreSIGPIPE=no
42SendSIGHUP=yes
43
44[Install]
45WantedBy=getty.target