diff mbox series

[1/1] board/raspberrypi: enable hdmi console for systemd

Message ID 20230812050845.1551717-1-alexey.roslyakov@gmail.com
State Accepted
Headers show
Series [1/1] board/raspberrypi: enable hdmi console for systemd | expand

Commit Message

Alexey Roslyakov Aug. 12, 2023, 5:08 a.m. UTC
Most of the users use HDMI console on RPi and with increasing popularity
of systemd they face a trouble.
systemd doesn't use /etc/inittab, enable getty@tty1.service instead.

Signed-off-by: Alexey Roslyakov <alexey.roslyakov@gmail.com>
---
 board/raspberrypi/post-build.sh | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Thomas Petazzoni Aug. 12, 2023, 10:47 a.m. UTC | #1
Hello Alexey,

On Sat, 12 Aug 2023 13:08:45 +0800
Alexey Roslyakov <alexey.roslyakov@gmail.com> wrote:

> Most of the users use HDMI console on RPi and with increasing popularity
> of systemd they face a trouble.
> systemd doesn't use /etc/inittab, enable getty@tty1.service instead.
> 
> Signed-off-by: Alexey Roslyakov <alexey.roslyakov@gmail.com>
> ---
>  board/raspberrypi/post-build.sh | 6 ++++++
>  1 file changed, 6 insertions(+)

Applied to master, but slightly reworked to avoid the nested if
condition:

 tty1::respawn:/sbin/getty -L  tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
+# systemd doesn't use /etc/inittab, enable getty.tty1.service instead
+elif [ -d ${TARGET_DIR}/etc/systemd ]; then
+    mkdir -p "${TARGET_DIR}/etc/systemd/system/getty.target.wants"
+    ln -sf /lib/systemd/system/getty@.service \
+       "${TARGET_DIR}/etc/systemd/system/getty.target.wants/getty@tty1.service"
 fi

Thanks!

Thomas
Peter Korsgaard Sept. 12, 2023, 6:05 a.m. UTC | #2
>>>>> "Alexey" == Alexey Roslyakov <alexey.roslyakov@gmail.com> writes:

 > Most of the users use HDMI console on RPi and with increasing popularity
 > of systemd they face a trouble.
 > systemd doesn't use /etc/inittab, enable getty@tty1.service instead.

 > Signed-off-by: Alexey Roslyakov <alexey.roslyakov@gmail.com>

Committed to 2023.02.x and 2023.05.x, thanks.
diff mbox series

Patch

diff --git a/board/raspberrypi/post-build.sh b/board/raspberrypi/post-build.sh
index b24256fcea..5da989f37c 100755
--- a/board/raspberrypi/post-build.sh
+++ b/board/raspberrypi/post-build.sh
@@ -8,6 +8,12 @@  if [ -e ${TARGET_DIR}/etc/inittab ]; then
     grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
 	sed -i '/GENERIC_SERIAL/a\
 tty1::respawn:/sbin/getty -L  tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab
+else
+	# systemd doesn't use /etc/inittab, enable getty.tty1.service instead
+	if [ -d ${TARGET_DIR}/etc/systemd ]; then
+		mkdir -p "${TARGET_DIR}/etc/systemd/system/getty.target.wants"
+		ln -sf "/lib/systemd/system/getty@.service" "${TARGET_DIR}/etc/systemd/system/getty.target.wants/getty@tty1.service"
+	fi
 fi
 
 # exnsure overlays exists for genimage