diff mbox series

[v3,12/17] x86: zboot: Set environment variables for image locations

Message ID 20200905205053.1633153-13-sjg@chromium.org
State Accepted
Commit 126f47c3b81b4c429f8ddccaf3e2c70b665598f9
Delegated to: Bin Meng
Headers show
Series x86: zboot: Enhance the 'zboot' command | expand

Commit Message

Simon Glass Sept. 5, 2020, 8:50 p.m. UTC
At present it is not possible to tell from a script where the setup block
is, or where the image was loaded to. Add environment variables for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v3:
- Mention that the environment variables are for x86 only

 README                | 4 ++++
 arch/x86/lib/zimage.c | 3 +++
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/README b/README
index 6cb0567ba66..5132b2278cb 100644
--- a/README
+++ b/README
@@ -3425,6 +3425,10 @@  List of environment variables (most likely not complete):
   mempos	- Index position of the last match found by the 'ms' command,
 		  in units of the size (.b, .w, .l) of the search
 
+  zbootbase	- (x86 only) Base address of the bzImage 'setup' block
+
+  zbootaddr	- (x86 only) Address of the loaded bzImage, typically
+		  BZIMAGE_LOAD_ADDR which is 0x100000
 
 The following image location variables contain the location of images
 used in booting. The "Image" column gives the role of the image and is
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index d27c3b9284c..11f1c60d53d 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -382,6 +382,9 @@  static int do_zboot_load(struct cmd_tbl *cmdtp, int flag, int argc,
 		return CMD_RET_FAILURE;
 	}
 	state.base_ptr = base_ptr;
+	if (env_set_hex("zbootbase", (ulong)base_ptr) ||
+	    env_set_hex("zbootaddr", state.load_address))
+		return CMD_RET_FAILURE;
 
 	return 0;
 }