sandbox: Add -j option to indicate a jump from a previous U-Boot
authorSimon Glass <sjg@chromium.org>
Thu, 27 Feb 2014 20:26:16 +0000 (13:26 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Mar 2014 02:05:48 +0000 (20:05 -0600)
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.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/start.c
arch/sandbox/include/asm/state.h

index 1df21d49fa501d9744b5a589cc1904d1f0bc20c6..2d19fe795e06baef0e6229ea3675fe8b6a6b714d 100644 (file)
@@ -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(sjg@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)
 {
index e8e4fea1b57de66865ac84e0f06011f77a93202f..304104e058e36b0455e3c0701dbb1843a26e69db 100644 (file)
@@ -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 */