mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
90 lines
3.3 KiB
Diff
90 lines
3.3 KiB
Diff
From 340cae4afd0d11979322a6c2f4d40a12ea59817b Mon Sep 17 00:00:00 2001
|
|
From: Joachim Wiberg <troglobit@gmail.com>
|
|
Date: Wed, 24 Apr 2024 12:46:59 +0200
|
|
Subject: [PATCH 11/11] Change default behavior, allow kernel logs to console
|
|
Organization: Addiva Elektronik
|
|
|
|
A Linux system booted with the kernel command line option 'quiet' only
|
|
logs error (and above) severity messages to the console. For embedded
|
|
systems, which is the primary target for Finit, this is what you want
|
|
to see.
|
|
|
|
Hence, and after careful consideration, this patch changes the default
|
|
behavior of Finit to allow kernel logs to the console. A build-time
|
|
configure flags, --disable-kernel-logging, has been added to restore
|
|
legacy behavior.
|
|
|
|
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
|
|
---
|
|
configure.ac | 9 +++++++++
|
|
src/finit.c | 14 +++++++++++---
|
|
2 files changed, 20 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index a4470d0..31f4cff 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -71,6 +71,10 @@ AC_ARG_ENABLE(redirect,
|
|
AS_HELP_STRING([--disable-redirect], [Disable redirection of service output to /dev/null]),,[
|
|
enable_redirect=yes])
|
|
|
|
+AC_ARG_ENABLE(kernel_logging,
|
|
+ AS_HELP_STRING([--disable-kernel-logging], [Disable kernel logging to console (use 'quiet' instead!]),,[
|
|
+ enable_kernel_logging=yes])
|
|
+
|
|
AC_ARG_ENABLE(logrotate,
|
|
AS_HELP_STRING([--disable-logrotate], [Disable built-in rotation of /var/log/wtmp]),,[
|
|
enable_logrotate=yes])
|
|
@@ -181,6 +185,9 @@ AS_IF([test "x$enable_auto_reload" = "xyes"], [
|
|
AS_IF([test "x$enable_kernel_cmdline" = "xyes"], [
|
|
AC_DEFINE(KERNEL_CMDLINE, 1, [Dumpster diving after init args from /proc/cmdline])])
|
|
|
|
+AS_IF([test "x$enable_kernel_logging" = "xyes"], [
|
|
+ AC_DEFINE(KERNEL_LOGGING, 1, [Keep kernel warn/err logs to console])])
|
|
+
|
|
AS_IF([test "x$enable_fastboot" = "xyes"], [
|
|
AC_DEFINE(FAST_BOOT, 1, [Skip fsck check on filesystems listed in /etc/fstab])])
|
|
|
|
@@ -382,6 +389,8 @@ Optional features:
|
|
Built-in sulogin......: $with_sulogin $sulogin
|
|
Built-in watchdogd....: $with_watchdog $watchdog
|
|
Built-in logrotate....: $enable_logrotate
|
|
+ Parse kernel cmdline..: $enable_kernel_cmdline
|
|
+ Keep kernel logging...: $enable_kernel_logging
|
|
Skip fsck check.......: $enable_fastboot
|
|
Run fsck fix mode.....: $enable_fsckfix
|
|
Redirect output.......: $enable_redirect
|
|
diff --git a/src/finit.c b/src/finit.c
|
|
index 27b81e9..38b1278 100644
|
|
--- a/src/finit.c
|
|
+++ b/src/finit.c
|
|
@@ -87,14 +87,22 @@ svc_t *wdog = NULL; /* No watchdog by default */
|
|
*/
|
|
static void banner(void)
|
|
{
|
|
+#ifndef KERNEL_LOGGING
|
|
/*
|
|
* Silence kernel logs, assuming users have sysklogd or
|
|
- * similar enabled to start emptying /dev/kmsg, but for
|
|
- * our progress we want to own the console.
|
|
+ * similar enabled to start emptying /dev/kmsg.
|
|
+ *
|
|
+ * Instead of using `configure --disable-kernel-logging`, we
|
|
+ * recommend adjusting the kernel log level in the kernel's
|
|
+ * menuconfig, or using sysctl kernel.printk, or setting the
|
|
+ * desired log level, on the kernel cmdline, e.g. 'quiet'.
|
|
+ *
|
|
+ * By default KERNEL_LOGGING is enabled so you can see any
|
|
+ * warnings/errors or higher on your system console.
|
|
*/
|
|
if (!debug && !kerndebug)
|
|
klogctl(6, NULL, 0);
|
|
-
|
|
+#endif
|
|
/*
|
|
* First level hooks, if you want to run here, you're
|
|
* pretty much on your own. Nothing's up yet ...
|
|
--
|
|
2.34.1
|
|
|