diff mbox series

[09/16] x86: zboot: Add an 'info' subcommand

Message ID 20200801160824.17486-10-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: zboot: Enhance the 'zboot' command | expand

Commit Message

Simon Glass Aug. 1, 2020, 4:08 p.m. UTC
Add a little subcommand that prints out where the kernel was loaded and
its setup pointer. Run it by default in the normal boot.

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

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

Comments

Wolfgang Wallner Aug. 13, 2020, 11:22 a.m. UTC | #1
Hi Simon,

-----"Simon Glass" <sjg@chromium.org> schrieb: -----
> Betreff: [PATCH 09/16] x86: zboot: Add an 'info' subcommand
> 
> Add a little subcommand that prints out where the kernel was loaded and
> its setup pointer. Run it by default in the normal boot.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/x86/lib/zimage.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)

Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
diff mbox series

Patch

diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index 5b096e9b0b0..2210ff69b72 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -68,9 +68,10 @@  struct zboot_state {
 
 enum {
 	ZBOOT_STATE_START	= BIT(0),
-	ZBOOT_STATE_GO		= BIT(1),
+	ZBOOT_STATE_INFO	= BIT(1),
+	ZBOOT_STATE_GO		= BIT(2),
 
-	ZBOOT_STATE_COUNT	= 2,
+	ZBOOT_STATE_COUNT	= 3,
 };
 
 static void build_command_line(char *command_line, int auto_boot)
@@ -383,6 +384,15 @@  static int do_zboot_start(struct cmd_tbl *cmdtp, int flag, int argc,
 	return 0;
 }
 
+static int do_zboot_info(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
+{
+	printf("Kernel loaded at %08lx, setup_base=%p\n",
+	       state.load_address, state.base_ptr);
+
+	return 0;
+}
+
 static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
@@ -400,6 +410,7 @@  static int do_zboot_go(struct cmd_tbl *cmdtp, int flag, int argc,
 
 U_BOOT_SUBCMDS(zboot,
 	U_BOOT_CMD_MKENT(start, 8, 1, do_zboot_start, "", ""),
+	U_BOOT_CMD_MKENT(info, 1, 1, do_zboot_info, "", ""),
 	U_BOOT_CMD_MKENT(go, 1, 1, do_zboot_go, "", ""),
 )
 
@@ -440,7 +451,7 @@  int do_zboot_parent(struct cmd_tbl *cmdtp, int flag, int argc,
 	}
 
 	do_zboot_states(cmdtp, flag, argc, argv, ZBOOT_STATE_START |
-			ZBOOT_STATE_GO);
+			ZBOOT_STATE_INFO | ZBOOT_STATE_GO);
 
 	return CMD_RET_FAILURE;
 }