diff mbox series

[08/12] x86: zimage: Improve command-line debug handling

Message ID 20210116145343.8.I5c2b2cfb6dab027e5331a06e3c55b5e1d57720ce@changeid
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Minor improvements mostly for image loading | expand

Commit Message

Simon Glass Jan. 16, 2021, 9:53 p.m. UTC
At present if the command line is very long it is truncated by the
printf() statement, which works within a limited buffer. Use puts()
instead. Also show better debugging with the command-line setup
fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/x86/lib/zimage.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Bin Meng Jan. 21, 2021, 5:37 a.m. UTC | #1
On Sun, Jan 17, 2021 at 5:54 AM Simon Glass <sjg@chromium.org> wrote:
>
> At present if the command line is very long it is truncated by the
> printf() statement, which works within a limited buffer. Use puts()
> instead. Also show better debugging with the command-line setup
> fails.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  arch/x86/lib/zimage.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff mbox series

Patch

diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 3e9ee12400f..602788e016d 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -109,8 +109,11 @@  static void build_command_line(char *command_line, int auto_boot)
 
 	if (env_command_line)
 		strcat(command_line, env_command_line);
-
-	printf("Kernel command line: \"%s\"\n", command_line);
+#ifdef DEBUG
+	printf("Kernel command line:");
+	puts(command_line);
+	printf("\n");
+#endif
 }
 
 static int kernel_magic_ok(struct setup_header *hdr)
@@ -354,7 +357,8 @@  int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 			build_command_line(cmd_line, auto_boot);
 		ret = bootm_process_cmdline(cmd_line, max_size, BOOTM_CL_ALL);
 		if (ret) {
-			printf("Cmdline setup failed (err=%d)\n", ret);
+			printf("Cmdline setup failed (max_size=%x, bootproto=%x, err=%d)\n",
+			       max_size, bootproto, ret);
 			return ret;
 		}
 		printf("Kernel command line: \"");