lkml.org 
[lkml]   [2020]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] init/main.c: Print all command line when boot
Date
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
\
 
 \ /
  Last update: 2020-05-19 05:31    [W:0.088 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site