[PATCH] init/main.c: Print all command line when boot

2020-05-18 Thread
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 
---
 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



[PATCH] arch/arm64: Enlarge arm64 command line length to 4096 bytes

2020-05-18 Thread
Now android use many long command line, and oem need append some command
line to debug boot, so 2048 bytes cannot able to meet the requirement.
Enlarge arm64's command line length to 4096 bytes.

Signed-off-by: Chenggang Wang 
---
 arch/arm64/include/uapi/asm/setup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/uapi/asm/setup.h
b/arch/arm64/include/uapi/asm/setup.h
index 5d703888f351..85e34aa784e0 100644
--- a/arch/arm64/include/uapi/asm/setup.h
+++ b/arch/arm64/include/uapi/asm/setup.h
@@ -22,6 +22,6 @@
 
 #include 
 
-#define COMMAND_LINE_SIZE  2048
+#define COMMAND_LINE_SIZE  4096
 
 #endif
-- 
2.20.1