diff mbox

[U-Boot,03/14] sandbox: Don't exit when bootm completes

Message ID 1467560446-10628-4-git-send-email-sjg@chromium.org
State Accepted
Commit b9c771b04c215de981987a92d5e1f016c8dd1921
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass July 3, 2016, 3:40 p.m. UTC
At present sandbox exits when the 'bootm' command completes, since it is not
actually able to run the OS that is loaded. Normally 'bootm' failure is
considered a fatal error in U-Boot.

However this is annoying for tests, which may want to examine the state
after a test is complete. In any case there is a 'reset' command which can
be used to exit, if required.

Change the behaviour to return normally from the 'bootm' command on sandbox.

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

 arch/sandbox/lib/bootm.c | 2 +-
 common/bootm_os.c        | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Teddy Reed July 3, 2016, 8:31 p.m. UTC | #1
Hi Simon,

On Sun, Jul 3, 2016 at 8:40 AM, Simon Glass <sjg@chromium.org> wrote:
> At present sandbox exits when the 'bootm' command completes, since it is not
> actually able to run the OS that is loaded. Normally 'bootm' failure is
> considered a fatal error in U-Boot.
>
> However this is annoying for tests, which may want to examine the state
> after a test is complete. In any case there is a 'reset' command which can
> be used to exit, if required.
>
> Change the behaviour to return normally from the 'bootm' command on sandbox.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Teddy Reed <teddy.reed@gmail.com>

> ---
>
>  arch/sandbox/lib/bootm.c | 2 +-
>  common/bootm_os.c        | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
> index d49c927..0c9a797 100644
> --- a/arch/sandbox/lib/bootm.c
> +++ b/arch/sandbox/lib/bootm.c
> @@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
>                 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
>                 printf("## Transferring control to Linux (at address %08lx)...\n",
>                        images->ep);
> -               reset_cpu(0);
> +               printf("sandbox: continuing, as we cannot run Linux\n");
>         }
>
>         return 0;
> diff --git a/common/bootm_os.c b/common/bootm_os.c
> index 9ec84bd..e3f5a46 100644
> --- a/common/bootm_os.c
> +++ b/common/bootm_os.c
> @@ -481,6 +481,7 @@ int boot_selected_os(int argc, char * const argv[], int state,
>
>         /* Stand-alone may return when 'autostart' is 'no' */
>         if (images->os.type == IH_TYPE_STANDALONE ||
> +           IS_ENABLED(CONFIG_SANDBOX) ||
>             state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */
>                 return 0;
>         bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);
> --
> 2.8.0.rc3.226.g39d4020
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

This will help a lot with vboot testing, thanks!

This may affect others with existing sandbox tests set up in a CI/CB.
But I feel this is the right approach since it now allows fallback
(corrupted recovery) / secondary boot media testing too.
Tom Rini July 16, 2016, 1:49 p.m. UTC | #2
On Sun, Jul 03, 2016 at 09:40:35AM -0600, Simon Glass wrote:

> At present sandbox exits when the 'bootm' command completes, since it is not
> actually able to run the OS that is loaded. Normally 'bootm' failure is
> considered a fatal error in U-Boot.
> 
> However this is annoying for tests, which may want to examine the state
> after a test is complete. In any case there is a 'reset' command which can
> be used to exit, if required.
> 
> Change the behaviour to return normally from the 'bootm' command on sandbox.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index d49c927..0c9a797 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -56,7 +56,7 @@  int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 		printf("## Transferring control to Linux (at address %08lx)...\n",
 		       images->ep);
-		reset_cpu(0);
+		printf("sandbox: continuing, as we cannot run Linux\n");
 	}
 
 	return 0;
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 9ec84bd..e3f5a46 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -481,6 +481,7 @@  int boot_selected_os(int argc, char * const argv[], int state,
 
 	/* Stand-alone may return when 'autostart' is 'no' */
 	if (images->os.type == IH_TYPE_STANDALONE ||
+	    IS_ENABLED(CONFIG_SANDBOX) ||
 	    state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */
 		return 0;
 	bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED);