linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] init/main.c: Print all command line when boot
@ 2020-05-19  3:29 王程刚
  2020-05-19  3:44 ` Andrew Morton
  2020-05-20 14:01 ` [PATCH] init/main.c: Print all command line when boot Masami Hiramatsu
  0 siblings, 2 replies; 27+ messages in thread
From: 王程刚 @ 2020-05-19  3:29 UTC (permalink / raw)
  To: 'Masami Hiramatsu', 'Steven Rostedt (VMware',
	'Andrew Morton', 'Kees Cook',
	'Thomas Gleixner', 'Dominik Brodowski',
	'Arvind Sankar', 'Mike Rapoport',
	'Alexander Potapenko',
	linux-kernel
  Cc: kernel

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@vivo.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


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2020-06-03 10:22 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19  3:29 [PATCH] init/main.c: Print all command line when boot 王程刚
2020-05-19  3:44 ` Andrew Morton
2020-05-19  5:09   ` Joe Perches
2020-05-19 14:34     ` Arvind Sankar
2020-05-19 19:42     ` [RFC PATCH 0/2] printk/init: multi-line kernel command line logging Joe Perches
2020-05-19 19:42       ` [RFC PATCH 1/2] printk: Move and rename maximum printk output line length defines Joe Perches
2020-05-21 13:49         ` Petr Mladek
2020-05-19 19:42       ` [RFC PATCH 2/2] init: Allow multi-line output of kernel command line Joe Perches
2020-05-20  4:41         ` Sergey Senozhatsky
2020-05-20  4:58           ` Joe Perches
2020-05-20 12:10             ` Sergey Senozhatsky
2020-05-20 20:36               ` Joe Perches
2020-05-21  1:00                 ` Andrew Morton
2020-05-21  2:09                   ` Joe Perches
2020-05-21  4:36                   ` Sergey Senozhatsky
2020-05-21  4:40                     ` Andrew Morton
2020-05-21 12:31                       ` Petr Mladek
2020-05-21 15:08                         ` Arvind Sankar
2020-05-21 12:48                       ` Sergey Senozhatsky
2020-05-21  4:32                 ` Sergey Senozhatsky
2020-05-21 13:46         ` Petr Mladek
2020-05-21 15:59         ` Arvind Sankar
2020-05-21 16:09           ` Joe Perches
2020-06-03  8:48         ` [init] d0bcc26c0d: BUG:kernel_hang_in_early-boot_stage,last_printk:early_console_in_setup_code kernel test robot
2020-05-21 18:40       ` [PATCH] printk: Move and rename maximum printk output line length defines Joe Perches
2020-05-25  8:38         ` Sergey Senozhatsky
2020-05-20 14:01 ` [PATCH] init/main.c: Print all command line when boot Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).