In order to support the 'go' command we allow the jumping U-Boot to pass its
filename to the new U-Boot image. This can then be used to delete that image
if required.

Signed-off-by: Simon Glass <s...@chromium.org>
Signed-off-by: Simon Glass <s...@chromium.org>
Reviewed-by: Simon Glass <s...@chromium.org>
Tested-by: Che-Liang Chiou <clch...@chromium.org>
---
 arch/sandbox/cpu/start.c         | 16 ++++++++++++++++
 arch/sandbox/include/asm/state.h |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 1df21d4..2d19fe7 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -107,6 +107,22 @@ static int sandbox_cmdline_cb_interactive(struct 
sandbox_state *state,
 
 SANDBOX_CMDLINE_OPT_SHORT(interactive, 'i', 0, "Enter interactive mode");
 
+static int sandbox_cmdline_cb_jump(struct sandbox_state *state,
+                                  const char *arg)
+{
+       state->jumped = 1;
+
+       /*
+        * TODO(s...@chromium.org): Note this causes problems for gdb which
+        * wants to read debug data from the image.
+        *
+        * os_unlink(arg);
+        */
+
+       return 0;
+}
+SANDBOX_CMDLINE_OPT_SHORT(jump, 'j', 1, "Jumped from previous U-Boot");
+
 static int sandbox_cmdline_cb_memory(struct sandbox_state *state,
                                     const char *arg)
 {
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index e8e4fea..304104e 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -30,7 +30,8 @@ struct sandbox_state {
        enum exit_type_id exit_type;    /* How we exited U-Boot */
        const char *parse_err;          /* Error to report from parsing */
        int argc;                       /* Program arguments */
-       char **argv;
+       char **argv;                    /* Command line arguments */
+       bool jumped;                    /* Jumped from previous U_Boot */
        uint8_t *ram_buf;               /* Emulated RAM buffer */
        unsigned int ram_size;          /* Size of RAM buffer */
        const char *ram_buf_fname;      /* Filename to use for RAM buffer */
-- 
1.8.4.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to