mirror of
https://abf.rosa.ru/djam/kernel-5.10.git
synced 2025-02-25 01:32:48 +00:00
Allow to set the default loglevel threshold for the console at build time
...And set it to 3, which should only allow to print the messages with KERN_EMERG, KERN_ALERT and KERN_CRIT levels. This should make the boot process less noisy. Can be overridden with loglevel=n boot option.
This commit is contained in:
parent
b903081a5c
commit
3663fa6899
4 changed files with 90 additions and 0 deletions
|
@ -7969,6 +7969,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
|
||||||
# printk and dmesg options
|
# printk and dmesg options
|
||||||
#
|
#
|
||||||
CONFIG_PRINTK_TIME=y
|
CONFIG_PRINTK_TIME=y
|
||||||
|
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=3
|
||||||
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
|
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
|
||||||
CONFIG_BOOT_PRINTK_DELAY=y
|
CONFIG_BOOT_PRINTK_DELAY=y
|
||||||
CONFIG_DYNAMIC_DEBUG=y
|
CONFIG_DYNAMIC_DEBUG=y
|
||||||
|
|
|
@ -7790,6 +7790,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
|
||||||
# printk and dmesg options
|
# printk and dmesg options
|
||||||
#
|
#
|
||||||
CONFIG_PRINTK_TIME=y
|
CONFIG_PRINTK_TIME=y
|
||||||
|
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=3
|
||||||
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
|
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
|
||||||
CONFIG_BOOT_PRINTK_DELAY=y
|
CONFIG_BOOT_PRINTK_DELAY=y
|
||||||
CONFIG_DYNAMIC_DEBUG=y
|
CONFIG_DYNAMIC_DEBUG=y
|
||||||
|
|
|
@ -216,6 +216,7 @@ Patch200: i915_hack_bug_97822.patch
|
||||||
|
|
||||||
# Patches from mainline.
|
# Patches from mainline.
|
||||||
Patch300: rt2800-enable-rt3290-unconditionally-on-pci-probe.patch
|
Patch300: rt2800-enable-rt3290-unconditionally-on-pci-probe.patch
|
||||||
|
Patch301: printk-add-Kconfig-option-to-set-default-console-loglevel.patch
|
||||||
|
|
||||||
# Sanitizing kernel memory
|
# Sanitizing kernel memory
|
||||||
# We do not use "Patch:" here because apply_patches would always apply it
|
# We do not use "Patch:" here because apply_patches would always apply it
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
From a8cfdc68f6cfc0c7ffc6d664406fe7f06f17eef4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Olof Johansson <olof@lixom.net>
|
||||||
|
Date: Mon, 12 Dec 2016 16:45:56 -0800
|
||||||
|
Subject: [PATCH] printk: add Kconfig option to set default console loglevel
|
||||||
|
|
||||||
|
Add a configuration option to set the default console loglevel. This
|
||||||
|
is, as before, still possible to override at runtime through bootargs
|
||||||
|
(loglevel=<x>), sysrq and /proc/printk.
|
||||||
|
|
||||||
|
There are cases where adding additional arguments on the commandline is
|
||||||
|
impractical, and changing the default for the kernel when being built
|
||||||
|
makes more sense. Provide such a method here, for those who choose to
|
||||||
|
do so.
|
||||||
|
|
||||||
|
Also, while touching this code, clarify the difference between
|
||||||
|
MESSAGE_LOGLEVEL_DEFAULT and CONSOLE_LOGLEVEL_DEFAULT.
|
||||||
|
|
||||||
|
Link: http://lkml.kernel.org/r/1479676829-30031-1-git-send-email-olof@lixom.net
|
||||||
|
Signed-off-by: Olof Johansson <olof@lixom.net>
|
||||||
|
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
|
||||||
|
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||||
|
---
|
||||||
|
include/linux/printk.h | 7 ++++++-
|
||||||
|
lib/Kconfig.debug | 19 +++++++++++++++++++
|
||||||
|
2 files changed, 25 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/include/linux/printk.h b/include/linux/printk.h
|
||||||
|
index afe8cce..3472cc6 100644
|
||||||
|
--- a/include/linux/printk.h
|
||||||
|
+++ b/include/linux/printk.h
|
||||||
|
@@ -50,10 +50,15 @@ static inline const char *printk_skip_headers(const char *buffer)
|
||||||
|
#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
|
||||||
|
#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */
|
||||||
|
#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */
|
||||||
|
-#define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */
|
||||||
|
#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */
|
||||||
|
#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Default used to be hard-coded at 7, we're now allowing it to be set from
|
||||||
|
+ * kernel config.
|
||||||
|
+ */
|
||||||
|
+#define CONSOLE_LOGLEVEL_DEFAULT CONFIG_CONSOLE_LOGLEVEL_DEFAULT
|
||||||
|
+
|
||||||
|
extern int console_printk[];
|
||||||
|
|
||||||
|
#define console_loglevel (console_printk[0])
|
||||||
|
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
|
||||||
|
index 9bb7d82..65a619e 100644
|
||||||
|
--- a/lib/Kconfig.debug
|
||||||
|
+++ b/lib/Kconfig.debug
|
||||||
|
@@ -15,6 +15,21 @@ config PRINTK_TIME
|
||||||
|
The behavior is also controlled by the kernel command line
|
||||||
|
parameter printk.time=1. See Documentation/kernel-parameters.txt
|
||||||
|
|
||||||
|
+config CONSOLE_LOGLEVEL_DEFAULT
|
||||||
|
+ int "Default console loglevel (1-15)"
|
||||||
|
+ range 1 15
|
||||||
|
+ default "7"
|
||||||
|
+ help
|
||||||
|
+ Default loglevel to determine what will be printed on the console.
|
||||||
|
+
|
||||||
|
+ Setting a default here is equivalent to passing in loglevel=<x> in
|
||||||
|
+ the kernel bootargs. loglevel=<x> continues to override whatever
|
||||||
|
+ value is specified here as well.
|
||||||
|
+
|
||||||
|
+ Note: This does not affect the log level of un-prefixed prink()
|
||||||
|
+ usage in the kernel. That is controlled by the MESSAGE_LOGLEVEL_DEFAULT
|
||||||
|
+ option.
|
||||||
|
+
|
||||||
|
config MESSAGE_LOGLEVEL_DEFAULT
|
||||||
|
int "Default message log level (1-7)"
|
||||||
|
range 1 7
|
||||||
|
@@ -26,6 +41,10 @@ config MESSAGE_LOGLEVEL_DEFAULT
|
||||||
|
that are auditing their logs closely may want to set it to a lower
|
||||||
|
priority.
|
||||||
|
|
||||||
|
+ Note: This does not affect what message level gets printed on the console
|
||||||
|
+ by default. To change that, use loglevel=<x> in the kernel bootargs,
|
||||||
|
+ or pick a different CONSOLE_LOGLEVEL_DEFAULT configuration value.
|
||||||
|
+
|
||||||
|
config BOOT_PRINTK_DELAY
|
||||||
|
bool "Delay each boot printk message by N milliseconds"
|
||||||
|
depends on DEBUG_KERNEL && PRINTK && GENERIC_CALIBRATE_DELAY
|
||||||
|
--
|
||||||
|
2.7.3
|
||||||
|
|
Loading…
Add table
Reference in a new issue