From ec17cea5e68768c2902b80138a9fe805690d19cc Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Fri, 22 Feb 2019 10:52:26 -0800 Subject: [PATCH] systemd: enable switch debug-tty to provide a debug console This allows us to use the default debug-shell.service provided by systemd and cut down on custom made services. This will also always provide a debug shell as there is no reason we shouldn't have access to one. --- distributions/LibreELEC/options | 2 ++ packages/sysutils/busybox/package.mk | 1 - .../busybox/system.d/debug-shell.service | 25 ------------------- packages/sysutils/systemd/package.mk | 7 +++--- .../lib/systemd/system/serial-console.service | 23 ----------------- projects/Allwinner/options | 4 +++ .../lib/systemd/system/serial-console.service | 23 ----------------- projects/RPi/options | 3 +++ .../lib/systemd/system/serial-console.service | 24 ------------------ projects/Rockchip/options | 3 +++ 10 files changed, 15 insertions(+), 100 deletions(-) delete mode 100644 packages/sysutils/busybox/system.d/debug-shell.service delete mode 100644 projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service delete mode 100644 projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service delete mode 100644 projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service diff --git a/distributions/LibreELEC/options b/distributions/LibreELEC/options index cb446938e4a..3267ebdf085 100644 --- a/distributions/LibreELEC/options +++ b/distributions/LibreELEC/options @@ -225,3 +225,5 @@ # IR remote keymaps supported in default config IR_REMOTE_KEYMAPS="rc6_mce xbox_360 xbox_one" +# debug tty path + DEBUG_TTY="/dev/tty3" diff --git a/packages/sysutils/busybox/package.mk b/packages/sysutils/busybox/package.mk index bd982ae9447..48b2cfe2327 100644 --- a/packages/sysutils/busybox/package.mk +++ b/packages/sysutils/busybox/package.mk @@ -177,7 +177,6 @@ post_install() { add_user nobody x 65534 65534 "Nobody" "/" "/bin/sh" add_group nogroup 65534 - enable_service debug-shell.service enable_service shell.service enable_service show-version.service enable_service var.mount diff --git a/packages/sysutils/busybox/system.d/debug-shell.service b/packages/sysutils/busybox/system.d/debug-shell.service deleted file mode 100644 index ce7cfc45b3a..00000000000 --- a/packages/sysutils/busybox/system.d/debug-shell.service +++ /dev/null @@ -1,25 +0,0 @@ -[Unit] -Description=Debug Shell - -DefaultDependencies=no -ConditionKernelCommandLine=|tty -ConditionKernelCommandLine=|debugging -ConditionPathExists=|/storage/.cache/debug.libreelec - -[Service] -Environment=TTY=3 -WorkingDirectory=/storage -ExecStart=/bin/sh -c '. /etc/profile; exec /bin/sh' -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/tty3 -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index dc28ebba2ac..2dfff8b2aec 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -88,7 +88,8 @@ PKG_MESON_OPTS_TARGET="--libdir=/usr/lib \ -Dzshcompletiondir=no \ -Dkmod-path=/usr/bin/kmod \ -Dmount-path=/usr/bin/mount \ - -Dumount-path=/usr/bin/umount" + -Dumount-path=/usr/bin/umount \ + -Ddebug-tty=$DEBUG_TTY" pre_configure_target() { export CFLAGS="$CFLAGS -fno-schedule-insns -fno-schedule-insns2 -Wno-format-truncation" @@ -127,9 +128,6 @@ post_makeinstall_target() { safe_remove $INSTALL/usr/lib/udev/rules.d/71-seat.rules safe_remove $INSTALL/usr/lib/udev/rules.d/73-seat-late.rules - # remove debug-shell.service, we install our own - safe_remove $INSTALL/usr/lib/systemd/system/debug-shell.service - # remove getty units, we dont want a console safe_remove $INSTALL/usr/lib/systemd/system/autovt@.service safe_remove $INSTALL/usr/lib/systemd/system/console-getty.service @@ -258,4 +256,5 @@ post_install() { enable_service usercache.service enable_service kernel-overlays.service enable_service hwdb.service + enable_service debug-shell.service } diff --git a/projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 196e8c4a97a..00000000000 --- a/projects/Allwinner/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/console -DefaultDependencies=no -ConditionKernelCommandLine=console - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/console -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/Allwinner/options b/projects/Allwinner/options index bc5690cb934..774d2fe9b9a 100644 --- a/projects/Allwinner/options +++ b/projects/Allwinner/options @@ -85,3 +85,7 @@ # build with installer (yes / no) INSTALLER_SUPPORT="no" + + # debug tty path + DEBUG_TTY="/dev/console" + diff --git a/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service b/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 196e8c4a97a..00000000000 --- a/projects/RPi/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/console -DefaultDependencies=no -ConditionKernelCommandLine=console - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/console -TTYReset=yes -TTYVHangup=yes -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/RPi/options b/projects/RPi/options index 172f569997c..686e74f015f 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -137,3 +137,6 @@ # for a list of additional drivers see packages/linux-driver-addons # Space separated list is supported, DRIVER_ADDONS="crazycat dvb-latest" + + # debug tty path + DEBUG_TTY="/dev/console" diff --git a/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service b/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service deleted file mode 100644 index 80d27f78c0d..00000000000 --- a/projects/Rockchip/filesystem/usr/lib/systemd/system/serial-console.service +++ /dev/null @@ -1,24 +0,0 @@ -[Unit] -Description=Debug Shell on /dev/ttyS2 -DefaultDependencies=no -ConditionKernelCommandLine=|console=ttyS2 -ConditionKernelCommandLine=|console=uart8250,mmio32,0xff130000 -ConditionKernelCommandLine=|console=uart8250,mmio32,0xff1a0000 -ConditionKernelCommandLine=|console=uart8250,mmio32,0xff690000 - -[Service] -WorkingDirectory=/storage -Environment="ENV=/etc/profile" -ExecStartPre=/bin/sh -c 'echo -en "\033[?25h"' -ExecStart=/bin/sh -Restart=always -RestartSec=0 -StandardInput=tty -TTYPath=/dev/ttyS2 -KillMode=process -IgnoreSIGPIPE=no -# bash ignores SIGTERM -KillSignal=SIGHUP - -[Install] -WantedBy=sysinit.target diff --git a/projects/Rockchip/options b/projects/Rockchip/options index 4d9e18fab60..cbc817952c5 100644 --- a/projects/Rockchip/options +++ b/projects/Rockchip/options @@ -85,3 +85,6 @@ # for a list of additinoal drivers see packages/linux-driver-addons # Space separated list is supported, DRIVER_ADDONS="crazycat dvb-latest" + + # debug tty path + DEBUG_TTY="/dev/ttyS2"