Skip to contentSkip to conversation

x86/setup: Add boot messages about cmdline builtins

PATCH Superseded Tony Fischetti 2 participants 3 messages Apr 22, 2020 – Apr 24, 2020 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/setup: Add boot messages about cmdline builtins

While the ability to override or append to the boot command line has been added, the boot messages contain no information as to whether the cmdline was manipulated by the build-time options. This patch, for x86, adds boot messages specifying whether the cmdline was manipulated and waits for the potential changes to take place before printing the final boot command line.

---
 arch/x86/kernel/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/setup.c +3 -1
index 4b3fa6cd3106..28d77f01fd0d 100644
@@ -828,7 +828,6 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	__flush_tlb_all();
 #else
-	printk(KERN_INFO "Command line: %s\n", boot_command_line);
 	boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
 #endif
 
@@ -904,10 +903,12 @@ void __init setup_arch(char **cmdline_p)
 
 #ifdef CONFIG_CMDLINE_BOOL
 #ifdef CONFIG_CMDLINE_OVERRIDE
+	pr_info("Overriding command line with builtin\n");
 	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
 	if (builtin_cmdline[0]) {
 		/* append boot loader cmdline to builtin */
+		pr_info("Appending command line to builtin\n");
 		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
 		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
@@ -916,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+	pr_info("Command line: %s\n", command_line);
 	*cmdline_p = command_line;
 
 	/*
Signature · 1 line
2.20.1
#1 lore raw
Quoted 38 lines · Tony Fischetti

While the ability to override or append to the boot command line has been added, the boot messages contain no information as to whether the cmdline was manipulated by the build-time options. This patch, for x86, adds boot messages specifying whether the cmdline was manipulated and waits for the potential changes to take place before printing the final boot command line.

---
 arch/x86/kernel/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/setup.c +2 -1
index 4b3fa6cd3106..28d77f01fd0d 100644
@@ -828,7 +828,6 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	__flush_tlb_all();
 #else
-	printk(KERN_INFO "Command line: %s\n", boot_command_line);
 	boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
 #endif
 
@@ -904,10 +903,12 @@ void __init setup_arch(char **cmdline_p)
 
 #ifdef CONFIG_CMDLINE_BOOL
 #ifdef CONFIG_CMDLINE_OVERRIDE
+	pr_info("Overriding command line with builtin\n");
 	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
 	if (builtin_cmdline[0]) {
 		/* append boot loader cmdline to builtin */
+		pr_info("Appending command line to builtin\n");
 		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
 		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 920

Quoted 4 lines
arch/x86/kernel/setup.c +1 -0
@@ -916,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+	pr_info("Command line: %s\n", command_line);

Yeah, adding info to tell there's action on overriding or apending command line looks good to me. Maybe keep the printing of the original command, we can get the final command line from '/proc/cmdline' after system boot, or just get it from the original cmdline + CONFIG_CMDLINE. Or print the original cmdline and the final cmdline both.

Personal opinion.

Quoted 6 lines
arch/x86/kernel/setup.c +0 -0
 	*cmdline_p = command_line;
 
 	/*
Signature · 1 line
2.20.1
#2 lore raw

I like the idea of printing the original one, printing the information about the cmdline manipulation, and, then, printing the final one at the end, too.

The only problem is I don't know what to label the first printk so that it remains clear that it's not necessarily the _final_ one, yet.

In either case, they should probably be changed to pr_infos, right?

Quoted 60 lines · Baoquan He
Quoted 38 lines · Tony Fischetti

While the ability to override or append to the boot command line has been added, the boot messages contain no information as to whether the cmdline was manipulated by the build-time options. This patch, for x86, adds boot messages specifying whether the cmdline was manipulated and waits for the potential changes to take place before printing the final boot command line.

---
 arch/x86/kernel/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/setup.c +2 -1
index 4b3fa6cd3106..28d77f01fd0d 100644
@@ -828,7 +828,6 @@ void __init setup_arch(char **cmdline_p)
       */
      __flush_tlb_all();
 #else
-     printk(KERN_INFO "Command line: %s\n", boot_command_line);
      boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
 #endif
 
@@ -904,10 +903,12 @@ void __init setup_arch(char **cmdline_p)
 
 #ifdef CONFIG_CMDLINE_BOOL
 #ifdef CONFIG_CMDLINE_OVERRIDE
+     pr_info("Overriding command line with builtin\n");
      strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
      if (builtin_cmdline[0]) {
              /* append boot loader cmdline to builtin */
+             pr_info("Appending command line to builtin\n");
              strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
              strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
              strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);

arch/x86/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 920

Quoted 4 lines
arch/x86/kernel/setup.c +1 -0
@@ -916,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
      strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+     pr_info("Command line: %s\n", command_line);

Yeah, adding info to tell there's action on overriding or apending command line looks good to me. Maybe keep the printing of the original command, we can get the final command line from '/proc/cmdline' after system boot, or just get it from the original cmdline + CONFIG_CMDLINE. Or print the original cmdline and the final cmdline both.

Personal opinion.

Quoted 6 lines
arch/x86/kernel/setup.c +0 -1
      *cmdline_p = command_line;
 
      /*
--

2.20.1

Signature · 4 lines
--
Tony Fischetti
[email protected]
(718) 431-4597