[patch 1/1] init/main.c: prevent increase of console_loglevel by 'quiet' kernel parameter
From: Sergey Popov
Date: Thu Jan 15 2015 - 10:00:12 EST
From: Sergey Popov <popov_sergey@xxxxxxx>
Prevent increase of console_loglevel by 'quiet'
'quiet' kernel option that follows the 'loglevel=N' should
not blindly overwrite console_loglevel, instead it should
respect and keep lower 'loglevel'.
Signed-off-by: Sergey Popov <popov_sergey@xxxxxxx>
---
init/main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Some drivers tend to print error messages (ex: 'drm/i810 does not support SMP') to the console
that we at our company don't want to show to people. We use 'quiet' kernel option to hide kernel decompressing progress and other messages not related to printk. But to hide error messages from drivers we use 'loglevel=3' parameter as well. But when it's _before_ the quiet, then quiet overrides loglevel=3 and set it to be 4.
I think that's a bug, and here's simple solution for it. The only way to live without this patch is to pass 'loglevel=3' after the 'quiet'. This issue is known to the community, but everyone is using workaround (ex: https://wiki.archlinux.org/index.php/Silent_boot).
I had enough inspiration to dive into the linux code and fix it.
--
with best regards,
Sergey Popov
phone: +380687507707
skype: uazure
vk.com/uazure
fb.com/uazurediff --git a/init/main.c b/init/main.c
index 61b99376..91fc78b 100644
--- a/init/main.c
+++ b/init/main.c
@@ -211,7 +211,12 @@ static int __init debug_kernel(char *str)
static int __init quiet_kernel(char *str)
{
- console_loglevel = CONSOLE_LOGLEVEL_QUIET;
+ /*
+ * 'quiet' option should not raise console_loglevel, it's only
+ * allowed to lower it
+ */
+ if (console_loglevel > CONSOLE_LOGLEVEL_QUIET)
+ console_loglevel = CONSOLE_LOGLEVEL_QUIET;
return 0;
}