[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <010201d62d8d$bf7605f0$3e6211d0$@vivo.com>
Date: Tue, 19 May 2020 11:29:46 +0800
From: 王程刚 <wangchenggang@...o.com>
To: "'Masami Hiramatsu'" <mhiramat@...nel.org>,
"'Steven Rostedt \(VMware'" <rostedt@...dmis.org>,
"'Andrew Morton'" <akpm@...ux-foundation.org>,
"'Kees Cook'" <keescook@...omium.org>,
"'Thomas Gleixner'" <tglx@...utronix.de>,
"'Dominik Brodowski'" <linux@...inikbrodowski.net>,
"'Arvind Sankar'" <nivedita@...m.mit.edu>,
"'Mike Rapoport'" <rppt@...ux.ibm.com>,
"'Alexander Potapenko'" <glider@...gle.com>,
<linux-kernel@...r.kernel.org>
Cc: <kernel@...o.com>
Subject: [PATCH] init/main.c: Print all command line when boot
Function pr_notice print max length maybe less than the command line length,
need more times to print all.
For example, arm64 has 2048 bytes command line length, but printk maximum
length is only 1024 bytes.
Signed-off-by: Chenggang Wang <wangchenggang@...o.com>
---
init/main.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/init/main.c b/init/main.c
index 03371976d387..4cf676cc3305 100644
--- a/init/main.c
+++ b/init/main.c
@@ -825,6 +825,16 @@ void __init __weak arch_call_rest_init(void)
rest_init();
}
+static void __init print_cmdline(void)
+{
+ const char *prefix = "Kernel command line: ";
+ int len = -strlen(prefix);
+
+ len += pr_notice("%s%s\n", prefix, boot_command_line);
+ while (boot_command_line[len])
+ len += pr_notice("%s\n", &boot_command_line[len]);
+}
+
asmlinkage __visible void __init start_kernel(void)
{
char *command_line;
@@ -858,7 +868,7 @@ asmlinkage __visible void __init start_kernel(void)
build_all_zonelists(NULL);
page_alloc_init();
- pr_notice("Kernel command line: %s\n", saved_command_line);
+ print_cmdline();
/* parameters may set static keys */
jump_label_init();
parse_early_param();
--
2.20.1
Powered by blists - more mailing lists